Providers & BYOK
Bring your own API keys, auto-discover providers, and manage the catalog.
How providers work
BrainstormRouter routes requests across AI providers. Models use the provider/model naming convention:
anthropic/claude-sonnet-4 → Anthropic API
openai/gpt-4o → OpenAI API
google/gemini-2.0-flash → Google Generative AI
groq/llama-3.3-70b → Groq (fast inference)
Auto-discovery
Set provider API keys as environment variables and BrainstormRouter discovers them automatically:
| Env Var | Provider | Models |
|---|---|---|
ANTHROPIC_API_KEY | Anthropic | Claude Sonnet 4, Haiku 4.5, Opus 4 |
OPENAI_API_KEY | OpenAI | GPT-4o, GPT-4o-mini, o1, o3 |
GOOGLE_API_KEY | Gemini 2.0 Flash, Gemini 2.5 Pro | |
GROQ_API_KEY | Groq | Llama 3.3, Mixtral |
TOGETHER_API_KEY | Together AI | Open-source models |
FIREWORKS_API_KEY | Fireworks | Fast open-source inference |
Bring Your Own Key (BYOK)
Register provider keys at runtime via the API. Keys are encrypted at rest using KMS envelope encryption.
import BrainstormRouter from "brainstormrouter";
const client = new BrainstormRouter({ apiKey: "br_live_..." });
// Register a key
await client.providers.register("groq", { apiKey: "gsk_..." });
// Validate before storing
const result = await client.providers.test("groq", "gsk_...");
console.log(result.valid); // true
curl
# Register
curl -X POST https://api.brainstormrouter.com/v1/providers \
-H "Authorization: Bearer br_live_..." \
-H "Content-Type: application/json" \
-d '{"provider": "groq", "api_key": "gsk_..."}'
# Validate
curl -X POST https://api.brainstormrouter.com/v1/providers/test \
-H "Content-Type: application/json" \
-d '{"provider": "groq", "api_key": "gsk_..."}'
Key rotation
Registering a new key for a provider that already has one automatically rotates it — the old key is deactivated and the new one takes effect immediately.
Listing providers
# Your configured providers (keys masked)
curl https://api.brainstormrouter.com/v1/providers \
-H "Authorization: Bearer br_live_..."
# Full catalog of supported providers (no auth needed)
curl https://api.brainstormrouter.com/v1/providers/catalog
Provider catalog
BrainstormRouter supports 30+ providers with 1,500+ models. The catalog includes:
- Tier 1: Anthropic, OpenAI, Google — production-grade, full feature support
- Tier 2: Groq, Together, Fireworks, Mistral — fast inference, good value
- Tier 3: Perplexity, DeepSeek, Cohere — specialized capabilities
- Local: Ollama, LM Studio, llama.cpp — on-device models
Fetch the full catalog:
curl https://api.brainstormrouter.com/v1/providers/catalog | jq '.providers[] | .id'
Removing a provider
curl -X DELETE https://api.brainstormrouter.com/v1/providers/groq \
-H "Authorization: Bearer br_live_..."
This deactivates the key but doesn't delete it — it's preserved for audit purposes.