Skip to main content

Module models_dev

Module models_dev 

Source
Expand description

models.dev catalog lookup for Harness::list_models.

models.dev is the open catalog of model specs (the same one opencode draws from). Its api.json is one GET, keyed by provider, so a CLI adapter tied to a provider (Claude → anthropic, Codex → openai) can offer a live model list instead of a hardcoded one — via provider_models.

The network call + HTTP client are gated behind the models-dev feature (off by default, keeping the neutral core HTTP-free). With the feature off, provider_models returns an empty list, so adapters fall back to their static models. With it on, the ~2 MB catalog is fetched once and cached on disk (under AGENT_HARNESS_CACHE_DIR, when the host app sets it): later launches load the cache instantly — so the picker works offline — and refresh it in the background. A provider’s models are filtered to the agent-usable ones (tool_call: true, which drops embeddings / tts / image models), mapped to HarnessModel, and ordered newest first.

Functions§

provider_models
The agent-usable models a provider serves per models.dev, mapped to HarnessModel and sorted by id for a stable picker order. Empty when the models-dev feature is off, the catalog can’t be fetched, or the provider is unknown — so a caller can fall back to its own static list.