# Report inference readiness

Source: https://stratadb.org/docs/reference/inference/status

Report what this binary can do before anything is attempted.

| | |
|---|---|
| Command | `inference.status` |
| CLI | `strata inference status` |
| Wire type | `inference_status` |
| Python | `db.ai.status() -> 'Any'` |
| Access | read |
| Commit | no commit |
| Wire status | stable |

Reports the inference facts that are knowable up front: whether this build can execute local models and download them, which providers are compiled in, which of those have an API key and where it was found, and how many catalogued models are already on disk.

Released binaries ship the cloud providers and leave local model execution out, so `local_execution` is false in them and every catalogued local model is unavailable until `strata inference install-local` adds it; `local_remedy` says so. Knowing that from `status` is the point: previously the only way to find out was to run an operation and read the failure.

`key_source` names where a key was read from: the environment variable, or the config file's path when the key was set with `strata config set <provider>.api_key`. The runtime asks the environment first and the config file second, and reports the one that answered, so `key_source` is exactly what a `generate` or `embed` call would use. The key itself is never returned.

`base_url` is the endpoint a call to the provider would reach, and `base_url_source` names what redirected it: the provider's own environment variable (`base_url_env_var` - `OPENAI_BASE_URL`, `ANTHROPIC_BASE_URL`, `GOOGLE_GEMINI_BASE_URL`, with the same meaning as in each provider's SDK), or the config file's path when it was set with `strata config set <provider>.base_url`. The environment wins over the file, as for a key. When neither is set, `base_url` is the provider's public endpoint and `base_url_source` is absent. A provider that is not reached over HTTP reports none of the three.

`config_file` names the file those settings are read from and whether it can be used - `absent`, `readable`, `unreadable` or `malformed`. This is what separates a provider that was never configured from one whose stored key cannot be reached: every settings read folds a failure into "no value", so a key in a malformed file reports exactly like no key at all (`key_present: false`, `key_source: null`), and the remedy a caller would offer - set a key - is the wrong one, because a key is already there. The four words are the ones `strata doctor` prints for the same file. `config_file` is `null` when the runtime reads no file at all - an embedding application supplying its own settings, or a platform with no user config directory - which is a different answer from `absent`, a path with no file at it.

The model directory is shared by every database on the machine, so a model downloaded once is available to all of them.

## Examples

Check what this build can do before running an inference command.

### CLI

```console
$ strata inference status  # reports build, providers, keys, and on-disk models without attempting a call
build	cloud providers only
	local models: this build runs cloud models only, and a bare model name means a local model. Either name a cloud model instead - `openai:<model>`, `google:<model>` or `anthropic:<model>` - or run `strata inference install-local` to add local execution.

providers
  openai	no key -- `strata config set openai.api_key <key>`, or export OPENAI_API_KEY
  anthropic	no key -- `strata config set anthropic.api_key <key>`, or export ANTHROPIC_API_KEY
  google	no key -- `strata config set google.api_key <key>`, or export GOOGLE_API_KEY
  local	not in this build

models	…
```

### Wire

```json
{"type":"inference_status"}
```

### Python

```python
{p["provider"] for p in db.ai.status()["providers"]} >= {"openai", "anthropic"}
isinstance(db.ai.status()["local_execution"], bool)
(db.ai.status()["config_file"] or {"state": "absent"})["state"] in (
```

## Returns

`InferenceStatus`

- `data` (`InferenceStatus`)
- `type` (`string`)

## Errors

Recover by code, never by message.

| Code | Retry | Commit outcome |
|---|---|---|
| [`failed_precondition.engine.runtime_closed`](https://stratadb.org/e/failed_precondition.engine.runtime_closed) | never | not_started |
| [`not_found.engine.branch`](https://stratadb.org/e/not_found.engine.branch) | never | not_applicable |

## Related

- [Report model cache](https://stratadb.org/docs/reference/inference/cache_status)
- [Report model capabilities](https://stratadb.org/docs/reference/inference/capability)
- [Detokenize token ids](https://stratadb.org/docs/reference/inference/detokenize)
- [Embed one or more texts](https://stratadb.org/docs/reference/inference/embed)
- [Generate text](https://stratadb.org/docs/reference/inference/generate)
- [List catalog models](https://stratadb.org/docs/reference/inference/models/list)
- [List local models](https://stratadb.org/docs/reference/inference/models/local)
- [Download a model](https://stratadb.org/docs/reference/inference/models/pull)
- [Rank passages](https://stratadb.org/docs/reference/inference/rank)
- [Tokenize text](https://stratadb.org/docs/reference/inference/tokenize)
- [Unload cached models](https://stratadb.org/docs/reference/inference/unload)
