OpenRouter

Unified API routing requests to many model providers behind a single endpoint and API key. OpenAI-compatible. Model refs: openrouter/<provider>/<model>.

OpenRouter is a unified API gateway that routes requests to 300+ AI models from dozens of providers — all through a single endpoint and API key. Instead of managing separate accounts with Anthropic, OpenAI, Google, Meta, and others, you top up once on OpenRouter and access everything through an OpenAI-compatible API. The value proposition is simplicity: one API key, one billing dashboard, one integration point. OpenRouter passes through the underlying provider's pricing with a small markup (typically included in the listed price), and you get automatic model discovery, usage tracking, and the ability to switch models by changing a single string. For OpenClaw users, this means you can experiment with dozens of models without setting up individual provider accounts. OpenRouter also offers free models — community-contributed endpoints for models like Llama, Mistral, and others. These have lower rate limits and may queue during peak times, but they're genuinely free for experimentation. The paid models mirror the upstream provider's pricing closely, making OpenRouter a near-zero-overhead convenience layer. For OpenClaw specifically, OpenRouter works as an openai-completions provider. You configure it with your OpenRouter API key and reference models using the provider/model format (e.g., anthropic/claude-sonnet-4-5). It's particularly useful if you want to test multiple providers without committing to any single one, or if you want a fallback layer that can route to whatever's available.

Tags: gateway, unified-api, multi-provider, openai-compatible

Use Cases

  • Model comparison and evaluation — test Claude vs GPT vs Gemini vs open-source with a single API key
  • Backup/fallback provider when your primary provider is down or rate-limited
  • Budget-conscious experimentation with free model tier
  • Multi-model agent setups where different tasks route to different providers
  • Quick onboarding for new OpenClaw users who want to try everything before committing

Tips

  • Use OpenRouter for experimentation and model comparison. Once you find your preferred model, consider switching to the direct provider for lower cost.
  • Set up credit alerts to avoid running out mid-workflow. OpenRouter doesn't auto-charge.
  • Use the /models endpoint to discover available models and their current pricing programmatically.
  • For OpenClaw, prefix model IDs with 'openrouter/' — e.g., openrouter/anthropic/claude-sonnet-4-5.
  • Free models are great for heartbeats and low-priority cron jobs where occasional queuing is acceptable.

Known Issues & Gotchas

  • OpenRouter takes a markup on top-ups — typically included in listed per-model pricing but not always transparent. Check model pricing carefully.
  • Free models have significantly lower rate limits and may queue during peak demand. Not reliable for production agent use.
  • Some models may have different behavior through OpenRouter vs direct API — especially around streaming, tool use, and thinking tokens.
  • Credit balances don't expire but the minimum top-up is $5. No auto-billing — you need to manually top up when credits run low.
  • Model availability can change without notice if an upstream provider has issues. Your agent may fail mid-conversation if a model goes offline.
  • OpenRouter uses the OpenAI completions format, not Anthropic Messages — some Claude-specific features (like explicit cache_control) may not work.

Alternatives

  • Direct Provider APIs
  • LiteLLM
  • Vercel AI Gateway
  • Cloudflare AI Gateway

Community Feedback

Pros: only have to top up in one place. Huge selection. A few free options. Cons: When you top up they take a percentage off the top.

— Reddit r/openrouter

Is there any good open source replacement for OpenRouter? Everything points to it, but I was surprised there is no open source version.

— Reddit r/openrouter

OpenRouter is great for testing models you haven't committed to yet. One API key to rule them all. The markup is worth it for the convenience.

— Reddit r/ClaudeCode

Configuration Examples

Basic OpenRouter setup

providers:
  openrouter:
    apiKey: sk-or-v1-xxxxx
    model: openrouter/anthropic/claude-sonnet-4-5

OpenRouter with free model for cron

providers:
  openrouter:
    apiKey: sk-or-v1-xxxxx
    model: openrouter/anthropic/claude-sonnet-4-5
    # For cron/heartbeats, override with:
    # /model openrouter/meta-llama/llama-3.3-70b-instruct:free

OpenRouter as fallback provider

providers:
  anthropic:
    apiKey: sk-ant-xxxxx
    model: anthropic/claude-sonnet-4-6
  openrouter:
    apiKey: sk-or-v1-xxxxx
    model: openrouter/anthropic/claude-sonnet-4-5
    # Fallback when Anthropic is down