BYOK (Bring Your Own Key) lets you use your own provider API keys through the varg gateway. You still get caching, stable URLs, and unified API — but you’re billed directly by the provider instead of through varg credits.Documentation Index
Fetch the complete documentation index at: https://docs.varg.ai/llms.txt
Use this file to discover all available pages before exploring further.
You still need a
VARG_API_KEY even with BYOK. It authenticates you with the gateway. BYOK just changes who pays for the AI generation.Why BYOK?
- $0 varg cost — you pay the provider directly
- Own quotas — use your own rate limits and billing
- Same gateway features — caching, stable URLs, unified API
- Mix and match — use BYOK for some providers, varg credits for others
How it works
When a request reaches the gateway, it resolves the API key in this order:- BYOK header (
X-Provider-Key-*) — $0 varg cost - Dashboard-saved BYOK key — $0 varg cost
- Varg pooled key — metered billing via credits
Provider keys
| Provider | Header | Env var | Get key at |
|---|---|---|---|
| Fal | X-Provider-Key-Fal | FAL_KEY | fal.ai/dashboard/keys |
| ElevenLabs | X-Provider-Key-ElevenLabs | ELEVENLABS_API_KEY | elevenlabs.io/app/settings/api-keys |
| Higgsfield | X-Provider-Key-Higgsfield | HIGGSFIELD_API_KEY | higgsfield.ai |
| Replicate | X-Provider-Key-Replicate | REPLICATE_API_TOKEN | replicate.com/account/api-tokens |
Quick tutorial
Gateway API (curl)
Pass your provider key as a header alongside your varg key:Cloud Render
Pass BYOK keys in the request body:Local Render (TypeScript)
Pass provider keys when creating the varg client:.env setup for BYOK
Caching with BYOK
BYOK requests use the same cache as pooled requests. The cache key is based on the request parameters (prompt, model, etc.), not the API key used. This means:- If a result is already cached from a previous pooled request, your BYOK request gets the cached result at $0
- If you generate something new with BYOK, subsequent requests (pooled or BYOK) get the cached result
When to use BYOK vs credits
| Scenario | Use |
|---|---|
| Getting started, small projects | Credits — simplest, one key |
| High volume production | BYOK — use provider pricing directly |
| Need specific provider features | BYOK — full access to provider API |
| Team with existing provider accounts | BYOK — reuse existing keys |
| Prototyping, learning | Credits — no provider setup needed |