# Models & Providers


kli ships the model providers `anthropic`, `openai`, `openai-codex`, and
`compatible`. All but `compatible` carry a fixed catalogue of model ids, registered
when the provider extension installs. The `compatible` provider has no built-in
models; you define its providers, models, and semantic options in `~/.config/kli/providers.json`.

Each model id below is the selection value for that model. A model is available
only when its provider's credential is present. For credential keys, transports,
semantic option lowering, and the OAuth flow, see
[Providers and Transports](/kli/models/providers-and-transports).

<!-- KLI_MODEL_CATALOGUE:BEGIN -->

## anthropic

Transport: Messages API (`anthropic-messages`). Credential: `ANTHROPIC_API_KEY`.
Base URL: `https://api.anthropic.com`. All models declare `reasoning-effort`.

| Model id | Context window | Max output | Options |
|---|---|---|---|
| `claude-opus-4-8` | 1,000,000 | 128,000 | `reasoning-effort` |
| `claude-opus-4-7` | 1,000,000 | 128,000 | `reasoning-effort` |
| `claude-opus-4-6` | 1,000,000 | 128,000 | `reasoning-effort` |
| `claude-sonnet-4-6` | 1,000,000 | 64,000 | `reasoning-effort` |
| `claude-sonnet-4-5` | 200,000 | 64,000 | `reasoning-effort` |
| `claude-haiku-4-5` | 200,000 | 64,000 | `reasoning-effort` |

## openai

Transport: Responses API (`openai-responses`). Credential: `OPENAI_API_KEY`.
Base URL: `https://api.openai.com/v1`. All models declare `reasoning-effort`.

| Model id | Context window | Max output | Options |
|---|---|---|---|
| `gpt-5.1` | 272,000 | 128,000 | `reasoning-effort` |
| `gpt-5.2` | 272,000 | 128,000 | `reasoning-effort` |
| `gpt-5.4` | 272,000 | 128,000 | `reasoning-effort` |
| `gpt-5.5` | 272,000 | 128,000 | `reasoning-effort` |

## openai-codex

Transport: Responses API (`openai-responses`) against the ChatGPT backend.
Credential: OAuth only — there is no environment key; you sign in with a ChatGPT
account. Base URL: `https://chatgpt.com/backend-api`. All models declare `reasoning-effort`.

The catalogue is the ChatGPT-account allowlist. The endpoint rejects any other id.

| Model id | Context window | Max output | Options |
|---|---|---|---|
| `gpt-5.3-codex-spark` | 128,000 | 128,000 | `reasoning-effort` |
| `gpt-5.4` | 272,000 | 128,000 | `reasoning-effort` |
| `gpt-5.4-mini` | 272,000 | 128,000 | `reasoning-effort` |
| `gpt-5.5` | 272,000 | 128,000 | `reasoning-effort` |

<!-- KLI_MODEL_CATALOGUE:END -->

## compatible

User-defined OpenAI-compatible providers, read from `~/.config/kli/providers.json`.
This provider registers nothing of its own; each entry in the file becomes a
provider with its own id, models, credential, and semantic option schemas. The file
is a JSON object keyed by provider id. Secrets never live in the file — `key-env`
names the environment variable that holds the key. If `key-env` is absent, the
provider registers without a credential reference.

Per-provider fields:

| Field | Type | Default | Effect |
|---|---|---|---|
| `base-url` | string | — | Endpoint base URL. |
| `api` | string | `openai-completions` | Transport: `openai-completions` or `openai-responses`. |
| `key-env` | string | none | Environment variable holding the API key. |
| `url-path` | string | none | Request path appended to `base-url`; applied only when `api` is `openai-responses`. |
| `headers` | object | none | Extra request headers as a string-to-string map. |
| `options` | object | none | Provider-level semantic option schemas inherited by every model. |
| `models` | array | empty | Model entries for this provider. |

Per-model fields under `models`:

| Field | Type | Default | Effect |
|---|---|---|---|
| `id` | string | — | Model id passed to the endpoint and used for selection. |
| `name` | string | value of `id` | Display name. |
| `context-window` | integer | none | Context window size. |
| `options` | object | provider-level options | Model-level semantic option schemas; entries replace inherited schemas, and `null` removes an inherited option. |

Example `~/.config/kli/providers.json`:

```json
{
  "my-endpoint": {
    "base-url": "https://api.example.com/v1",
    "api": "openai-completions",
    "key-env": "MY_ENDPOINT_API_KEY",
    "options": {
      "reasoning-effort": {
        "values": ["off", "low", "medium", "high"],
        "default": "off"
      }
    },
    "models": [
      { "id": "model-a", "context-window": 128000 },
      {
        "id": "model-b",
        "name": "Model B",
        "context-window": 32000,
        "options": { "reasoning-effort": null }
      }
    ]
  }
}
```
