Research CommonsResearch Commons
llm-rotate/Providers

Providers

The supported providers, their auth methods, model conventions, and how the provider is resolved for a call.

llm-rotate ships a built-in catalog of seven providers. Each has an auth method, a client adapter, and default cooldown/quarantine values you can override in configuration.

Supported providers

Provider IDTypeAuthNotes
openaidirectAPI keyChat Completions API.
anthropicdirectAPI keyMessages API.
google_ai_studiodirectAPI keyGemini Developer API.
google_vertexdirectService account / ADCNeeds auth_config project + region.
openrouterbrokerAPI keyOpenAI-compatible aggregator; routes to upstreams.
azure_openaidirectAPI keyAzure-hosted OpenAI. Needs auth_config azure_endpoint. No extra required.
aws_bedrockdirectSigV4Bedrock Converse API. Needs the bedrock extra and auth_config region.

Built-in defaults

ProviderCooldownQuarantine
openai30s300s
anthropic60s300s
google_ai_studio30s300s
google_vertex30s300s
openrouter30s300s
azure_openai30s300s
aws_bedrock30s300s

OpenRouter's known upstreams are anthropic, openai, google_ai_studio, and google_vertex.

Auth methods

API-key providers

openai, anthropic, google_ai_studio, and openrouter all use a single API key referenced via secret_ref:

{
    "key_id": "anthropic-1",
    "provider": "anthropic",
    "secret_ref": "env://ANTHROPIC_API_KEY",
    "models": ["claude-haiku-4-5-20251001"],
}

Google Vertex AI

Vertex uses service-account credentials and requires project + region in auth_config. The service-account JSON is resolved through secret_ref (e.g. an env var holding the JSON), or you can rely on Application Default Credentials.

{
    "key_id": "vertex-1",
    "provider": "google_vertex",
    "secret_ref": "env://VERTEX_SA_JSON",
    "auth_method": "service_account",
    "auth_config": {"project": "my-gcp-project", "region": "us-central1"},
    "models": ["gemini-2.0-flash"],
}

Azure OpenAI

Azure OpenAI is wire-compatible with the OpenAI Chat Completions API, so it rides on the core openai dependency — no extra to install. The model you pass is the Azure deployment name, and the endpoint comes from auth_config:

{
    "key_id": "azure-1",
    "provider": "azure_openai",
    "secret_ref": "env://AZURE_OPENAI_API_KEY",
    "auth_config": {
        "azure_endpoint": "https://my-resource.openai.azure.com",
        "api_version": "2024-10-21",
    },
    "models": ["my-gpt-4o-deployment"],
}

AWS Bedrock

Bedrock uses the Converse API and the aioboto3 SigV4 stack (pip install "llm-rotate[bedrock]"). region is required in auth_config; credentials can come from an explicit access key, a named profile, or an instance role:

# Explicit access key — secret_ref resolves the AWS secret access key.
{
    "key_id": "bedrock-1",
    "provider": "aws_bedrock",
    "secret_ref": "env://AWS_SECRET_ACCESS_KEY",
    "auth_config": {
        "region": "us-east-1",
        "aws_access_key_id": "AKIA...",
    },
    "models": ["anthropic.claude-3-5-sonnet-20241022-v2:0"],
}
 
# Profile or instance role — use a literal:// placeholder for the unused secret.
{
    "key_id": "bedrock-role",
    "provider": "aws_bedrock",
    "secret_ref": "literal://unused",
    "auth_config": {"region": "us-east-1", "profile_name": "my-profile"},
    "models": ["anthropic.claude-3-5-sonnet-20241022-v2:0"],
}

Model-ID conventions

The model string you pass to chat() must be valid for whichever provider serves it. This matters most for OpenRouter, which uses namespaced model IDs:

ProviderExample model ID
openaigpt-4o-mini
anthropicclaude-haiku-4-5-20251001
google_ai_studiogemini-2.0-flash
google_vertexgemini-2.0-flash
openrouteranthropic/claude-haiku-4.5, openai/gpt-4o-mini
azure_openaiyour deployment name, e.g. my-gpt-4o-deployment
aws_bedrockanthropic.claude-3-5-sonnet-20241022-v2:0
Fallback model compatibility is your responsibility

When a fallback chain re-routes to another provider, you must ensure the model ID is valid there. OpenRouter uses anthropic/claude-haiku-4.5, not the native Anthropic model ID.

How the provider is resolved

For each call, llm-rotate decides which provider's keys to try:

  1. Explicit provider= argument → only that provider's keys are tried; the fallback chain is not consulted.
  2. No provider= → the provider is inferred from the model name:
    • First, any active key whose models list contains the model.
    • Then the provider catalog's supported_models.
    • Then prefix heuristics: claude* → anthropic, gpt-* / o1- / o3- / o4- → openai, gemini* → google_ai_studio.
  3. On exhaustion → the fallback_chains entry keyed by the inferred provider is walked in order.
  4. Can't infer and no chainConfigurationError.