Bring your own keys
Use your own OpenAI and Anthropic keys through the nRouter gateway on the $20/mo BYOK plan while keeping every other model and modality on prepaid credits.
Your keys, our gateway. Everything else on credits. nRouter manages provider keys for you on credits by default, or you can bring your own OpenAI and Anthropic keys on the $20/mo Bring your own keys plan. Developers change nothing in their application code: keep the same sk-nrouter-* key, gateway endpoint, and SDK while every response reports who funded the call in the x-nr-funding-source header.
What BYOK is
Bring your own keys (BYOK) lets your organization route OpenAI and Anthropic text chat requests through the nRouter gateway using your own upstream provider accounts while keeping every other model and modality on prepaid nRouter credits.
- Zero code changes: Use the same
sk-nrouter-*virtual key (API Key Management), endpoint, and SDK across all models. - Direct provider billing: On BYOK requests, prompts go to your own OpenAI or Anthropic account and the provider bills you directly. nRouter charges $0 credits for those requests.
- Full gateway controls: Guardrails, rate limits, model access rules, and budgets still apply to every BYOK request.
Plan
nRouter offers two self-serve plans on Pricing:
| Plan | Price | Included usage & billing |
|---|---|---|
| Pay as you go — $0/mo | $0/mo | Buy credits, use any model. 0% fee. |
| Bring your own keys — $20/mo | $20/mo | Use your OpenAI & Anthropic keys. Other models use credits. 50M tokens/mo included. |
- Supported providers: OpenAI and Anthropic only.
- Supported modality: Text chat (
/v1/chat/completionsand/v1/messages). - Everything else on credits: Other providers, embeddings, audio, image, and video run on nRouter credits.
- Monthly token limit: 50M BYOK tokens per organization per calendar month (UTC) are included on the $20/mo plan. At the 50M token limit, BYOK requests are refused until the calendar month resets in UTC, while other models keep working on credits.
Add a key
Only Owners and org admins can add, replace, or remove provider keys.
- Open the dashboard and navigate to the BYOK section directly below API Keys.
- Paste your OpenAI or Anthropic key into the provider input.
- Run the key check and confirm the status badge displays Working.
Once saved, your organization's existing sk-nrouter-* keys automatically use your configured provider key for eligible OpenAI and Anthropic text chat calls.
The one checkbox
In the BYOK section, you can configure one fallback setting:
- "If my key fails, use my nRouter credits"
When this checkbox is unticked, a failing provider key returns an error to the caller and never charges your nRouter credits. When this checkbox is ticked, if your provider key fails on a request, nRouter serves the call using your prepaid nRouter credits instead.
How to tell who paid
Every response includes headers (Response Headers) showing how the request was funded and settled:
| Header | Values | Meaning |
|---|---|---|
x-nr-funding-source | byok, credits | Reports whether your provider key (byok) or your nRouter credit balance (credits) paid for the request. |
x-nr-byok-fallback | present on fallback | Emitted when your provider key failed and nRouter credits answered the request instead. |
x-nr-request-cost | absent on BYOK | Omitted on BYOK requests because your provider bills you directly and nRouter charges $0 credits. |
x-nr-cost-status | byok | Emitted on BYOK responses in place of credit settlement status. |
Errors
When a BYOK request cannot be completed with your provider key (and credit fallback is either unticked or inapplicable), the gateway returns a structured error response (Errors & Rate Limits) with one of the following public codes:
| HTTP Status | Error Code | Meaning |
|---|---|---|
| 402 | byok_plan_required | Your organization is not subscribed to the $20/mo Bring your own keys plan. |
| 409 | byok_credential_unavailable | No working OpenAI or Anthropic key is available for the requested model and credit fallback is not enabled. |
| 401 | byok_credential_rejected | OpenAI or Anthropic rejected the configured provider key and credit fallback is not enabled. |
| 429 | byok_fair_use_exceeded | Your organization reached the 50M BYOK tokens per calendar month (UTC) limit; resets at the next UTC month boundary. |
Security
- Browser sealing & encryption: Keys are sealed in the browser before upload and stored encrypted.
- Masked display: After saving, nRouter shows only
sk-…last4and never displays the full key again. - Role restrictions: Only Owners and org admins can add, replace, or remove keys.
- Direct provider account routing: On BYOK requests, prompts go to your own OpenAI or Anthropic provider account.
Limits
- Budgets: Budget Controls remain active on BYOK traffic. Budgets count an estimated cost at the nRouter list price for each BYOK request, which tracks gateway usage against your internal caps but cannot cap your upstream provider bill.
- Policies & rate limits: Guardrails, rate limits (Limits), and model access rules apply equally to BYOK and credit-funded requests.
- Other models and modalities: Models outside OpenAI and Anthropic, as well as embeddings, audio, image, and video endpoints, always run on nRouter credits (Billing & Credits).
Frequently asked questions
Which providers and endpoints work with BYOK?
BYOK supports OpenAI and Anthropic text chat (/v1/chat/completions and /v1/messages). All other providers, embeddings, audio, image, and video run on nRouter credits.
Do developers need to change their SDK or API key to use BYOK?
No. Developers keep the same sk-nrouter-* virtual key, endpoint, and SDK; each response indicates whether byok or credits paid in the x-nr-funding-source header.
What happens if my OpenAI or Anthropic key fails?
If the checkbox "If my key fails, use my nRouter credits" is unticked, the request returns an error and never charges credits. If ticked, nRouter falls back to your credits and emits x-nr-byok-fallback.
What happens when my organization reaches 50M BYOK tokens in a month?
BYOK requests are refused with HTTP 429 (byok_fair_use_exceeded) until the calendar month resets in UTC, while other models keep working on credits.
Can a budget cap my OpenAI or Anthropic invoice?
No. Budgets count an estimated cost at nRouter list price to enforce gateway spend thresholds, but your provider bills your account directly and nRouter cannot cap the provider bill.