OpenRouter Integration
Connect your AI agent to OpenRouter for multi-model routing across 100+ AI models. Optimize costs, configure fallback chains, and track usage across providers with a single API key.
Bring Your Own Key (BYOK)
ClawTrust already uses OpenRouter as the default model router for all agents. This credential is for BYOK scenarios where you want your agent to use your own OpenRouter account instead of the included AI budget.
What your agent can do
With your own OpenRouter key, your agent gets full control over model selection and spending.
Multi-model routing
Access 100+ AI models from OpenAI, Anthropic, Google, Meta, and others through a single API endpoint. Switch models without changing code.
Cost optimization
Route requests to the most cost-effective model for each task. Compare pricing across providers and set budget limits per key.
Fallback chains
Configure automatic fallback sequences. If your primary model is unavailable or rate-limited, requests route to the next model in your chain.
Usage tracking
Monitor token usage, costs, and latency across all models. OpenRouter provides detailed analytics for every request.
Unified API format
Use a single OpenAI-compatible API format for all models. No need to learn different SDKs or handle provider-specific quirks.
Prerequisites
Before you connect, make sure you have the following.
- An OpenRouter account with credits or a payment method
- An API key from openrouter.ai/keys
- A ClawTrust agent on any plan (Starter, Pro, or Enterprise)
Step-by-step setup
Generate an API key from OpenRouter and add it to your agent.
Create an OpenRouter account
Go to openrouter.ai and sign up. Add credits to your account or connect a payment method for pay-as-you-go billing.
Generate an API key
Navigate to openrouter.ai/keys. Click "Create Key", give it a name like "ClawTrust Agent", and optionally set a credit limit to control spending.
Copy your API key
Copy the generated key. This is a Bearer token that works with the OpenAI-compatible API format at openrouter.ai/api/v1.
Add to ClawTrust
In your agent's dashboard, go to Credentials > Add Credential. Select "API Key (Bearer)", paste your key, and set the allowed domain to *.openrouter.ai.
Credential details
Enter these values when adding the credential in ClawTrust.
| Field | Value |
|---|---|
| Credential Type | API Key (Bearer) |
| API Key | Your OpenRouter key (sk-or-...) |
| Header Format | Authorization: Bearer sk-or-... |
| Allowed Domains | *.openrouter.ai |
Credentials are encrypted with AES-256-GCM and stored on your agent's dedicated server. They never leave your infrastructure. The allowed domains restriction ensures your agent can only use these credentials with OpenRouter endpoints.
Example actions
Here is what your agent can do once the integration is live.
Route to the cheapest model for a simple task
Your agent sends a formatting request to a cost-effective model like Llama 3.1 instead of GPT-4o, saving credits while getting the same quality output for simple tasks.
Use Claude for complex analysis, GPT for summaries
Your agent routes a contract review to Claude Opus for deep analysis, then sends the findings to GPT-4o-mini for a concise summary, optimizing for both quality and cost.
Handle provider outages gracefully
When Anthropic has downtime, your agent's fallback chain automatically routes Claude requests to an equivalent model on another provider with zero manual intervention.
Compare model outputs side by side
Your agent sends the same prompt to three different models through OpenRouter, compares the results, and picks the best response for your use case.
Ready to bring your own OpenRouter key?
Add your API key and your agent uses your OpenRouter account for unlimited model access.