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. 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
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 (Recommended)
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)
If you prefer managing keys programmatically, use these endpoints (not OpenAI-compatible):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: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.
- Prefer storing keys once (UI or the
/api/user/provider-keysendpoints) and then enabling BYOK per request.