Module providers
Expand description
ModelProvider subsystem — re-exported from zeroclaw-providers.
Modules§
- anthropic
- auth
- azure_
openai - bedrock
- AWS Bedrock model_provider using the Converse API.
- catalog
- Per-family catalog source table.
- compatible
- Generic OpenAI-compatible model_provider.
Most LLM APIs follow the same
/v1/chat/completionsformat. This module provides a single implementation that works for all of them. - copilot
- GitHub Copilot model_provider with OAuth device-flow authentication.
- dispatch
ProviderDispatch— single source of truth forattribution_span!on theModelProvidersurface.- factory
- Per-family construction dispatch for model providers.
- gemini
- Google Gemini model_provider with support for:
- gemini_
cli - Gemini CLI subprocess model_provider.
- kilocli
- KiloCLI subprocess model_provider.
- model_
pin - models_
dev - Unauthenticated cross-provider model catalog via models.dev.
- multimodal
- ollama
- openai
- openai_
codex - openrouter
- openrouter_
catalog - Cross-vendor model catalog via OpenRouter’s public
/api/v1/modelsendpoint. - pricing
- Live model pricing: a single process-global snapshot of token prices
fetched from providers’ own
/modelslistings (with the models.dev catalog as a secondary source for models the gateway doesn’t price), used as a FALLBACK beneath the operator’s[cost.rates]config. - reliable
- router
- telnyx
- Telnyx AI inference model_provider.
- traits
- vision_
override
Structs§
- Chat
Message - A single message in a conversation.
- Chat
Request - Request payload for model_provider chat calls.
- Chat
Response - An LLM response that may contain text, tool calls, or both.
- Model
Provider Info - Information about a supported model model_provider for display purposes.
- Model
Provider Runtime Options - Provider
Capability Error - Structured error returned when a requested capability is not supported.
- Provider
Dispatch - Wraps a model provider so every call opens the correct
attribution_span!automatically. See the module docs for the rationale and the CI gate that enforces routing through this type. - Provider
Dispatch Ref - Resolved
Model Provider Ref - A provider resolved from a config reference together with the model declared by that same alias. The model is an on-demand view of Config, not stored provider state.
- Tool
Call - A tool call requested by the LLM.
- Tool
Result Message - A tool result to feed back to the LLM.
Enums§
- Conversation
Message - A message in a multi-turn conversation, including tool interactions.
- Model
Provider Category - Grouping for a model-provider family. Replaces the section comments in the
registry list with data so surfaces (CLI list, docs capability table) can
group families without re-typing the membership. Mirrors the registry’s
own sections exactly; locality is the separate
localflag, not a category.
Traits§
Functions§
- api_
error - Build a sanitized model_provider error from a failed HTTP response.
- canonical_
model_ provider_ slots - canonicalize_
v2_ model_ provider_ name - create_
model_ provider - create_
model_ provider_ for_ alias - create_
model_ provider_ for_ alias_ with_ url - Factory: create model_provider with alias context AND custom base URL.
- create_
model_ provider_ from_ ref - Build a bare (non-resilient) provider named by
name- a bare family ("llamacpp"), a dotted alias ("llamacpp.text_model"), or acustom:<url>ref - resolving its alias-specific runtime options fromconfig: thevisioncapability override, the endpoint URI, and per-alias credentials from[providers.models.<family>.<alias>]. - create_
model_ provider_ from_ ref_ with_ model - Resolve a provider reference and its alias-owned model as one materialized
view. Callers may apply their own explicit model override after resolution;
when the reference is bare or URL-based,
modelisNone. - create_
model_ provider_ with_ options - Factory: create model_provider with runtime options.
Legacy entry point — see
create_model_provider. - create_
model_ provider_ with_ url - Factory: create model_provider with optional custom base URL.
Legacy entry point — see
create_model_provider. - create_
resilient_ model_ provider_ for_ alias - Wrap the primary model_provider in a retry/backoff harness with full alias context. Production callers (gateway, orchestrator) use this so the dispatch sees the typed alias config and routes Azure/Codex/Gemini extras correctly.
- create_
resilient_ model_ provider_ from_ ref - create_
resilient_ model_ provider_ with_ options - create_
routed_ model_ provider_ with_ options - default_
model_ provider_ url - Canonical base URL for
name, mirroring whatcreate_model_providerwould dial.Nonefor families without a fixed default (Azure, custom, multi-region, CLI shims). - fetch_
context_ window - Attempt to fetch context window from provider’s /models endpoint.
Returns
Noneon any failure (network, parsing, missing field) — caller uses fallback. - format_
error_ chain - Format an error including its full source chain and sanitize the result.
- is_
bailian_ alias - is_
doubao_ alias - is_
glm_ alias - is_
glm_ cn_ alias - is_
glm_ global_ alias - is_
minimax_ alias - is_
minimax_ cn_ alias - is_
minimax_ intl_ alias - is_
moonshot_ alias - is_
moonshot_ cn_ alias - is_
moonshot_ intl_ alias - is_
qianfan_ alias - is_
qwen_ alias - is_
qwen_ cn_ alias - is_
qwen_ intl_ alias - is_
qwen_ oauth_ alias - is_
qwen_ us_ alias - is_
zai_ alias - is_
zai_ cn_ alias - is_
zai_ global_ alias - list_
model_ providers - Return the list of all known model_providers for display in
zeroclaw model_providers list. - model_
provider_ runtime_ options_ from_ model_ provider_ entry - options_
for_ provider_ ref - Options to use when building a provider from a name that may be either
a bare family or a dotted alias. Dotted names yield alias-resolved
options; bare names inherit only provider-agnostic settings from
fallback. - provider_
runtime_ options_ for_ agent - Resolve
ModelProviderRuntimeOptionsfrom an agent’smodel_provideralias ("<type>.<alias>"). Returns safe defaults when the agent alias doesn’t exist, doesn’t have amodel_providerset, or names a non-existent entry. - provider_
runtime_ options_ for_ alias - recommended_
runtime_ profile - Provider-specific runtime recommendations. This is deliberately separate
from
local: credential-free CLI shims can call cloud models, and local providers without native tool support must retain text-fallback prompting. - sanitize_
api_ error - Sanitize API error text by scrubbing secrets and truncating length.
- scrub_
secret_ patterns - Scrub known secret-like token prefixes from model_provider error strings.
Redacts tokens with prefixes like
sk-,xoxb-,xoxp-,ghp_,gho_,ghu_, andgithub_pat_.