ultrarouter docs
Guides

Providers & BYOK

The first-class providers, bring-your-own-key, and per-provider policy.

First-class providers

Seventeen providers are built in and resolve through one data-driven registry: openai, anthropic, google (Gemini), deepseek, mistral, qwen, xai, kimi, zai (Z.ai / Zhipu — GLM), cohere, together, fireworks, deepinfra, groq, novita, cerebras, and bedrock (Amazon Bedrock).

An open-weight model (Llama / Qwen / DeepSeek) is multi-offer across the aggregators (Together / Fireworks / DeepInfra / Groq / Novita / Cerebras / Bedrock), so routing can pick the cheapest or fastest offer. Browse the catalog with GET /v1/models (filter by provider / capability) and one model's offers with GET /v1/models/{id}.

Amazon Bedrock

Bedrock is a first-class provider with its own adapter: it authenticates with AWS SigV4 (not a bearer key) and speaks the Converse / ConverseStream API. It exists to serve open-weight models hosted in US regions — including Chinese-lab open-weight models such as DeepSeek and Qwen — so a workspace whose model policy denies Chinese labs can still run those weights when they are US-hosted (see "Interaction with the model policy" below).

Credentials & region. Bedrock's platform credential is composed from four environment variables (shared by the gateway and workers, injected per-service — never a single UR_PROVIDER_BEDROCK_API_KEY):

  • UR_PROVIDER_BEDROCK_ACCESS_KEY_ID and UR_PROVIDER_BEDROCK_SECRET_ACCESS_KEY — the AWS access key id + secret (required to enable Bedrock).
  • UR_PROVIDER_BEDROCK_SESSION_TOKEN — an optional STS session token for temporary credentials.
  • UR_PROVIDER_BEDROCK_REGION — the US region to invoke in; defaults to us-east-1.

With no access key or secret configured, Bedrock is keyless and is skipped everywhere (catalog sync, routing, probes) with a structured log — never an error. Credentials and the AWS signature are never logged.

What is curated. The catalog ships curated Bedrock offers for open-weight models served on-demand in US regions: DeepSeek-R1, Qwen3 32B, Qwen3 Coder 30B, and Llama 3.3 70B Instruct (a mirror of the existing Llama 3.3 70B logical model). Each offer records hosting_jurisdiction: US with its region; provenance (origin lab + open weights) comes from the logical model. Prices are curated from the public Bedrock pricing page (the Bedrock API exposes none).

Interaction with the model policy. Because every curated Bedrock offer is US-hosted and open-weight, the US-hosted open-weight exception admits it under a us_only policy that otherwise denies the offer's origin lab — while that lab's own first-party (e.g. China-hosted) offer stays denied. This is the mechanism behind running a Chinese open-weight model from a US host.

Bring your own key (BYOK)

Register your own provider keys per workspace with POST /v1/workspaces/:id/provider-keys (or in the dashboard /providers screen). BYOK keys participate in routing like first-class ones:

  • priority (ascending — tried first) and weight (load-spread among equal priorities).
  • byok_fallback — whether the platform key may be used if your keys fail.
  • Health — a save-time and hourly probe sets each key's health status.

Secrets are envelope-encrypted (per-workspace data key wrapped by a versioned master key), decrypted only in memory at call time, and never returned by the API — responses show the last 4 characters only. A BYOK-served request sets ur.byok = true.

Custom providers

Register a custom OpenAI-compatible provider (e.g. a self-hosted model) with POST /v1/workspaces/:id/providers: a base_url, an auth template, the model ids it serves, manual pricing, and optional extra headers. Custom-provider egress is guarded against SSRF: HTTPS-only (loopback HTTP only with an explicit dev flag), private/link-local/metadata IP ranges rejected, re-validated on every redirect. See self-hosted models.

Declare pricing to route to it. The gateway only routes to an offer whose cost it can compute. A custom provider registered without pricing is refused before dispatch with the model_unpriced error (HTTP 403), both for your own requests and for evaluation or replay jobs that would call it. Otherwise every call to it would be recorded as $0, where your spend caps, budgets and savings could not see it. A declared price of 0 ({ "input": 0, "output": 0 }) is accepted: that is a price you stated, and those requests record a stated $0. Add pricing later with PATCH /v1/workspaces/:id/providers/:providerId.

Funding: choose BYOK to use your own keys

A new workspace is funded by prepaid UR credits (fundingMode: "ur_credits"). UR credits pay platform keys only: they never pay your own BYOK keys or a custom provider. To route through your own keys or your own provider, choose BYOK funding once, as a workspace owner, admin or billing member:

curl -sS -X POST "$UR_BASE_URL/v1/workspaces/$WORKSPACE_ID/billing/funding" \
  -H "Cookie: better-auth.session_token=$UR_SESSION" \
  -H "Content-Type: application/json" \
  -d '{ "mode": "byok", "allowPlatformFallback": false, "requestKey": "byok-choice-0001" }'

requestKey (16–128 characters of A–Z a–z 0–9 _ -) makes the call idempotent. The choice is audited and takes effect within a few seconds. allowPlatformFallback: true also permits platform keys (paid from UR credits) when your keys cannot serve a request. Check the current mode with GET /v1/workspaces/:id/billing/account.

Until you choose BYOK, a request that only your own key or provider could serve is refused with HTTP 403 and the error code permission. The message names the provider and this route. The refusal is not retryable, and the request never reaches your provider.

With BYOK funding your keys pay the provider. UR credits are not debited for those requests.

Data-collection policy

provider.data_collection: "deny" keeps only zero-data-retention (strict) offers. Per-provider data policy is surfaced in the dashboard.