# Fast tier

| Route | On the wire | Support comes from |
| --- | --- | --- |
| `openai-codex` | body `service_tier: "priority"` | the account catalogue's `service_tiers` |
| OpenAI Responses and Completions | body `service_tier` | row `fast`, then models.dev `speed_modes` |
| `anthropic`, Opus 4.6, 4.7, 4.8 | `extra_body={"speed":"fast"}` and `anthropic-beta: fast-mode-2026-02-01`, appended without clobbering other betas | `Model.fast`, default table |
| `xai`, `grok-4.6`, `https://api.x.ai/v1` | `service_tier` | provider and endpoint scoped declaration |
| `xai-subscription`, `grok-4.6` | `service_tier` | declared; other models `unknown` |
| all other wires | nothing leaves the process | none |

Anthropic's 429 "Usage credits are required for fast mode" is an account problem and is shown as is. Not listed does not mean a provider lacks a fast tier. UI contract: [Composer speed control](https://fzkuji.github.io/OpenProgram/docs/reference/design/ui/composer/composer-fast-control.html).

## Capability

`providers/settings/fast.py fast_capability`, shared by the agent-settings projection and dispatch; `supports_fast` is its boolean form.

1. Row `fast: false`: unsupported
2. `openai-codex`: `Model.fast` from the account catalogue
3. Row `fast: true`: supported
4. xAI declarations above
5. models.dev `speed_modes` with `priority` or `fast`: supported
6. Otherwise `unknown`

`Model.fast`: a row's `fast` wins; `enabled_models.default_fast` fills rows with none.

## Codex source

`GET https://chatgpt.com/backend-api/codex/models?client_version=<ver>`, with the subscription bearer and `chatgpt-account-id`.

| Field | Gives |
| --- | --- |
| `service_tiers` with `id:"priority"` | Fast tier |
| `supported_reasoning_levels` | Thinking picker |
| `context_window` | The real subscription value |

Requests and dispatch use `originator: codex_cli_rs` and `version`: the backend greylists ids such as `gpt-5.6-luna` by client, so another originator sees the model and then gets 404. models.dev tracks the API platform, not this front door.

## Storage

Official endpoint, then normalise, then last-known-good cache and `config.json`, then registry, then `supports_fast` and dispatch.

| Layer | Location | Persistence |
| --- | --- | --- |
| Official endpoint, CLI cache | `openai_codex/list_models.py` | live first; `~/.codex/models_cache.json` is a stale display fallback |
| Subscription catalogue | `catalog/subscription_catalog.py` | atomic last-known-good; after login and periodically |
| Spec row | `config.json` | official refresh adds, updates and retires; honors disables |
| `Model.fast` | `_build_model_from_row` | memory |
| models.dev | `catalog/sources/models_dev.py` | remote, 1 h memory cache |

CLI cache rows carry an error, so they never add or delete configured models.

## Turn

| Moment | Behaviour |
| --- | --- |
| Connect, session, branch or model switch, each turn ack and settle | `loadAgentSettings()` reads `GET /api/agent_settings`; `chat.fast` is recomputed; the composer re-renders, no reload |
| Preference | Per conversation branch; dispatch revalidates provider/model support. Standard overrides agent defaults |
| Send | `service_tier: "priority"` only when enabled and supported; otherwise `default` |
| Dispatch | `resolve_service_tier` revalidates the actual model |
| Evidence | Usage keeps requested and actual tier; per-call evidence saved with the message, shown in the usage footer after reload. Missing metadata is unconfirmed. xAI reported cost beats catalogue cost; no speed ratio is inferred. |

**Files and change guide**

| File | Holds |
| --- | --- |
| `models/providers/types.py` | `Model.fast` |
| `providers/catalog/enabled_models.py` | `default_fast`, config-row backfill |
| `adapters/openai_codex/{openai_codex,catalog}.py` | Passthrough, client identity |
| `adapters/anthropic/anthropic.py` | Claude wire |
| `adapters/openai_codex/list_models.py` | Official fetch |
| `listing/fetchers/__init__.py` | Passes fast and thinking; enrich cannot overwrite |
| `interfaces/server/routes/execution/runtime.py` | `chat.fast` |
| `apps/web/components/chat/composer/index.tsx` | Control, send gate |

Codex models need only a Fetch. Detection logic: `fast_capability`. Claude: `default_fast`. Other providers: works once models.dev knows it.

[Thinking effort](https://fzkuji.github.io/OpenProgram/docs/reference/design/providers/models/thinking-effort.html)
