OpenProgram Docs

Model catalog

Browse official list + models.dev memory only enable config.json full spec rows with provider.json fields ENABLED_MODELS get_model, chat picker, agents, failover
  1. Browse: official list and models.dev, memory only
  2. enable
  3. config.json: full spec rows with provider.json fields
  4. ENABLED_MODELS: get_model, chat picker, agents, failover

Selectable in chat equals enabled equals resolvable: there is one list. No big files, nothing stale, and the package directory stays read-only.

Who writes what

AuthorLocationContent
Humans, in gitproviders/adapters/<p>/provider.json, plus <p>.py for dedicated protocolsendpoints, thinking, cache, overrides
The programconfig.json → providers.<p>.modelsenabled specs, keys, user state
Networkmodels.dev, official /v1/modelsbrowsing only

Providers with no directory work through models.dev. catalog/enabled_models.py is the registry, settings/storage.py persists config, settings/thinking_spec.py holds thinking, models/listing/ is what interfaces read. Nothing else is named a catalog.

provider.json

Every field optional. If a machine can obtain a field, a human does not write it, so there is no model list.

FieldPurposeDefault
endpointsnamed api and base_url groupsmodels.dev base_url, OpenAI-compatible
thinkingwire_format, effort maps, per-model levels: Thinking effortlow, medium, high
cacheprompt cachingnone
model_overridesper-model headers, compat, endpoint, key_prefix; folded into the spec at enable timenone

Directories use underscores (amazon_bedrock/); id keeps hyphens. One service with two protocols is two endpoints of one provider.

Browse

Provider list: provider.json providers plus the models.dev index, with names and status only. Model list: queried for one provider, by _browse_models_with_error: the official source when credentialed, models.dev filling gaps or standing in, else empty.

A model the official list names and models.dev does not takes what it accepts (images, files, tools) from the listed model its id extends, grok-4.7-build-fast from grok-4.7: an official list seldom says what a model accepts, and a row with no word on it is text only. Price, context and name are never carried over.

Source shapeFetcher
Standard /v1/modelslisting/fetchers/openai_compat.py
Anthropic, per-model capabilitiesadapters/anthropic/list_models.py
Account-level privateadapters/openai_codex/list_models.py, xai_subscription/list_models.py
Vendor-specificgoogle (query key), amazon_bedrock (SigV4), github_copilot (session bearer), deepseek (ids only, enriched)

A provider that departs from standard ships list_models.py exposing fetch(provider_id, timeout); _load_fetcher imports it by directory, no central edit. Success: list[dict] with id and name. Failure: {"error": …}. fetch_and_normalize is the one normalisation point.

Ordinary results use a short memory cache. Subscription catalogues also keep an atomic last-known-good copy: a failed request can show stale rows, but only a non-empty official catalogue can retire models.

The models.dev catalogue is kept in memory and on disk, fresh for an hour. The disk copy's age is its file's: every command is a new process, and one that took the file for stale whatever its age downloaded the catalogue again and waited about three seconds for it on its way out.

Enable, disable, refresh

ActionEffect
Enable (toggle_model)Browse row, overrides, endpoint api and base_url, derived thinking levels go in providers.<p>.models; the registry reloads
DisableDeletes the row; a manual row stays with enabled: false. Subscription providers record the id in disabled_models.
RefreshRe-browses enabled models and overwrites their specs
Manual modelSame list, source: "manual"
Subscription catalogueAfter login, worker start when stale, every 6 h, manual Refresh: new ids enabled, changes refreshed, removed retired, disables kept. A change broadcasts provider_models_changed; web and desktop re-read, reconnecting clients too.

Use

ReaderSource
BackendENABLED_MODELS, key <prefix>/<id>, through get_model, get_providers, get_models; aliases on a miss
GET /api/providers/listProvider list
GET /api/providers/{name}/modelsThat provider's cached browse and enabled flags; POST …/fetch-models queries now
GET /api/models/enabledChat picker: ENABLED_MODELS as is
interfaces/server/thinking_effort.pyLevels from enabled rows

A failover or agent reference to a non-enabled model is a configuration error pointing at Settings. Old sessions keep their history but cannot continue on a deleted model.

An unknown id is refused with the nearest ones (catalog/suggestions.py): "Unknown model 'openai-codex':'gpt6 sol'; did you mean openai-codex:gpt-6.1-sol, …?". Names compare by words: display-name word 4, id word 3; a version or provider id counts only beside those. Follows magpie (yetone/magpie, MIT).

Invariants

  1. The only persisted model data is enabled specs in config, plus the subscription last-known-good copy.
  2. Ordinary browsing is never written to a file.
  3. Human data in git, program data in user config.
  4. provider.json has only what machines cannot obtain.
  5. openprogram.models.providers never imports openprogram.interfaces.server; the listing imports providers, never the reverse.
  6. <prefix>/<id>, alias fallback and key_prefix are preserved; the registry stays one mutable dict.
  7. One each: fetch_and_normalize (row shape), _upsert_spec_row with _normalize_spec_row (into config), _build_model_from_row (into Model).
What a change must preserve
  • A config row resolves through get_model to the same Model for every provider.
  • google-gemini-cli/* and gemini-subscription/* are distinct keys; rows carry their own.
  • cost, multimodal input, headers (copilot) and compat travel in the spec.
  • Multi-wire providers need one exec per (api, base_url, headers, compat).
  • test_provider_wire_invariants.py and test_model_fetch_routing.py stay green.

Fast tier

Last updated · 2026-11-25