Skip to main content

AI Gateway Providers

A provider is a model service the gateways send requests to: OpenAI, Anthropic, Azure OpenAI, Amazon Bedrock, Google Vertex AI, Cohere, TypeSafe, or any OpenAI-compatible server. Providers are shared by every gateway of the project: a credential is stored once, and each gateway's models name the provider that serves them (see Gateways and models).

A provider has two halves:

  • What the edge's engine needs — its type, credential, path prefix, API version, model override and request changes. These go to every edge of the project in the configuration files.
  • Where Envoy reaches it — host, port, TLS and SNI. This stays on the control plane: elchi generates the provider's Envoy cluster (elchi-aigw-<provider>) from it. The edge's configuration files never carry it.

The providers list with status, type, endpoint and users The providers list with status, type, endpoint and users

Create a provider in the UI​

Only Owner and Admin users change providers; every member of the project can read them (credentials masked).

  1. Open Infrastructure → AI Gateway → Providers and click New provider.
  2. Provider section:
    • Name — lower-case letters, digits and hyphens, at most 63 characters, unique in the project. new is reserved. The name cannot be changed later.
    • Type — one of the types in the table below. The type cannot be changed later: create another provider instead.
  3. Credential section — the fields depend on the type (see Credentials). Credentials are encrypted at rest and always shown masked.
  4. Endpoint section — Host, Port, TLS, SNI, Path prefix, API version, Model override. The form fills in the type's public endpoint; change any of it. For type openai, Fill from a known service fills the host and path prefix of an OpenAI-compatible service (see OpenAI-compatible services).
  5. Request changes section (optional) — fields to set or remove in the body sent to this provider, and for aws-anthropic / gcp-anthropic the anthropic-beta filter.
  6. Click Save.

The save validates the whole project configuration with the change applied. When it is accepted, the providers document gets a new version and a deploy of the configuration to every connected edge of the project is queued (see Operations). When it is refused, the page shows the reason (for example credentials.aws.region is required for type "aws-bedrock" …) and nothing is stored.

The first provider saved in a project creates the project's AI gateway configuration. Gateways, consumers and listeners can be created only after that.

Provider types​

TypeCredentialDefault endpoint (empty Host)Path prefixAPI version
openaiAPI keyapi.openai.com:443, TLSread; the form fills v1. Empty means no prefix: requests go to /chat/completionsnot used
anthropicAPI keyapi.anthropic.com:443, TLSread; empty means v1not used
azure-openaiAPI key, Entra application, or managed identitynone: Host is requirednot usedrequired; the form fills 2024-10-21
aws-bedrockAWS (region, optional credentials file)bedrock-runtime.<region>.amazonaws.comnot usednot used
aws-anthropicAWSbedrock-runtime.<region>.amazonaws.comnot usedempty means bedrock-2023-05-31
aws-openaiAWSnone: Host is requiredread; empty means openai/v1not used
gcp-vertexaiGCP (region, project, optional access token)<region>-aiplatform.googleapis.com; region global → aiplatform.googleapis.comnot usednot used
gcp-anthropicGCPas gcp-vertexainot usedempty means vertex-2023-10-16
cohereAPI keyapi.cohere.com:443, TLSnot usednot used
typesafeAPI keyapi.typesafe.ai:443, TLSnot usedempty means v1

"Path prefix: not used" means the engine builds that provider's paths itself; the UI disables the field for those types. A port left empty is 443 with TLS on and 80 with TLS off.

Which client endpoints reach which types is in the endpoint × provider matrix below. Two traps it explains:

  • A native anthropic provider serves only the Anthropic Messages API (/anthropic/v1/messages). An OpenAI-format client (/v1/chat/completions) sent to it gets 422. For Claude behind OpenAI-format clients use aws-anthropic, gcp-anthropic, or an openai provider pointed at Anthropic's OpenAI-compatible endpoint (Fill from a known service → Anthropic (OpenAI-compatible)).
  • A typesafe provider serves only /typesafe/v1/systemone, without streaming.

The AI Gateway page shows a note for every anthropic and typesafe provider and for every static GCP access token, so these are visible after a save.

Credentials​

API key (openai, anthropic, azure-openai, cohere, typesafe)​

Enter the provider's key in API key. It is required. The engine sends it the way the provider expects (for example a bearer token to OpenAI, x-api-key to Anthropic, api-key to Azure OpenAI).

Azure OpenAI sign-in​

An azure-openai provider has a Sign-in choice:

Sign-inFieldsWhat happens
API keyAPI keyThe key is sent in api-key.
Entra applicationTenant ID, Client ID, Client secret (all required)The gateway on each edge gets a Microsoft Entra ID token for scope https://cognitiveservices.azure.com/.default with the application's secret.
Managed identityClient ID (optional)The gateway gets the token with the VM's managed identity. Empty Client ID: the system-assigned identity; a Client ID names a user-assigned one.

With Entra or a managed identity, the token is handled on each edge by the elchi-ai-gateway service, not by the engine:

  • It refreshes the token 5 minutes before it expires; a failed fetch is retried every minute.
  • A refresh rewrites the engine's configuration without changing the configuration version or the reload counters, and the token is never written to the last-good copy, /configz or a log.
  • Until the first token arrives, requests to the provider get 401 from Azure.
  • The edge must reach login.microsoftonline.com (an Entra application) or the instance metadata service 169.254.169.254 (a managed identity). For a private authority set AZURE_AUTHORITY_HOST for the service, plus --entra-disable-instance-discovery when the edge cannot reach the public endpoint.
  • The edge's /configz lists each identity's state, expiry and last error under credentials[]; failures are counted in elchi_ai_gateway_credential_refresh_failures_total.

An azure-openai provider takes either an API key or an Entra identity, never both. A managed identity takes only a client ID: a tenant ID or client secret with it is refused.

AWS (aws-bedrock, aws-anthropic, aws-openai)​

  • AWS region — required.

  • Credentials file — optional. The contents of an AWS shared credentials file:

    [default]
    aws_access_key_id = AKIA...
    aws_secret_access_key = ...

    It must have a [profile] line, aws_access_key_id and aws_secret_access_key, or the save is refused. Empty: the edge's own AWS identity (the SDK's default chain, for example the instance role), refreshed by the SDK.

GCP (gcp-vertexai, gcp-anthropic)​

  • GCP region and GCP project — required.
  • Access token — optional. Empty: the edge's Application Default Credentials, which the engine refreshes itself. A static token expires (typically within an hour) and is never refreshed; the page shows a note about it.

Masked credentials and when they are kept​

Every API answer replaces a stored secret with ***REDACTED***: the API key, the AWS credentials file, the GCP access token, the Entra client secret, and the values of headers set toward the provider. In the form, focusing a masked field clears it; leaving it empty puts the mask back.

On save, a masked value sent back unchanged keeps the stored secret only while it still goes where it went: the same provider name, type, path prefix, API version, host, port, TLS setting and SNI (and, for an Entra application, the same tenant and client ID). Change any of them and the save is refused with provider "x" goes to a new endpoint, type, path or API version: enter its apiKey again — enter the secret again. This prevents a stored key from being sent to a host chosen later. A masked value on a new or renamed provider is refused with the masked apiKey has no stored value to keep; enter it again.

Endpoint​

FieldMeaning
HostHost name or IP, no scheme, port or path. Required for azure-openai and aws-openai; for the others, empty means the type's public endpoint, which follows the region for AWS and GCP types.
PortEmpty: 443 with TLS, 80 without.
TLSOn by default. Turn it off only for a plain-HTTP server, for example a local model server on the edge.
SNIThe server name sent and verified. Default: the host.
Path prefixFor openai, aws-openai and anthropic: the gateway calls /<prefix>/chat/completions (or /<prefix>/messages).
API versionSee the type table.
Model overrideSent upstream instead of the client's model name, for every model this provider serves. Usage and prices then use the overridden name.

With TLS on, Envoy on the edge verifies the provider's certificate against the edge's CA bundle (/etc/ssl/certs/ca-certificates.crt) and the SNI (or host) as its subject alternative name. A host given as an IP address with no SNI is verified as an IP address and no SNI is sent. For a provider given by host name, Envoy rewrites the request's Host to that name (providers answer only their own host); a provider given by IP address gets the client's Host unchanged.

OpenAI-compatible services​

For type openai, Fill from a known service sets host, port, TLS and path prefix for: OpenAI, Anthropic (OpenAI-compatible), Google Gemini (AI Studio), Groq, OpenRouter, xAI Grok, Mistral, DeepSeek, Together AI, DeepInfra, SambaNova, Cohere (OpenAI-compatible), Tetrate Agent Router (TARS), Eden AI, FlexAI, Bitdeer AI, Hunyuan, Tencent LLM Knowledge Engine, Grokified, Lanseq, Heabsy, Paxa Labs, and two servers on the edge itself: Ollama on the edge (127.0.0.1:11434, plain HTTP, prefix v1) and vLLM on the edge (127.0.0.1:8000, plain HTTP, prefix v1). A local server needs no real key, but the API key field is still required: enter any value.

Request changes​

Set and remove body fields​

Set fields and Remove fields change the JSON body the engine sends to this provider, after it translated the request to the provider's API (and before AWS signing). Removals run first.

  • A path is an sjson path: metadata.team sets a nested field.
  • A value must be a JSON value: 512, true, {"a":1}, or text in quotes ("flex"). The form refuses flex with Text needs quotes: "flex"; the API refuses any value that is not valid JSON.
  • At most 16 fields to set and 16 to remove.

Example: send OpenAI's flex tier and drop the user field.

"body": { "set": [ { "path": "service_tier", "value": "\"flex\"" } ], "remove": ["user"] }

anthropic-beta filter (aws-anthropic, gcp-anthropic)​

anthropic-beta controls which anthropic-beta values reach the provider on the Anthropic Messages API:

  • As sent — no filter.
  • Only these (allow) — keep only the listed values.
  • All but these (deny) — drop the listed values.

Values match exactly and case-sensitively; 1 to 64 values. Bedrock first keeps only the betas it accepts itself (the others never reach it). Vertex receives the filtered header. The filter is refused on any other type.

Headers (API only)​

headers.set[] / headers.remove[] change request headers toward the provider. The UI keeps them as they are but does not edit them; use the REST API. Header values are masked like credentials, so a masked header value must be entered again under the same rules.

A client's own provider key​

Turn on Client's own key to let a client send its own key for this provider in the request header x-elchi-provider-key. Requests without that header use the provider's configured credential.

  • Envoy's first AI filter moves the header into request metadata and removes it before any other filter, log, trace or provider sees it. A client cannot set that metadata itself.
  • The engine sends the client's key the way the provider's own credential is sent: Authorization: Bearer for openai, typesafe, gcp-* and an Entra azure-openai provider; x-api-key for anthropic; api-key for an azure-openai provider with a key.
  • Refused (the save fails, or the switch is disabled):
    • aws-* types: an AWS credential is three values.
    • A gcp-* provider without an Access token: there would be nothing to fall back to. The switch says Needs an access token above to fall back to when a client sends no key.
    • A provider of a model served by several providers: a retry could take one provider's key to another. The save is refused with model "x" is served by several providers, so provider "y" cannot take a client's own key (credentialOverride).

On a gateway that requires a key, the client still sends its elchi consumer key as usual; x-elchi-provider-key is separate.

curl https://llm.example.com/v1/chat/completions \
-H "Authorization: Bearer sk-elchi-..." \
-H "x-elchi-provider-key: sk-..." \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'

Model lists, Check now and Try​

These three actions run on the control plane, with the stored credential, for openai and anthropic providers only. Only Owners and Admins can run them.

ActionWhereWhat it callsCost
Model suggestionsthe gateway form's model name fieldGET /<prefix>/models (/v1/models for anthropic)no tokens
Check nowthe provider's page, Status sectionthe same model listno tokens
Trynext to a model name in the gateway formone chat request (/<prefix>/chat/completions, or /v1/messages for anthropic) with max_tokens: 16 and the prompt pinga few tokens

What they show:

  • Suggestions: the provider's model IDs, sorted (Gemini's models/ prefix is dropped). Models the gateway already serves with that provider are shown as added. Any name can still be typed.
  • Check now: Answered in 120 ms · 42 models, or Answered 401: <the provider's message>, or Not reached: <kind>.
  • Try: openai answered (200), or openai answered 404: <the provider's message>. A model can appear in a provider's list and still be refused for your key; Try tells you which.

Other provider types publish no list here: type the model names, and the provider's Status says This type publishes no model list to ask; its status comes from the traffic only.

What the control plane refuses to call​

The control plane's client is guarded, because the endpoint is the editor's choice:

  • It never connects to loopback, link-local (this includes cloud metadata at 169.254.169.254), unspecified or multicast addresses, or to the other metadata addresses fd00:ec2::/64, fd20:ce::254, fd00:c1::a9fe:a9fe and 100.100.100.200, also when hidden behind a NAT64 prefix. The check runs on every address a name resolves to, when it is dialled. Private addresses (an in-house model server) are allowed.
  • It does not follow redirects.
  • Behind an HTTP proxy (taken from the control plane's environment), it resolves the provider's name itself first and refuses an internal address before asking the proxy; a name only the proxy can resolve is refused.
  • It times out after 10 seconds and reads at most 4 MiB of an answer.
  • It shows only a provider's own error message (OpenAI's and Anthropic's error shape, at most 200 characters). Any other body is never echoed, and a failed connection is reported by its kind only: no answer in time, connection refused, the TLS handshake failed …, <address> is not a provider address the control plane may reach, or no HTTP answer.
  • A provider whose host is on the edge itself (localhost, 127.x.x.x, ::1) cannot be reached from the control plane: the answer says … is on the edge itself …; the control plane cannot reach it, type the model names, and the Status section explains that its status comes from the edges' traffic only.

Provider status​

The providers list has a Status column, and each provider's page a Status section. Both come from what the provider answered the edges in the last 15 minutes: each edge's elchi-ai-gateway reads Envoy's access log and records every answer a provider gave (ClickHouse table elchi_ai_gateway_upstream). The list refreshes every 30 seconds.

StatusWhen
IdleNo answer in the window. No traffic, not "down".
OKFewer than 5% failures and no rate limiting.
Degraded5% or more failures, or any 429.
FailingOnly failures, or 3 or more failures making 50% or more.

Failures are the provider's own: server errors (5xx), rate limiting (429), a refused key (401/403), no connection, a timeout, a reset connection. A request the engine or the authorization refused (a malformed body, an unsupported API, a missing elchi key) never reached the provider and does not count. Hover the status for the counts per class and the last answer and failure.

On the provider's page, Ask the edges reads each AI listener's Envoy /clusters on the clients it is deployed on and lists, per edge, the provider's hosts as healthy, ejected (a member of a multi-provider model left out after failing in a row), unhealthy or unreachable.

Provider status needs ClickHouse on the control plane; without it the API answers 503 clickhouse not configured; provider status unavailable. Usage charts and costs are on Usage and costs.

Delete a provider​

Click the delete icon in the list, or Delete on the provider's page. A provider that a gateway's model or a consumer's provider list names cannot be deleted: the page says <provider> is in use … change them first. A deleted provider's credential, its endpoint and its provider-specific prices leave every edge with the next deploy.

REST API​

All calls are under /api/v3/ai-gateway and take the project ID. Reads need project membership; writes and the provider calls need an Owner or Admin. Full reference: REST API.

Method and pathWhat it does
GET /providers?project=The providers document: providers (masked), upstreams (set per provider), effective_upstreams (what Envoy uses), limits, pricing, version, and the configuration's warnings.
PUT /providersReplaces the whole document: {project, providers, upstreams, limits, pricing, expected_version}.
GET /providers/:name/models?project=The provider's model list (502 when it cannot be read).
POST /providers/:name/check{project} → {ok, reachable, status, message, models, latency_ms}.
POST /providers/:name/try{project, model} → {ok, status, message} (502 when the provider cannot be reached).
GET /provider-health?project=Each provider's status over the last 15 minutes.

PUT /providers replaces everything in the document: send every provider, every upstream you set, the global limits and the price table each time, as GET returned them (masked secrets included). Anything left out is removed. expected_version is the version you read; when someone saved in between, the answer is 409 and nothing is stored (0 skips the check).

# Read the document (secrets masked)
curl -s "$ELCHI/api/v3/ai-gateway/providers?project=$PROJECT" -H "Authorization: Bearer $TOKEN"

# Save it with an Azure OpenAI provider added
curl -s -X PUT "$ELCHI/api/v3/ai-gateway/providers" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{
"project": "'"$PROJECT"'",
"expected_version": 4,
"providers": [
{"name": "openai", "type": "openai", "pathPrefix": "v1", "credentials": {"apiKey": "***REDACTED***"}},
{"name": "azure", "type": "azure-openai", "apiVersion": "2024-10-21",
"credentials": {"azureEntra": {"tenantId": "00000000-0000-0000-0000-000000000000",
"clientId": "11111111-1111-1111-1111-111111111111",
"clientSecret": "..."}}},
{"name": "bedrock", "type": "aws-bedrock", "credentials": {"aws": {"region": "eu-central-1"}}}
],
"upstreams": {"azure": {"host": "my-resource.openai.azure.com"}},
"limits": [],
"pricing": []
}'

A successful write answers {"data": {…the document…}, "deploy": {"enqueued": true, "deploy_job": "…"}, "warnings": [...]}. Invalid input answers 400 with every problem in message.

Verify and troubleshoot​

  • After a save, the provider's Status turns from Idle once requests reach it. Check now (OpenAI-compatible and Anthropic types) proves the key and endpoint without spending tokens.
  • Not reached: the TLS handshake failed — the host serves no HTTPS with a certificate for its name, or TLS should be off for a local plain-HTTP server.
  • A provider stays Failing with refused the key — the credential is wrong or expired; for Entra, see the edge's /configz credentials[].
  • Clients get 422 — the endpoint they call cannot reach this provider type; see the matrix below.
  • More: Troubleshooting.

Endpoint × provider matrix​

The engine translates each client API to the provider's API. A provider type an endpoint cannot translate to answers 422 (UnprocessableEntity, "unsupported API schema"). Paths are the defaults on an AI listener.

Client endpointProvider types it reaches
/v1/chat/completionsopenai, aws-openai, aws-bedrock, aws-anthropic, azure-openai, gcp-vertexai, gcp-anthropic
/v1/completionsopenai
/v1/embeddingsopenai, azure-openai, gcp-vertexai, aws-bedrock
/v1/responsesopenai, aws-openai, azure-openai
/v1/responses/input_tokensopenai, azure-openai
/v1/images/generations, /v1/audio/speech, /v1/audio/transcriptions, /v1/audio/translationsopenai
/anthropic/v1/messagesanthropic, gcp-anthropic, aws-anthropic, openai, aws-bedrock
/anthropic/v1/messages/count_tokensanthropic, gcp-anthropic, aws-anthropic, aws-bedrock
/cohere/v2/rerankcohere
/typesafe/v1/systemonetypesafe only; no streaming
/v1/models, /anthropic/v1/modelsanswered by Envoy from the gateway's model list (no provider is called)

How clients call these endpoints: Calling the gateway.