When to use BYOK
- You already have provider accounts and billing relationships
- You need specific provider plans or tiers (enterprise agreements, committed-use discounts)
- You want to use providers beyond OpenAI and Anthropic (Google, DeepSeek, OpenRouter, etc.)
- You want to use custom or self-hosted providers (Ollama, vLLM)—see Custom Providers
- You need fine-grained control over which provider keys are used (CEL-based key selection)
- You want to manage your own cost allocation per key
How BYOK works
- Store your provider API keys in ngrok Vaults & Secrets
- Reference them in your AI Gateway Traffic Policy
- The gateway uses your keys instead of ngrok’s managed keys
AI Gateway API Keys compared to BYOK
| AI Gateway API Keys | BYOK | |
|---|---|---|
| Provider accounts needed | No (OpenAI & Anthropic only) | Yes |
| Credits required | Yes (processing fee + upstream provider fee) | No |
| Provider billing | Included in credits (ngrok pays provider) | Direct with providers |
| Setup complexity | Low (create key, use it) | Medium (configure secrets, Traffic Policy) |
| Key rotation | Managed by ngrok (provider keys) | You manage |
| Multi-key failover | Automatic | Configurable |
| CEL key selection | Not applicable | Full control |
| Custom/self-hosted providers | Not supported | Supported |
| Auth | Built-in (AI Gateway API Key) | DIY (secrets, JWT, etc.) |
| Supported providers | OpenAI, Anthropic | Any provider |