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-5     → Anthropic API
openai/gpt-4o                 → OpenAI API
google/gemini-2.5-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 VarProviderModels
ANTHROPIC_API_KEYAnthropicClaude Sonnet 5, Haiku 4.5, Opus 4
OPENAI_API_KEYOpenAIGPT-4o, GPT-4o-mini, o3, o3-mini
GOOGLE_API_KEYGoogleGemini 2.5 Flash, Gemini 2.5 Pro
GROQ_API_KEYGroqLlama 3.3, Mixtral
TOGETHER_API_KEYTogether AIOpen-source models
FIREWORKS_API_KEYFireworksFast 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.

If you started on a sandbox account, a verified provider key also unlocks graduation: POST /v1/account/graduate clears the sandbox caps — see Graduation.

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
# 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 "Authorization: Bearer br_live_..." \
  -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's registered catalog spans 40 models across 9 providers. Live availability is always GET /v1/models (circuit breakers may hide temporarily-unhealthy models). The providers are:

  • Tier 1: Anthropic, OpenAI, Google — production-grade, full feature support
  • Reasoning & value: DeepSeek, xAI (Grok), Groq — fast inference, strong price/performance
  • Specialized: Perplexity, Moonshot, Z.ai — search-grounded and long-context 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.