API Keys
RadarOS supports per-request API key overrides so clients can pass their own API keys instead of relying on server-side environment variables. Useful for multi-tenant apps, user-provided keys, and development.Supported Headers
| Header | Provider | Use Case |
|---|---|---|
x-openai-api-key | OpenAI | GPT, embeddings |
x-google-api-key | Gemini, embeddings | |
x-anthropic-api-key | Anthropic | Claude |
x-api-key | Generic | Fallback when provider-specific key not set |
How It Works
- Client sends a request with one of the headers (or
apiKeyin body). - Transport layer extracts the key via
extractApiKey(). - Key is passed to
agent.run(input, { apiKey })oragent.stream(input, { apiKey }). - The model provider uses the per-request key instead of
process.env.*.
REST (Express)
Socket.IO
Provider Matching
Forx-api-key (generic), the transport may match it to the agent’s provider. For provider-specific headers:
x-openai-api-key→ used when agent uses OpenAIx-google-api-key→ used when agent uses Googlex-anthropic-api-key→ used when agent uses Anthropic
Security Notes
HTTPS
Always use HTTPS in production so API keys are not sent in cleartext.
Logging
Avoid logging request headers or bodies that may contain API keys.