Skip to Content
ReferenceProviders

Providers

v1 status: hand-written from src/providers/mod.rs. Will be generated by trait introspection in a later iteration. The canonical reference in the upstream repo is docs/providers-reference.md.

Picking a provider

Set the default at the top level of config.toml:

default_provider = "openrouter" default_model = "anthropic/claude-sonnet-4.6" api_key = "${OPENROUTER_API_KEY}" api_url = "https://openrouter.ai/api/v1"

api_url is optional — providers ship with sensible defaults.

Direct backends (full implementations)

These have dedicated provider modules:

SlugAliasesSource
openroutersrc/providers/openrouter.rs
anthropicsrc/providers/anthropic.rs
openaisrc/providers/openai.rs
ollamasrc/providers/ollama.rs
geminigoogle, google-geminisrc/providers/gemini.rs
bedrockaws-bedrocksrc/providers/bedrock.rs
copilotgithub-copilotsrc/providers/copilot.rs
openai-codexopenai_codex, codexOpenAI device-code auth flow

OpenAI-compatible providers

Backed by the generic OpenAI-shape adapter. Each gets its own factory key for explicit selection:

venice, vercel (alias vercel-ai), cloudflare (alias cloudflare-ai), kimi-code, synthetic, opencode (alias opencode-zen), groq, mistral, xai (alias grok), deepseek, together (alias together-ai), fireworks (alias fireworks-ai), perplexity, cohere, lmstudio (alias lm-studio), llamacpp (alias llama.cpp), nvidia (alias nvidia-nim), astrai, ovhcloud (alias ovh).

Alias-matched regional families

These match by prefix or family name:

  • moonshot* / kimi*
  • glm* / zhipu* / bigmodel
  • minimax* / minimaxi — also matches OAuth-flow variants minimax-oauth, minimax-oauth-cn, minimax-portal, minimax-portal-cn
  • qwen* / dashscope*
  • zai / z.ai*
  • qianfan / baidu
  • doubao / volcengine / ark

Set default_provider to any of these prefixes (or a specific match) to use them.

Custom URL prefixes

Two special slug forms let you point at any compatible endpoint:

  • default_provider = "custom:https://my-llm.example.com/v1" — generic OpenAI-shape protocol
  • default_provider = "anthropic-custom:https://my-anthropic-proxy.example.com" — Anthropic Messages-shape protocol

Multi-provider routing

The actual configuration shape is a top-level scalar + [reliability] block + optional [[model_routes]]:

default_provider = "openrouter" default_model = "anthropic/claude-sonnet-4.6" api_key = "${OPENROUTER_KEY}" [reliability] provider_retries = 2 # default 2 provider_backoff_ms = 500 # base; doubles up to 10s cap fallback_providers = ["anthropic", "openai"] api_keys = ["${KEY_1}", "${KEY_2}"] # rotated on 429 [reliability.model_fallbacks] "anthropic/claude-sonnet-4.6" = ["anthropic/claude-haiku-4.5", "openai/gpt-4o"] [[model_routes]] hint = "claude-" # match prefix on the requested model name provider = "anthropic" # route to this provider api_key = "${ANTHROPIC_KEY}"

There is no [provider] block, no primary = "..." / fallback = "..." pair, and no per-provider [provider.<name>] blocks.

What the reliable wrapper does

src/providers/reliable.rs (ReliableProvider) wraps every provider with:

  • retry with exponential backoff (base provider_backoff_ms, doubles capped at 10s)
  • multi-provider fallback through fallback_providers
  • per-model fallback chains via model_fallbacks
  • API-key rotation through api_keys on 429
  • Retry-After header parsing
  • non-retryable error classification (4xx, auth, context-window-exceeded skip retry)

What it does not do: per-request timeouts (those live in the underlying HTTP client), circuit breakers (each call resets backoff state).

ProviderCapabilities

The ProviderCapabilities struct returned by each provider has only two fields:

pub struct ProviderCapabilities { pub native_tool_calling: bool, pub vision: bool, }

For tool calling, providers without native support fall back to ToolsPayload::PromptGuided — the agent injects <tool_call>-tagged XML into the user prompt. The framework’s convert_tools method per-provider produces the right payload variant (Gemini, Anthropic, OpenAI, or PromptGuided).

Last updated on