Provider credential pools
Last updated: 2026-11-21T09:54:10-03:00 (UTC-3)
A provider can retain one legacy API key or declare a pool of named static credentials. The gateway keeps a stable primary credential for account-bound operations and can distribute qualified text Chat traffic by relative weight. A pool does not increase a provider’s quota, prove two accounts equivalent, grant client permissions or add retries.
Defaults and supported scope
Section titled “Defaults and supported scope”Keys of each providers[] entry and the flags around them:
| Setting | Default | Effect |
|---|---|---|
features.provider_credential_pools |
false |
Runtime operator switch for weighted selection. Off uses only the explicit primary. |
features.provider_credential_cooldowns |
false |
Requires pools; excludes failed credentials from future qualified weighted selections. |
providers[].credentials |
Absent | Existing scalar credential behavior. At most 16 named entries for static bearer/protocol-specific or custom-header authentication. |
providers[].credentials[].id |
Required | Name of the credential within the connection, used by primary_credential_id, the logs and the console |
providers[].credentials[].api_key_env |
Required for a static key | Variable holding that credential’s key |
primary_credential_id |
No implicit choice | Required with a pool; must name an entry. No fallback to a legacy scalar secret. |
credentials[].weight |
1 |
Integer 1–1000, relative share. Use disabled to stop an entry. |
credentials[].cooldown |
30s |
Go duration, whole milliseconds 0–1h; 0s disables this entry’s cooldown. |
credentials[].disabled |
false |
Prevents use of this credential on every path, including primary-only and weighting-off paths. |
credential_cooldown_statuses |
[401,429] |
At most32 unique HTTP statuses 400–599. Explicit [] disables signals. |
credential_selection_max_body_bytes |
65536 |
Raw0 selects the default; explicit 1024–1048576. Larger bodies use primary without modification. |
Each ID matches [a-z][a-z0-9_-]{0,63} and is unique within its provider. A pool cannot coexist with a legacy scalar key/reference or cloud/no-auth authentication. An entry needs an admitted secret reference or stored secret. A temporarily unavailable reference does not certify readiness or prevent the gateway from starting: unresolved entries cannot be selected, and an unavailable primary fails primary-only operations closed.
The initial weighted profile is text Chat execution, JSON or streaming, after defaults and per-target encoding. Native OpenAI Chat and the existing Chat-to-Anthropic/Gemini basic-text encoders are qualified. The gateway requires private proof of Chat execution and checks the final body structurally. Unknown extensions, duplicate/ambiguous fields, tools/history, media/file/resource references, stored state, prompts or continuations use primary unchanged. Text containing a word such as file_id remains ordinary text. The classifier neither deletes fields nor rewrites a request to make it eligible.
Every other operation uses primary: native Messages/GenerateContent outside Chat translation, Responses/Conversations, files, vector stores, fine-tuning, containers, media/video, realtime, token counting and catalogs. Pagination/polling uses one captured primary handle. These paths ignore weighted cooldown, but never disabled or missing primary. This is not automatic affinity across a change of primary or secret: changing either can change the provider account and invalidate existing provider objects.
Configure in YAML
Section titled “Configure in YAML”features: provider_credential_pools: false provider_credential_cooldowns: falseproviders: - id: openai-pool preset: openai primary_credential_id: production credential_cooldown_statuses: [401, 429] credential_selection_max_body_bytes: 65536 credentials: - id: production api_key_env: OPENAI_API_KEY_PRODUCTION weight: 3 cooldown: 30s disabled: false - id: overflow api_key_env: OPENAI_API_KEY_OVERFLOW weight: 1 cooldown: 30s disabled: falseThis fragment is part of a complete gateway configuration. Existing environment/file/secret-manager resolution supplies the values; do not put provider keys in version control. The preset does not inject its conventional scalar reference into a pool. Review primary/account ownership before enabling weighting. All client route, model, role, team, budget and rate checks still apply. Pool members share the connection URL, headers, model aliases and approved price profile; the provider still checks each key’s access. Use separate providers/targets when accounts require different connection/model policy. Catalogs inspect primary only; they do not merge permissions or advertise secondary-account models.
With weighting on, the example has a 3:1 configured relative share among available entries. Bounded smooth weighted round robin is process-local, not a promise that every short sample, fleet or provider quota has that ratio. Disabled/unresolved/cooling entries do not participate. Duplicate resolved enabled secrets under different IDs fail closed, preventing aliases around the cooldown.
Cooldown and failure behavior
Section titled “Cooldown and failure behavior”Only response-header signals from qualified weighted dispatches feed cooldown. Caller cancellation, local rejection, an ambiguous transport outcome or a midstream failure do not mark a credential unhealthy. Native/primary-only/catalog calls do not feed this mechanism. It is not universal provider-health monitoring.
For a configured status, a valid Retry-After can shorten the entry’s configured duration; that duration is also the upper bound. Invalid/absent values use the configured duration. No cooldown sleep or additional retry loop is introduced. Existing retry/fallback eligibility remains authoritative; a started stream is never replayed.
If a provider has no eligible credential, it is unavailable before a send. An existing configured and authorized target fallback may proceed only under its normal flag/operation/replay rules, without inventing a paid attempt or breaker failure. If no lawful target remains, the request receives 503 provider_credentials_unavailable with bounded Retry-After. An account-bound operation never silently switches credentials or provider to recover.
State is local to a process and starts cold after restart. Secret/policy generations fence old flights so they cannot cool a replacement or reinstall older state. Correlated diagnostics identify finite configured provider/credential IDs; they never include secret values, references, ciphertexts or fingerprints.
Manage through the API and console
Section titled “Manage through the API and console”The existing provider editor and PUT /api/v1/admin/providers/{id} use the same global version, current permissions, CSRF, full-snapshot validation and audit. provider_credential_access contains only two effective extra write capabilities (pool_write, cooldown_write), intersecting provider permissions and feature-aware license state. Child writes also require parent. Missing/malformed capability data disables the new editor, without granting permission or stopping established inference. The typed pool descriptor introduced in V13 is preserved in V14, which the current console requests; it supplies the actual bounds/defaults. The strict reader accepts V13 or V14; missing or malformed metadata disables this new editor rather than inventing values. Safe configuration shows the primary, effective pool policy and per-entry credential presence/source. Presence is configuration information, not successful authentication or provider health. Weight, cooldown, status-list and body-bound sources distinguish default, yaml and console; material source is separately yaml, console or unconfigured. Pool fields are omitted for legacy providers.
API pool metadata goes inside provider; secrets are a separate write-only credential_secrets map keyed by entry ID. No arbitrary secret reference is accepted through the pool API. Secrets are limited to 2048 UTF-8 bytes each, without HTTP-invalid ASCII controls (C0 except HTAB, plus DEL); the entire provider request is bounded to 64 KiB. Omitted/blank secrets retain only that existing ID’s secret or exact admitted YAML binding. A new ID needs a new secret or exact declaration. Omitted pool metadata on an unchanged static-auth edit preserves it; removing it requires explicit credentials: [] and a valid legacy source. An auth transition cannot resurrect an old inactive ciphertext.
This example creates a new connection; do not reuse it to overwrite another provider’s headers/auth options. Supply an authenticated cookie jar and its CSRF token through the normal console session procedure:
BASE_URL='http://localhost:8080': "${COOKIE_JAR:?Set the authenticated console cookie file}": "${CSRF_TOKEN:?Set the session CSRF token}": "${OPENAI_API_KEY_PRODUCTION:?Load the primary key outside the repository}": "${OPENAI_API_KEY_OVERFLOW:?Load a distinct secondary key outside the repository}"SNAPSHOT=$(mktemp)trap 'rm -f "$SNAPSHOT"' EXITcurl --fail-with-body -sS -b "$COOKIE_JAR" \ "$BASE_URL/api/v1/admin/config" > "$SNAPSHOT"python3 - "$SNAPSHOT" <<'PY' | curl --fail-with-body -sS \ -b "$COOKIE_JAR" -X PUT -H "X-CSRF-Token: $CSRF_TOKEN" \ -H 'Content-Type: application/json' --data-binary @- \ "$BASE_URL/api/v1/admin/providers/openai-pool-example"import json, os, syssnapshot = json.load(open(sys.argv[1]))json.dump({ "version": snapshot["version"], "provider": { "id": "openai-pool-example", "preset": "openai", "primary_credential_id": "production", "credentials": [ {"id": "production", "weight": 3, "cooldown": "30s", "disabled": False}, {"id": "overflow", "weight": 1, "cooldown": "30s", "disabled": False} ] }, "credential_secrets": { "production": os.environ["OPENAI_API_KEY_PRODUCTION"], "overflow": os.environ["OPENAI_API_KEY_OVERFLOW"] }}, sys.stdout)PYDo not record the pipeline input or use verbose credential-bearing HTTP traces. The response never returns these secrets. Saving the provider does not make a paid model call or prove its keys work. A409 requires reloading/reviewing the version; an uncertain write requires a fresh read before retry. The editor discards secret drafts and late replies on authority, provider, authentication or flag changes.
Cache, rotation and recovery
Section titled “Cache, rotation and recovery”Exact/catalog/discovery/latency namespaces include private pool/primary identity; they do not advertise account equivalence. Semantic cache is bypassed when either the answer or embedding connection has a pool, including weighting-off. This avoids storing a response under another secret generation; legacy nonpool semantic caching is unchanged. No cache result grants permission or bypasses budget/revocation checks.
Migration 119 stores pool ciphertexts separately from metadata and binds each to its provider/entry with authenticated encryption. Removing an entry/override deletes its ciphertext atomically; backup/restore must retain the matching operator encryption keyring. The explicit offline reencryption procedure includes this family. Preserve the usual quiesced-writer backup and unknown-COMMIT recovery rules.
Upgrade every replica before admitting pools or enabling their flags. Older binaries do not understand the new YAML, schema or metadata; follow the normal backup/configuration rollback procedure. Default PostgreSQL is the validated managed-persistence boundary; no optional-engine or cloud-host certification is implied. Source-IP restrictions, credentials, provider flags and client permissions remain independent ceilings.
See providers, parameter metadata, resilience, automatic pricing and operations.
Enterprise classification remains an optional vendor build input with no chosen cutoff. A free pool parent and read-only enterprise cooldown child can still edit weights/secrets/primary while preserving effective cooldown policy; durations compare by value and status codes as sets. New/enabled entries under active cooldown are new child activation. Parent readonly bounds the entire pool writer, while unrelated free scalar providers retain their ordinary writer. Provider policy, license/trial and candidate version are checked coherently under the control transaction locks; omission or an explicit empty list is not a license bypass.