Skip to content

Providers

Last updated: 2026-11-27T02:00:32-03:00 (UTC-3)

A provider is a connection to an AI service: OpenAI, Anthropic, Bedrock in your AWS account, a vLLM on your network. The gateway ships 129 presets, connections already filled in with protocol, URL and authentication method, so you only supply the credential. This guide shows how to connect, authenticate and use each provider family.

From the console: in Providers → Add provider, choose the preset, enter the credential and save. The credential is stored encrypted in PostgreSQL and never comes back in listings. Then create a model (alias) that points to it and use Test to make a real call before releasing it.

From the YAML: a provider can name a preset and inherit the protocol, URL, authentication and the name of the key variable. Whatever you declare on top of it wins:

Key What it does
providers[].id The connection’s ID, which model targets name
providers[].protocol The wire protocol the gateway speaks to it: openai, anthropic, gemini, bedrock and the others below; a preset fills it in
providers[].preset Names one of the shipped presets (listed in Providers → Add provider and GET /api/v1/admin/provider-presets); the provider inherits its protocol, base URL, authentication and key variable, and any key declared next to it wins
providers:
- id: groq
preset: groq # https://api.groq.com/openai/v1, key in GROQ_API_KEY
- id: mistral
preset: mistral
api_key_env: MISTRAL_KEY_PROD # overrides the default variable
models:
- id: chat-rapido
targets: [{provider: groq, model: llama-3.3-70b-versatile}]

GET /api/v1/admin/provider-presets lists every preset.

Protocol, authentication choices and HTTP mode use the shared parameter schemas. Their compiled context matrix describes supported options, not the validity of a particular destination or credential. The backend still validates the complete effective configuration and cloud-host trust. A required protocol has no universal default; a selected preset can supply its protocol and authentication before validation.

The HTTP selector distinguishes omitted automatic behavior from explicit auto, while both retain the existing host-specific transport selection. Explicit http1 or http2 remains an operator choice. No provider call is made just to select or save these schema values.

With provider_management and permission to manage providers, Providers → Edit uses the same versioned PUT /api/v1/admin/providers/{id} operation as the API. The YAML is the base; a validated PostgreSQL override wins until explicitly reverted. A save validates the complete snapshot and records the actor and request ID. It does not test the credential or make a model call. For keyless or cloud-identity modes, credential_configured: true means no stored static credential is required; it does not prove a stored key exists or that a cloud identity is currently valid.

The form keeps the configuration revision you reviewed when opening it. A later refresh does not silently rebase that draft; an HTTP 409 keeps the draft/revision, and closing/reopening explicitly reviews the newer configuration.

The editor retains every supported authentication option when you save without changing it. Controls depend on the authentication type:

  • Bearer or none: no additional authentication options.
  • Custom header: header.
  • Azure Entra: credential and scope.
  • Google ADC: credential and scope.
  • AWS SigV4: credential, region, service and profile.
  • OCI API key: region, profile and compartment.

Nonempty options belonging to another type are rejected; an empty optional field keeps its existing unset/default meaning. An official AWS endpoint can supply its region, so a valid omitted region does not become a required form input. A YAML-only custom Bedrock endpoint still needs an explicit signing region and retains its existing trust restriction. The YAML, API contract and selector cover the same 16 existing wire protocols, including SageMaker and OCI; a listed protocol does not prove that a particular model or cloud credential works.

A preset can define its own authentication. Choosing protocol-default API-key authentication overrides that default explicitly; API callers use auth: {type: bearer}. Omitting auth lets the preset choose its authentication. The console preserves the mode you selected, including a bearer override of a cloud preset.

Keeping or replacing a key: when both the current and saved authentication types use a static key (bearer or header), an empty key field retains the opaque current credential. Enter a new key to replace it. No read returns that key.

Static credentials must be valid HTTP header values: ASCII controls 0x00–0x1F other than horizontal tab, and 0x7F (DEL), are refused. The API accepts at most2048 bytes for its write-only secret; blank retains the current static credential as above. YAML references are checked at startup, and the resolved value is captured and checked again before every operation, so an invalid or missing rotated credential fails closed with503 before any provider send or durable attempt. Correct the external value to recover; no database cleanup or key disclosure is required. Existing scalar environment/file credentials retain their historical length and non-ASCII-byte compatibility; pool entries retain their separately documented2048-byte/UTF-8 bounds. Cloud/no-auth connections do not read inactive scalar material.

Switching to identity or no authentication: the form warns before saving. A successful save removes the connection’s stored ciphertext and stops inheriting its YAML key reference. That mode refuses a supplied static key. Returning to bearer/header requires a fresh key; the previous key is not silently restored. Changing the form’s type/protocol clears typed secrets and incompatible option drafts. A rejected request or stale version preserves the existing metadata, credential and audit state.

Revert to YAML is a separate explicit action. It restores the declared connection, including its operator-owned credential reference when one exists. Removing local ciphertext does not revoke the key at its provider or delete the external secret.

Older versions may have left an unused encrypted key on a connection already in identity/no-auth mode. Startup and reads preserve those bytes but never consume them; a blank static edit cannot resurrect them. To remove them, review that connection and explicitly Edit → Save in its existing nonstatic mode, or issue the equivalent authorized versioned PUT without a static secret. The save clears the ciphertext and records an audit event. There is no automatic upgrade sweep or schema migration for this repair. See upgrade preparation.

Unknown or unsupported authentication snapshots are read-only in the editor rather than reconstructed into a lossy save. Before upgrading, validate the YAML and use the compatible version’s API to remove previously ignored misplaced fields in stored overrides (for example, credential/scope on header auth or scope on AWS auth). Do not remove consumed options or replace a key just to edit unrelated metadata. See upgrade preparation.

  • OpenAI-compatible:
    • OpenAI, Groq, Together, Fireworks, DeepSeek, Mistral, xAI, Perplexity, OpenRouter;
    • Cerebras, DeepInfra, SambaNova, Nebius, Hyperbolic, Novita, Moonshot;
    • Alibaba (Qwen), Z.ai, NVIDIA NIM, Hugging Face, Cohere, GitHub Models;
    • DigitalOcean Gradient, Maritaca (Sabiá), Heroku and others.
  • Native, with translation: Anthropic, Gemini, Vertex AI, Bedrock (Converse), Cohere v2, SageMaker and OCI.
  • Clouds: Azure OpenAI, Azure AI Foundry, Vertex AI, Bedrock, Databricks and Snowflake Cortex.
  • Local runtimes: Ollama, vLLM, LM Studio, llama.cpp, llamafile, SGLang, Xinference, TGI, Docker Model Runner, Lemonade, text-generation-webui and Infinity.
  • Embeddings only: Jina AI and Voyage AI.
  • Media: ElevenLabs, Amazon Polly and Azure AI Speech (speech), Deepgram (transcription), Stability AI, Replicate, Fal, Black Forest Labs and Recraft (image) and Runway (video).
  • Generated from the community cost map: Poe, Meta, Helicone, Vercel v0, Crusoe, GMI, Tencent and others. They carry only the URL and the variable name; they have not been tested with a real key.
auth.type When to use
absent or bearer API key, in the protocol’s standard header
header Key in a header with a different name: {type: header, header: api-key}
none Local runtimes without authentication
azure_entra Entra ID. credential: auto tries client secret, workload identity and the Azure CLI; managed_identity is explicit
gcp_adc Google Application Default Credentials
aws_sigv4 AWS IAM. credential: auto tries environment variables, IRSA, Pod Identity, ECS and the AWS CLI; credential: instance uses the EC2 instance role through IMDSv2, without the CLI; region must match the endpoint
oci_api_key OCI CLI profile (~/.oci/config)

The other auth keys depend on the type; a nonempty key that belongs to another type is rejected.

Key What it does
providers[].auth.header The header that carries the key, for type header (for example api-key on Azure)
providers[].auth.credential The identity source for a cloud type: auto, cli, client_secret, workload_identity or managed_identity on azure_entra; auto, env, web_identity, container, instance or process (also cli) on aws_sigv4; auto on gcp_adc
providers[].auth.scope Overrides the OAuth scope the token is requested for, on azure_entra (https://cognitiveservices.azure.com/.default or https://ai.azure.com/.default) and gcp_adc (https://www.googleapis.com/auth/cloud-platform); empty keeps the cloud’s default
providers[].auth.region The region that signs aws_sigv4 calls and that oci_api_key calls go to; an official AWS endpoint supplies it, a custom Bedrock endpoint needs it
providers[].auth.service The SigV4 service name for aws_sigv4; empty means bedrock, or sagemaker on a sagemaker connection and polly on a polly connection
providers[].auth.profile The AWS CLI profile (aws_sigv4, local development) or the OCI config profile (oci_api_key) to read; a profile name, never a secret
providers[].auth.compartment The OCI compartment the calls run in, for oci_api_key; empty uses the tenancy (the root compartment)

Cloud identities obtain their credential from the configured identity/profile and only work with that cloud’s official URL. New successful nonstatic saves store no static API key; older unused encrypted keys follow the explicit cleanup rule. On Kubernetes, prefer workload identity (workload identity on AKS and GKE, IRSA or Pod Identity on EKS); each cloud’s CLI is for local development.

providers:
- id: azure
preset: azure_openai_entra
base_url: https://contoso.openai.azure.com/openai/v1
- id: bedrock
preset: bedrock
base_url: https://bedrock-runtime.us-east-1.amazonaws.com
models:
- id: chat
targets: [{provider: azure, model: gpt-4.1-nano}] # on Azure, model is the deployment name
Terminal window
ANTHROPIC_BASE_URL=https://gateway.example.com \
ANTHROPIC_AUTH_TOKEN=<gateway key> \
ANTHROPIC_MODEL=claude-haiku-4-5 \
ANTHROPIC_SMALL_FAST_MODEL=claude-haiku-4-5 \
claude
  • The alias needs the messages capability, on an anthropic provider, and with the model’s real name (claude-haiku-4-5, not claude). Claude Code uses the name to decide which features to request.
  • A messages alias on another provider (OpenAI, Gemini, Bedrock, Cohere) also works, through protocol translation; signed thinking is then left out, prompt cache marks reach Claude on Bedrock (and are left out elsewhere, see prompt caching), and Anthropic’s own tools (web search, computer use) are refused.
  • The gateway forwards the anthropic-beta header that Claude Code sends to anthropic connections, when it is a well-formed list of feature names (up to 1,024 characters; anything else is dropped), and serves /v1/messages/count_tokens. Other client headers reach a provider only when its forward_client_headers lists them.
  • Anthropic bills Claude Code requests against the account’s purchased balance. Promotional credit that does not include Claude Code does not cover them, with or without the gateway.

In ~/.codex/config.toml:

model = "gpt-4.1-mini"
model_provider = "gw"
[model_providers.gw]
name = "ai-gateway"
base_url = "https://gateway.example.com/v1"
env_key = "GW_KEY" # the variable holding the gateway key
wire_api = "responses"

The alias needs the responses capability and the model’s real name. In non-interactive mode, close stdin (< /dev/null). On a non-OpenAI target the alias is translated (protocol translation): the CLI’s store: false stateless mode works, and its encrypted reasoning items are left out.

Without help, the Codex CLI’s model picker (/model) lists only the models bundled with the CLI. With the flag codex_model_catalog on (operator control, off by default, applies without restart), the gateway answers the CLI’s own catalog request, so the picker lists the gateway’s aliases instead.

features:
openai_responses: true
codex_model_catalog: true

In ~/.codex/config.toml, point the provider’s model_catalog_url at the gateway’s /v1/models. Without it the CLI never asks the provider for a catalog:

model = "coder" # an alias with the responses capability
model_provider = "gw"
[model_providers.gw]
name = "ai-gateway"
base_url = "https://gateway.example.com/v1"
env_key = "GW_KEY" # the variable holding the gateway key, for example gw_live_...
wire_api = "responses"
model_catalog_url = "https://gateway.example.com/v1/models"

What the CLI sends. GET /v1/models?client_version=0.163.0 with the gateway key as Authorization: Bearer, originator: codex_cli_rs (interactive) or codex_exec (codex exec), and a matching User-Agent. The gateway selects the catalog by the client_version query parameter alone (x.y.z, optionally followed by a pre-release or build suffix): every front end of the CLI sends it, and the headers vary. Any other request, or the flag off, gets the standard OpenAI list, byte for byte as before. Sending client_version from another client changes only the shape of the same authorized list.

What is listed. Exactly the aliases the standard list shows the key, narrowed to the ones the CLI can call: the alias has the responses capability, openai_responses is on, the key (after its team policy) may use route:responses, and, with feature plan entitlements on, the team’s plan grants openai_responses for that model. A wildcard alias’s own pattern (openai/*) is not listed; the names discovered behind it are. Otherwise the list is empty ({"models":[]}), never a model the key cannot call. Aliases keep their declaration order. The answer has Cache-Control: no-store.

Each entry. The gateway ships a copy of the CLI’s own model catalog and generic base prompt, taken unchanged from the open-source Codex repository (Apache-2.0, tag rust-v0.163.0; source, commit and hashes in third parties). Nothing is fetched at run time. An alias gets one of two entries. A known entry tells the CLI user which model family serves the alias (its description, reasoning levels and the CLI’s own prompt name it); an override of the base prompt does not hide the rest of the entry, so leave such aliases on the translated entry (different target models) if that must stay private.

  • A model the CLI knows. When every target of the alias names the same model of that catalog (a provider prefix such as openai/ is ignored; a name discovered behind a wildcard alias is its own upstream model), the entry is the CLI’s own entry for that model under the alias name: its reasoning levels, service tiers, tools, truncation policy and the model_messages from which the CLI builds that model’s own base prompt. The gateway rewrites only slug and display_name (the alias ID), priority, visibility: list, supported_in_api: true, and sets upgrade and availability_nux to null (no nudge toward a model under another name). context_window stays the CLI’s unless every target declares targets[].max_input_tokens; then it is the smallest of them, capped at the entry’s max_context_window. The alias’s own ID is not evidence: an alias named like a known model but served by another one gets the translated entry. A CLI older than the entry’s minimal_client_version also gets the translated entry, which it can decode.
  • Any other model. A translated entry with the fields the CLI requires (checked against codex-cli 0.163.0; one missing field makes it reject the whole catalog), filled from what the gateway knows, and otherwise with the value the CLI uses for a model it has no metadata for, so no entry claims a reasoning level, tool or verbosity the alias may lack:
Field Value Source
slug, display_name the alias ID gateway alias
priority position in the answer (0, 1, …) gateway declaration order; the picker sorts by it
visibility list shown in the picker
supported_in_api true the alias is called with a gateway key
context_window the smallest targets[].max_input_tokens, only when every target declares one; omitted otherwise operator (context window check)
base_instructions the CLI’s generic base prompt (prompt.md of the vendored tag), or models[].codex.base_instructions vendored copy or operator
description, default_reasoning_level null client default for an unknown model
supported_reasoning_levels, experimental_supported_tools [] client default
shell_type default client default
support_verbosity false client default
truncation_policy {"mode": "bytes", "limit": 10000} client default

Optional fields (service tiers, input modalities, compaction limits) are left out of a translated entry and take the CLI’s own defaults. A known model’s service tiers (the CLI’s /fast) send service_tier upstream; a request for a tier the price set does not approve is refused with service_tier_not_approved (service-tier pricing). The CLI drops a catalog larger than 1 MiB; a known entry is 20-65 KB (about 16 of the largest fit), so aliases that do not fit are left out (in declaration order, a warning is logged with the count).

Base instructions per alias. models[].codex.base_instructions replaces the base prompt the CLI uses with that alias, for both kinds of entry (on a known model it also removes the entry’s model_messages.instructions_template, which the CLI would otherwise prefer). Non-empty UTF-8 text without NUL, at most 65536 bytes; omitted keeps the CLI’s own prompt. Not allowed on an alias_of entry, which uses its canonical model’s value. Set it in YAML or with the admin model API (PUT /api/v1/admin/models/{id}, field codex); the console model editor has a Codex base instructions field for it (shown while codex_model_catalog is on, not on an alias; empty removes the block). Applies on the next catalog request; the CLI caches its catalog (see below).

models:
- id: team-coder
capabilities: [responses]
targets:
- {provider: openai, model: gpt-5.5}
codex:
base_instructions: |
You are a coding agent for the platform team. Follow the repository's AGENTS.md.

A user-level model_instructions_file = "/path/to/instructions.md" in config.toml still replaces whatever the catalog says.

Keys and team policies. The catalog and the CLI’s calls both need route:responses in the key’s scopes after its team policy. The bundled config/gateway.yaml (and the Helm chart’s copy) lists it in the example team policy, beside route:models and route:chat; a policy without it gets an empty catalog and 403 on /v1/responses.

Check it. codex debug models prints the catalog the CLI loaded (it caches it in models_cache.json under the CLI’s home directory; delete that file to fetch again).

An openai target takes api: chat_completions, api: responses or api: auto. With api: responses, Chat Completions (and the Messages and GenerateContent routes) are sent to /responses, for models that only exist there; with api: chat_completions, a responses alias is served by a server that only has /chat/completions. stop, n, logprobs, seed and the penalties have no Responses equivalent and are refused with 422; the request goes with store: false unless the client asked to store. Details in protocol translation.

api: auto picks the API per request: Responses when Chat Completions would refuse the request (reasoning_effort: max or in its object form, function tools with a reasoning effort other than none) and the translation carries every field, Chat Completions otherwise. It suits current reasoning models, which accept those requests only on Responses, without moving every request there (the rules). The server must have both APIs: an OpenAI-compatible server without /responses (many self-hosted ones) should keep api: chat_completions.

A chat alias with an anthropic target is translated to the Messages API, and the response comes back in Chat Completions format.

Chat Completions At Anthropic Note
system, developer system
text and image text and image blocks image only as a data URL; a remote URL gives 422
tool_calls and tool tool_use and tool_result arguments must be a JSON object
max_tokens max_tokens default 4096
tools, tool_choice tools, auto/any/none/tool
reasoning_effort thinking with a budget of 1024, 2048 or 4096; with thinking_mode: adaptive on the target, adaptive thinking with that effort (Claude thinking mode) returned in reasoning_content
cache_control on a part, a message or a tool cache_control on the matching block or tool {"type": "ephemeral"} with ttl 5m or 1h; at most four (prompt caching)
n, logprobs, seed, penalties, response_format — rejected with 422 before the call
  • Cache tokens: appear in prompt_tokens_details.cached_tokens (reads) and cache_creation_tokens (writes). With prompt_cache: {mode: auto} on the target the gateway marks the cache points when the client marks none (prompt caching).
  • Truncated stream: a stream that ends without message_stop is cut off without [DONE], so the client does not take the truncated response for a complete one.
  • Route choice: an alias serves chat or messages, never both.
  • Limit: the signature of reasoning blocks does not fit in the Chat format. In a round that continues a tool call, Anthropic responds without reasoning.
  • Gemini: an alias with a gemini provider serves Chat Completions translated to generateContent. The translation covers tools (with the Gemini 3 reasoning signature preserved across rounds; the signature rides inside the tool call ID, and the gateway removes it when the same conversation goes to another provider, through a fallback or a model switch, since OpenAI accepts IDs of at most 64 characters and Anthropic refuses ~), json_schema, reasoning_effort, images as data URLs and streaming with usage. A stream that carries an error event, or ends without a finish reason, is cut off without [DONE], so neither the client nor the semantic cache takes it for a complete response. The same provider serves the native route /v1beta/models/{alias}:generateContent.
  • Vertex AI (preset vertex_ai): the same, with a Google token instead of a key, plus embeddings.
providers:
- id: vertex
preset: vertex_ai
base_url: https://aiplatform.googleapis.com/v1/projects/my-project/locations/global/publishers/google
models:
- id: chat
targets: [{provider: vertex, model: gemini-3.5-flash-lite}]
  • Vertex URL:
    • the global location uses aiplatform.googleapis.com; a regional one uses <location>-aiplatform.googleapis.com;
    • a mismatched host and location are rejected in the configuration;
    • model availability varies by location.
  • Vertex embeddings:
    • up to 2048 texts, dimensions and input_type (RETRIEVAL_QUERY, RETRIEVAL_DOCUMENT…);
    • text above the model’s limit is rejected, not silently truncated.
  • Listing: Vertex does not list models, so discovery responds 422.
  • Request labels: with provider_request_labels, generateContent calls to Vertex AI carry the caller’s organization, team and key ID as labels for the Google Cloud bill; see provider request labels.

The bedrock protocol translates Chat Completions to the Converse API and gives access to all of Bedrock’s chat models (Claude, Llama, Mistral, Nova and others). The target’s model is the Bedrock ID, such as anthropic.claude-haiku-4-5:0 or a us.… inference profile.

  • Chat:
    • stream, tools, stop, max_tokens, temperature and top_p;
    • images only as data URLs;
    • fields that Converse does not honor are rejected with 422.
  • Reasoning: reasoning_effort becomes thinking on Claude and the model’s own control on gpt-oss; it is returned in reasoning_content. In a family without that control, the response is 422.
  • Embeddings: Titan Text (v1 and v2) and Cohere (v3 and v4), up to 512 texts per request, as float or base64. If part of the batch fails, the client receives the error, never an incomplete list.
  • Guardrails: Bedrock Guardrails plugs in as an external guardrail (guardrails).
  • Messages, Responses and GenerateContent: the same Converse adapter serves those routes through protocol translation.
  • Usage: prompt-cache reads and writes (cacheReadInputTokens, cacheWriteInputTokens) count in prompt_tokens, with cached_tokens for the reads and cache_creation_tokens for the writes.
  • Prompt caching: on a Claude model, cache_control marks become cachePoint blocks, and prompt_cache: {mode: auto} places them when the client marks none; other models do not receive them (prompt caching).

By default a bedrock connection only accepts https://bedrock-runtime.<region>.amazonaws.com, so a configuration typo can never send an AWS credential elsewhere. To use a VPC interface endpoint, a corporate proxy or a test mock, state it explicitly in the YAML:

providers:
- id: bedrock-private
protocol: bedrock
base_url: https://vpce-0abc123-xyz.bedrock-runtime.us-east-1.vpce.amazonaws.com
custom_endpoint: true
auth: {type: aws_sigv4, region: us-east-1}
  • YAML only. The admin API and the console cannot set custom_endpoint; a console edit of this connection (a rotated key, for example) keeps it only while the base_url stays the one in the YAML. The console shows the flag read only.
  • https is required. allow_insecure_http: true accepts http:// for local tests and mocks, and only on localhost, 127.0.0.1 or host.docker.internal.
  • The signing region is required with aws_sigv4, since a custom host carries none. A Bedrock API key (api_key_env) also works.
  • The URL may carry a path prefix, never a query, a fragment, user info, or a link-local or cloud metadata address. Redirects are never followed.
  • SigV4 signs the custom host and the full path. The endpoint must accept the request as signed: a VPC interface endpoint does, and so does a proxy that verifies or re-signs it. A proxy that forwards to AWS unchanged, or strips a path prefix, breaks the signature. For an egress proxy that only relays traffic, keep the official base_url and set the HTTP proxy instead (network.proxy_url_env).
  • Model discovery is not available on a custom endpoint, and the automatic price of the official host is not inherited.
  • Know the risk: the host receives the signed request, which AWS accepts for several minutes, plus the session token; with an API key, it receives the key. Point it only at a host you control (security).

The cohere_v2 preset uses Cohere’s native API:

  • chat with stream, tools, json_schema, reasoning_effort, documents and citations;
  • embeddings in batches of 96;
  • rerank.

The cohere preset uses the OpenAI-compatible endpoint.

The sagemaker protocol calls endpoints whose container speaks the OpenAI messages API (LMI, TGI, vLLM, llama.cpp). The target’s model is the endpoint name, and authentication is IAM, with no static key. Chat only, with streaming.

providers:
- id: sagemaker
protocol: sagemaker
base_url: https://runtime.sagemaker.us-east-1.amazonaws.com
auth: {type: aws_sigv4, region: us-east-1, credential: auto}
models:
- id: chat-sagemaker
targets: [{provider: sagemaker, model: meu-endpoint}]

The oci protocol calls Oracle Cloud’s GENERIC models (Meta, OpenAI gpt-oss, Google, xAI), signing each request with an OCI CLI profile. The private key stays in the file. Chat only, without tools; OCI’s Cohere models are rejected.

providers:
- id: oci
protocol: oci
base_url: https://inference.generativeai.sa-saopaulo-1.oci.oraclecloud.com
auth: {type: oci_api_key, profile: DEFAULT}
models:
- id: chat-oci
targets: [{provider: oci, model: meta.llama-3.3-70b-instruct}]

Media: image, speech, transcription and video

Section titled “Media: image, speech, transcription and video”

ElevenLabs (speech), Deepgram (transcription) and Stability, Replicate, Fal and Black Forest Labs (image) have adapters that translate the OpenAI routes (/v1/audio/speech, /v1/audio/transcriptions, /v1/images/generations). Whatever the provider does not accept is rejected before the call. Recraft already speaks the OpenAI format. The price per image, character or second comes from the catalog (automatic pricing).

Speech has its own page: how a clip is streamed, cut and charged, voice discovery, and the Amazon Polly, Azure AI Speech and Gemini text to speech targets, each behind its own flag (speech).

Once Stability, Replicate, Fal or Black Forest Labs accepts an image (a task ID or an answer with the image), it is billed: if polling or reading the answer fails afterwards, the client gets an error and the request is not sent to the alias’s next target. A refusal before acceptance (429, 5xx) still falls back. Replicate is asked to wait for the prediction (Prefer: wait) only as long as fits inside network.response_header_timeout, at most 60 seconds; with the default of 30 seconds the wait is 25.

Runway generates video as an asynchronous job: the gateway records the intent, returns the job, and the client follows it at /v1/video-jobs. See asynchronous video.

providers:
- id: runway
protocol: runway
base_url: https://api.dev.runwayml.com/v1
api_version: "2024-11-06"
api_key_env: RUNWAY_API_KEY
models:
- id: video-runway
capabilities: [video]
targets: [{provider: runway, model: gen4.5, paths: {video: /text_to_video}}]

An alias ending in /* exposes all of a provider’s models without registering them one by one:

models:
- id: local/*
targets: [{provider: local, model: "*"}]

With this, local/Qwen/Qwen2.5-7B-Instruct goes to the provider with the model Qwen/Qwen2.5-7B-Instruct.

  • Precedence: an exact alias beats the wildcard, and among wildcards the longest prefix wins.
  • In the allowlist: of a key or a team, local/* allows the whole prefix, and local/modelo-x allows a single model.
  • Pricing, fallback and quotas: apply per concrete model.

With provider_model_discovery, the console catalog lists what each connection serves, using the connection’s own authentication:

  • OpenAI-compatible: {base_url}/models;
  • Anthropic and Gemini: each one’s listing;
  • Azure: the deployments;
  • Bedrock: ListFoundationModels.

The /v1/models of a key with a wildcard also lists the concrete models.

headers sends non-secret headers on every call to the provider. Examples:

  • anthropic-workspace-id, for Anthropic user keys;
  • OpenAI-Organization and OpenAI-Project;
  • the routing of a corporate gateway in front of the provider.
providers:
- id: anthropic
preset: anthropic
headers:
anthropic-workspace-id: wrkspc_01ABC

Up to 16 headers. Credentials, tracing and AWS signing headers are rejected, and the values are visible to administrators: do not use them for secrets.

By default the gateway sends a provider only the headers it builds itself: the connection’s credential, the content type, the trace context and X-Request-Id, the fixed headers above, and two protocol headers on anthropic connections (anthropic-version from api_version, and the client’s anthropic-beta when it is a well-formed list of feature names). Nothing else the client sends reaches the provider, with one exception: the realtime WebSocket handshake relays the client’s headers (feature headers such as OpenAI-Beta travel with the upgrade), minus hop-by-hop and WebSocket extension headers, X-Forwarded-For, and every credential, cookie, X-Gateway-*, Proxy-* and x-amz-* header, plus the connection’s own auth.header. forward_client_headers names the client headers to copy, as the client sent them, to a given provider:

providers:
- id: openai
preset: openai
forward_client_headers: [OpenAI-Beta, Idempotency-Key]
- id: internal-router
protocol: openai
base_url: https://llm-router.example.com/v1
forward_client_headers: [x-tenant-route]
Field Default Contract
providers[].forward_client_headers empty: nothing forwarded Up to 16 distinct header names (letters, digits and -, 1–64 characters, case-insensitive), each copied with all its values when the client sent it; a header the client did not send is not added

Why an allowlist per provider: a header the client chooses can turn on provider features (OpenAI-Beta), select a tenant or route behind a corporate router, or attribute usage (anthropic-workspace-id). Each is a decision for one connection, not a default for every provider an alias may fall back to, so each provider lists only what it should receive.

What is forwarded and when:

  • On every call to that provider made while serving the client’s request on /v1/... or the native /v1beta/... routes: each attempt, retries and fallbacks included (a fallback to another provider sends that provider’s own list), realtime connections, and the calls the gateway makes for that same request, such as a provider guardrail check, a semantic fallback or an automatic routing classifier, when their connection lists the header. Work the gateway runs on its own (model discovery, catalog refreshes, evaluations, batch items) carries no client headers.
  • A value above 8 KiB (all values of the header together) is not forwarded, and the forwarded headers of one request stay under 8 KiB together: past that, further listed headers are left out. Load balancers in front of providers commonly refuse larger header blocks, and their refusal would trigger retries and fallbacks.
  • Model discovery and catalog listings are shared by every caller, so they never carry a client’s headers, even when a /v1/models request triggers the refresh.
  • The exact and semantic answer caches include the forwarded values in their keys, so an answer produced for one value is never served for another; requests without forwarded headers keep their keys.
  • The header is set before the connection’s credential, so the credential always wins.

Names that are refused, at load time in the YAML and with 422 in the provider API and console, because forwarding them would let a client replace the gateway’s credential, corrupt the request the gateway rebuilt, or break tracing and signing:

  • credentials: Authorization, Proxy-Authorization, x-api-key, api-key, x-goog-api-key, x-key, Ocp-Apim-Subscription-Key, X-Forwarded-Authorization, and this connection’s own auth.header;
  • cookies: Cookie, Set-Cookie;
  • hop-by-hop and proxy headers: Connection, Keep-Alive, TE, Trailer, Transfer-Encoding, Upgrade, Expect, Host and every Proxy-*;
  • framing and encoding: every Content-* and Accept-Encoding (the gateway rewrites the body and decodes compressed answers itself);
  • tracing: traceparent, tracestate, baggage, X-Request-Id, X-Correlation-Id, X-Idempotency-Key;
  • the gateway’s own X-Gateway-* headers, Sec-WebSocket-*, every AWS signing header (x-amz-*) and anthropic-version (set from api_version);
  • a name listed twice, a name that is also a fixed header (keep one source), and anthropic-beta on an anthropic connection: the gateway forwards it there after validation on the Messages and token-count routes, and only there (a Chat Completions or Responses request translated to Anthropic does not carry it).

Values are not inspected beyond size: whatever the client sends in a forwarded header reaches the provider, so list only headers the provider treats as preferences or routing, never as authority. Some allowed names select whose account or project is billed or attributed (OpenAI-Organization, OpenAI-Project, anthropic-workspace-id, x-goog-user-project): forwarding one lets every client of the alias choose it among those the connection’s credential can reach. Prefer a fixed headers entry for those, and forward them only when every client may make that choice. Changes apply on the next request, with no restart; the console’s provider form has a Forwarded client headers field (one name per line) and the provider API takes forward_client_headers.

providers[].http_version is auto (the default), http1 or http2. With auto it is HTTP/2, except for the Google API, which goes over HTTP/1.1 because it responds faster that way under concurrency.

For a self-hosted model server (vLLM, llama.cpp), providers[].metrics_path opts the connection into the scrape of the server’s own Prometheus metrics, which then appear in the gateway’s /metrics and OTLP export with the connection ID as the provider label. It needs the provider_metrics_scrape flag (off by default). providers[].metrics_credential: true also sends the connection’s bearer secret with the scrape, for a server that protects its metrics with its key. The path is read on the host of base_url and never on another one. Setup, bounds and the series are in Model server metrics.

To put llama.cpp, MLX, Ollama or vLLM replicas behind the gateway with health checks, routing by replica load and optional supervision, declare a local inference pool instead of one connection per replica. The connections such a pool derives (<pool>-r<n>) appear in this list and are changed through the pool, not here.

Every route below needs a console session or an admin Bearer token, the role’s permission and, for writes, the X-CSRF-Token header; the full contract is in the API reference.

Route What it does
POST /api/v1/admin/models/{id}/test Sends one minimal request through the gateway to the alias (a five-token chat or one embedding) and returns latency and result

An optional credential pool names an explicit stable primary and statically authenticated alternatives. Separate runtime flags enable relative weights and response-signal cooldown only for qualified basic-text Chat execution; native/account-bound/unclassified paths retain primary. Pool metadata and write-only per-ID secrets use the existing provider API/console CAS and encrypted PostgreSQL persistence. Legacy single-secret providers remain unchanged. Primary changes are account-identity changes, not automatic resource migration; configured presence is not health.

m7gtw[email protected]