Overview
BYOK (Bring Your Own Key) lets you store API credentials for supported upstream providers and then opt-in per request to route through your own keys. Page reading keys work differently: once saved, they are used automatically (see Page reading keys). Typical reasons to use BYOK:- Your provider bills you directly (enterprise agreements, committed-use discounts, free tiers).
- You want NanoGPT routing + enhancements, without using NanoGPT platform keys.
Availability
BYOK is currently supported on:POST /api/v1/chat/completions
scraping on POST /api/v1/chat/completions, POST /api/scrape-urls and POST /api/v1/data/url/scrape.
Pricing
When you use BYOK:- Your provider bills you directly for usage on their side.
- NanoGPT charges a 5% platform fee on top for routing and platform features.
Configure Keys
Web UI
Manage BYOK keys in the NanoGPT web app: Keys are never shown again after saving (only a short suffix is displayed), so treat them like passwords.API (NanoGPT key required)
API keys can list and remove saved provider keys (not OpenAI-compatible):owner_login_required, including restricted API keys. DELETE remains available so scripts can quickly remove a leaked provider key.
Example: remove a provider key
Use BYOK On A Request
Enable BYOK
Option A: request headerSelect a provider (optional)
If the model can route through multiple providers, you can force a specific provider. Header:Fallbacks (optional)
BYOK defaults to fail-fast behavior. If your provider key fails, NanoGPT will not silently route the request through a different provider key. You can control this via the request body:Provider Slugs
The exact set of supported providers can evolve; the BYOK UI lists what your account can configure.Chat / completion providers
These providers can be used for BYOK onPOST /api/v1/chat/completions:
Notes:
- AWS JSON can also include
sessionToken. - Azure-style providers require provider-specific endpoints and identifiers (for example, a deployment name).
- If you want to force Google AI Studio routing for Gemini models, set
x-byok-provider: google(orbyok.provider: "google"). - Additional provider options may appear over time in the BYOK UI and provider-discovery endpoints.
Web-search-only providers
These providers are BYOK for web search enhancements, not chat model execution:Page reading providers
These providers read web pages for URL scraping, not chat model execution:Page Reading Keys
Save a Firecrawl, Berrycrawl or Linkup key at https://nano-gpt.com/byok, and NanoGPT reads pages with it. You don’t needx-use-byok or byok.enabled.
Which key a page read uses:
- Standard reads use your Berrycrawl or Firecrawl key. If you saved both, NanoGPT tries one and falls back to the other, both on your keys.
- PDFs and documents are parsed with your Firecrawl key. In web app chat and on
/api/scrape-urls, a document URL fails if you saved only a Berrycrawl key, with a message asking you to add a Firecrawl key. - Stealth mode (
stealthMode: true) uses your Firecrawl key. Without one, stealth reads use NanoGPT’s Firecrawl key and are billed as usual. - Linkup keys are used only when Linkup is the selected page reader:
provider: "linkup"on/api/scrape-urls, orscraping: { "enabled": true, "provider": "linkup" }in chat.
No fallback to NanoGPT keys
Your key replaces NanoGPT’s. If a page can’t be read with your key, for example because your provider account is out of credits, that URL fails; NanoGPT does not retry it with a paid key. If a saved key can no longer be read, the request fails with HTTP 409 and codebyok_credential_unreadable. Save the key again on the BYOK page or remove it.
Balance and spending limits
Balance checks and API key spending limits don’t count page reads your own key will serve. Request limits still apply, and model usage in chat is billed as usual.When your keys are not used
- Zero Data Retention: requests that require ZDR always read pages with NanoGPT’s Linkup key under NanoGPT’s ZDR agreement, never with your keys.
- x402 payments: requests paid with x402 never use saved keys.
- Per chat request: send
scraping: { "enabled": true, "byok": false }to read pages with NanoGPT’s keys for that request. On/api/scrape-urls, remove the key to stop using it.
Teams
Team-billed requests use the team’s saved page reading keys when the team has BYOK enabled (prefer_team or require_team). A member’s personal key never serves a team-billed request. Without a matching team key, team-billed page reads use NanoGPT’s keys and are billed to the team as usual, in every team BYOK mode.
Saving a Berrycrawl key runs one test page read with it, which uses one Berrycrawl credit. Firecrawl and Linkup keys are checked without using credits.
Teams (BYOK)
Teams can also store provider keys and configure whether team-billed traffic should use team keys. Team settings endpoints (session-authenticated, not OpenAI-compatible):disabled: BYOK off for the team.prefer_team: use a team key when available; otherwise fall back to normal routing.require_team: fail requests when no team key exists for the required provider.
- In
prefer_teammode, team-billed traffic will not use a member’s personal BYOK keys unless the client explicitly opts in to BYOK on the request.
Security Notes
- Never put provider keys in client-side code or public repos.
- Store keys once in the web app and then enable BYOK per request.