Skip to main content

Module catalog

Module catalog 

Source
Expand description

Normalized model catalog types and provider-specific parsers.

This module is intentionally parser-first: unit tests exercise static JSON fixtures only. Live network fetches are thin wrappers around these parsers.

§Provider research notes (spec appendix)

OpenRouter GET https://openrouter.ai/api/v1/models — no auth required. Metadata: id, name, context_length, supported_parameters, pricing, top_provider, architecture.input_modalities. Reasoning detected from supported_parameters:

  • “reasoning”/“include_reasoning” => OpenRouter reasoning request
  • “reasoning_effort” => effort-style (o-series via OR)
  • “verbosity” => Anthropic-style through OR
  • pricing.internal_reasoning => Gemini thinking-token pricing

Groq GET https://api.groq.com/openai/v1/models — Bearer auth. Fields: id, active, context_window, owned_by. No reasoning in wire.

NVIDIA NIM GET https://integrate.api.nvidia.com/v1/models — no auth for list. Minimal: id, object, created, owned_by. Thinking via system-prompt injection.

Anthropic GET https://api.anthropic.com/v1/models — paginated, Bearer/x-api-key. Optional capabilities.thinking / capabilities.effort.

Re-exports§

pub use kimi::apply_kimi_reasoning_params;
pub use kimi::kimi_code_capability;
pub use kimi::kimi_code_model;
pub use kimi::kimi_code_static_catalog_models;
pub use kimi::kimi_static_capability;
pub use kimi::KimiCodeModelDescriptor;
pub use kimi::KimiReasoningCapability;
pub use kimi::KIMI_CODE_TEXT_MODELS;

Modules§

capability_cache
Process-local capability cache keyed by provider-qualified model id. Populated when a live Codex catalog is parsed; consulted by validation before falling back to the static table. No credentials stored.
kimi
Exact-id reasoning capability for the Kimi (Moonshot AI) static provider.
validation
Shared mutation-time reasoning validation and dynamic option derivation.

Structs§

AnthropicCatalogPage
AnthropicCatalogProvider
AnthropicExecutionPlan
AnthropicPlanError
AnthropicPlanPrerequisites
CatalogModel
Normalized model catalog entry. Every provider handler produces these.
CodexCatalogProvider
CodexExecutionPlan
CodexPlanError
CopilotCatalogEntry
Rich, evidence-preserving row from an experimental Copilot /models body.
CopilotModelDescriptor
Typed static descriptor for curated fallback models.
GenericCatalogProvider
GitHubCopilotCatalogProvider
GoogleGeminiCatalogProvider
GoogleGeminiModelDescriptor
GroqCatalogProvider
NvidiaCatalogProvider
OpenRouterCatalogProvider
PricingSummary
Pricing metadata. Stored as decimal-string USD/token as returned by OpenRouter.
XaiCatalogProvider
XaiModelDescriptor

Enums§

AnthropicExecutionMode
AnthropicPlanErrorCode
AnthropicWireEffort
AnthropicWorkflowPlan
CatalogBrokerError
Typed broker catalog failure (fix1 I2a): the static-fallback decision is made on TYPED broker variants, never by probing Display strings after the fact — so the outcome is deterministic for every credential state.
CatalogProviderKind
CatalogSource
CodexCapabilitySource
CodexExecutionMode
CodexMultiAgentMode
CodexMultiAgentVersion
Multi-agent protocol version advertised by the exact OpenAI Codex model.
CodexPlanErrorCode
CodexWireEffort
Reasoning values accepted by the Codex Responses request wire. Logical Ultra is deliberately absent and must be lowered by the planner.
CopilotEndpoint
Wire endpoint literals advertised on Copilot catalog rows.
CopilotPolicyState
Copilot per-model policy state — reflects account entitlement.
CopilotWire
Statically-selected wire endpoint for a curated fallback descriptor.
ExecutionRole
Modality
Input/output modality.
ReasoningSupport
Normalized reasoning/thinking capability for a model.
XaiReasoningCapability
Documented reasoning capability for an exact xAI model id.

Constants§

CATALOG_REQUEST_TIMEOUT
CODEX_CLIENT_VERSION
Codex client protocol version advertised on catalog discovery.
CODEX_PROVIDER_KEY
Canonical provider key (matches OAuth storage / broker id).
CODEX_PROVIDER_NAME
User-facing provider name.
COPILOT_API_VERSION
Live-verified API version header for api.githubcopilot.com catalog GETs.
COPILOT_FALLBACK_MODELS
Curated fallback — every entry is proven by selectable_copilot_entries on the reviewed fixture: type == chat, model_picker_enabled == true, and at least one reviewed endpoint. Policy/picker flags are opt-in metadata. Ordered for UI presentation.
COPILOT_PROVIDER_KEY
Canonical provider key (matches OAuth storage / broker id).
COPILOT_PROVIDER_NAME
User-facing provider name.
GOOGLE_GEMINI_PROVIDER_KEY
GOOGLE_GEMINI_PROVIDER_NAME
GOOGLE_GEMINI_TEXT_MODELS
Text/tool-capable wire IDs exposed by the official Gemini CLI. Preview and rollout models are intentionally visible; upstream account policy remains authoritative and may reject models not enabled for a particular user.
MAX_MODELS_BODY_BYTES
Maximum response body accepted from the models endpoint (256 KiB).
MODELS_BASE_URL
Pinned experimental models host for personal Copilot catalog discovery. Community-observed; not a GitHub-documented stable third-party API.
MODELS_PATH
Relative path allowlisted on the broker for this slice (catalog only).
MODELS_URL
Full pinned models URL (host + path, no query).
XAI_TEXT_MODELS

Traits§

ModelCatalogProvider

Functions§

anthropic_mode_capabilities
Look up exact qualified identities only. The complete manifest is validated before each decision; malformed source authority therefore fails closed.
anthropic_models_proxy_path
Relative Anthropic models path for the broker allowlist (no host).
anthropic_models_url
anthropic_static_capability
Conservative exact static fallback descriptors for the source-controlled known-model list (agent_core::models::KNOWN_MODELS). Exact ids only — never substring-based. Evidence: adaptive-thinking notes in crates/agent-core/src/core/models.rs (Opus 4.7+ / Opus 5.5 / Fable 5 adaptive+effort; Sonnet 4.6, Opus 4.6, Haiku 4.5 fixed-budget thinking). Max/UltraCode are NOT implied here — they stay locked to the dedicated mode manifest (anthropic_mode_capabilities).
catalog_provider_for
codex_models_path
Build the broker-relative path for the ChatGPT backend Codex catalog endpoint, including the required client_version query (matches official Codex). An empty client_version falls back to the pinned CODEX_CLIENT_VERSION — never SynapsCLI’s own crate version, which the backend would reject with an empty catalog.
codex_models_url
Full pinned models URL (host + path + client_version query).
codex_static_capability
Static per-model capability for the known Codex catalog, keyed by model id. Used when live catalog data is unavailable.
codex_static_catalog_models
Build the static catalog models with static capability data attached.
copilot_model
Look up a curated fallback descriptor by wire id.
copilot_static_catalog_models
Static fallback catalog for offline / seed UI paths. Every entry here is selectable by construction (see COPILOT_FALLBACK_MODELS).
fetch_catalog_models
Fetch catalog models for any registered provider. OpenRouter uses its rich parser; all others use the generic parser. Compatible shim: callers that previously used registry::fetch_provider_models and then mapped to ExpandedModelEntry can switch to this.
fetch_openrouter_catalog_models
Fetch the OpenRouter live model list. Auth not required.
from_static_seed
Build a static-fallback CatalogModel from a (id, label) pair.
github_copilot_runtime_model
Select the wire protocol from endpoints established by the captured live catalog. This is descriptor-driven: only IDs whose reviewed endpoint has been established by the fixture route. Unknown account models fail closed.
google_gemini_model
google_gemini_static_catalog_models
infer_groq_reasoning
infer_nvidia_reasoning
is_missing_credential_catalog_error
True when a broker catalog error means “no credential / not logged in”, so static seeds are an acceptable offline fallback.
merge_catalog_pages
models_request_headers
Headers attached to the experimental Copilot models GET. Session bearer is applied by the broker — never pass the GitHub user token.
parse_anthropic_catalog_models
parse_anthropic_catalog_page
parse_codex_catalog_models
Parse the ChatGPT backend-api models response into normalized catalog rows.
parse_copilot_catalog_entries
Parse an experimental Copilot /models body into rich descriptor entries.
parse_copilot_catalog_models
Parse an experimental Copilot /models body into normalized catalog rows.
parse_generic_catalog_models
Parse a {data:[{id,name?}]} response. Identical filtering behaviour to registry::parse_provider_models_response.
parse_groq_catalog_models
parse_nvidia_catalog_models
parse_openrouter_catalog_models
Parse an OpenRouter /models JSON body into CatalogModel entries. Pure function — no network I/O — safe to unit-test with fixtures.
plan_anthropic_execution
plan_codex_execution
Derive the exact Codex request contract from provider-qualified identity, logical selection, authoritative capability metadata, and runtime role.
plan_standard_anthropic_transport
preferred_wire_protocol_from_endpoints
Choose a broker wire protocol from a fixture row’s vendor and supported_endpoints. Returns None when no reviewed endpoint is advertised (fail closed).
selectable_copilot_entries
Selectable-only view — helper for pickers and expanded-fallback checks.
static_seeds_from_spec
Convert all static seeds in a ProviderSpec to CatalogModel entries.
validate_codex_level
Validate that the given level is supported by the Codex model identified by model_id. Uses the provided catalog when available, else falls back to the static table.
validate_models_endpoint
Validate the pinned models URL (fail closed on host/path drift).
xai_model
xai_static_capability
Exact-id capability lookup — never substring-based. Unknown ids return None and fail closed at validation time.
xai_static_catalog_models

Type Aliases§

CodexRequestRole
Backward-compatible name; request role semantics are provider-neutral.