惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cloudbric
Cloudbric
T
Threat Research - Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
AWS News Blog
AWS News Blog
P
Privacy & Cybersecurity Law Blog
H
Help Net Security
云风的 BLOG
云风的 BLOG
G
GRAHAM CLULEY
Spread Privacy
Spread Privacy
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
Project Zero
Project Zero
Engineering at Meta
Engineering at Meta
P
Privacy International News Feed
Blog — PlanetScale
Blog — PlanetScale
Stack Overflow Blog
Stack Overflow Blog
M
MIT News - Artificial intelligence
The Register - Security
The Register - Security
Recorded Future
Recorded Future
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
Cisco Blogs
PCI Perspectives
PCI Perspectives
Recent Announcements
Recent Announcements
Martin Fowler
Martin Fowler
A
About on SuperTechFans
W
WeLiveSecurity
GbyAI
GbyAI
V
Vulnerabilities – Threatpost
The GitHub Blog
The GitHub Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Check Point Blog
Y
Y Combinator Blog
月光博客
月光博客
Scott Helme
Scott Helme
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
U
Unit 42
G
Google Developers Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Threatpost
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Google Online Security Blog
Google Online Security Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Cisco Talos Blog
Cisco Talos Blog
博客园 - 三生石上(FineUI控件)
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 司徒正美

OpenRouter Blog

Choosing the Optimal Image Input Detail Level in LLMs — OpenRouter Blog DeepSeek V4 Is Earning Agentic Token Share — OpenRouter Blog The Open Weight Models that Matter: June 2026 — OpenRouter Blog The OpenRouter MCP Server — OpenRouter Blog Introducing the Unified Image API — OpenRouter Blog The AI Governance Checklist That Maps to Your Stack — OpenRouter Blog Enforce AI Data Residency at the Routing Layer — OpenRouter Blog OpenRouter vs Portkey: Routing Network vs Control Plane — OpenRouter Blog OpenRouter vs LiteLLM: Managed vs Self-Hosted Gateway — OpenRouter Blog Connect OpenClaw to OpenRouter: One Key, Failover, Free Models — OpenRouter Blog Connect SillyTavern to OpenRouter: Setup, Models, Fixes — OpenRouter Blog A Robot is Sprinting Towards You: Do You Want it Running on Claude or Grok? Kilo Code + OpenRouter: Setup, Routing, and Free Models — OpenRouter Blog Codex CLI with OpenRouter: config.toml Setup and Models — OpenRouter Blog How to Use OpenRouter With Any Coding Agent or AI Tool — OpenRouter Blog Subagent: Let Your Model Delegate the Busywork — OpenRouter Blog Free LLM API in 2026: 13 Options Ranked and Compared — OpenRouter Blog How to Enforce Agentic AI Governance at the API Layer — OpenRouter Blog Keep Your Agent Running When Models Disappear — OpenRouter Blog Hermes Agent + OpenRouter: Setup, Model Choice & Routing Config — OpenRouter Blog Lowest-Cost LLM Inference: The Complete OpenRouter Guide — OpenRouter Blog How OpenRouter Model Routing Works: Providers, Fallbacks & Auto Router — OpenRouter Blog OpenRouter Failover: Provider Failover vs Model Fallbacks Explained — OpenRouter Blog Surpassing Frontier Performance with Fusion — OpenRouter Blog Dinner is Served — OpenRouter Blog LLM Gateway: What It Is and How to Choose One — OpenRouter Blog Advisor: Give Any Model a Lifeline to a Smarter One — OpenRouter Blog Gemini 2.5 Flash API - Pricing, Quickstart & Provider Comparison — OpenRouter Blog EU AI Act & Colorado ADMT Compliance: Human Oversight for AI Agents — OpenRouter Blog May Release Spotlight — OpenRouter Blog Guardrails: Protect your Agents, Data, and Costs — OpenRouter Blog OpenRouter Raises $113M Series B — OpenRouter Blog Human-in-the-Loop Tools for the Agent SDK — OpenRouter Blog Consistent Web Search and Fetch Across Every Model — OpenRouter Blog GPT-5.5 Price Increase: What It Actually Costs — OpenRouter Blog New Audio APIs for Speech and Transcription — OpenRouter Blog Response Caching: Zero Cost for Identical Requests — OpenRouter Blog April Release Spotlight — OpenRouter Blog Create OpenRouter Accounts via CLI with Stripe Projects — OpenRouter Blog Opus 4.7 Agent SDK: Building Multi-turn Agent Workflows on OpenRouter — OpenRouter Blog Build Your Own Harness with the Agent SDK — OpenRouter Blog Introducing Workspaces — OpenRouter Blog Announcing Video Generation — OpenRouter Blog Auto Exacto: Adaptive Quality Routing, On by Default — OpenRouter Blog February Release Spotlight — OpenRouter Blog OpenRouter Outages on February 17 and 19, 2026 — OpenRouter Blog January Release Spotlight — OpenRouter Blog Distillable Models and Synthetic Data Pipelines with NeMo Data Designer — OpenRouter Blog December Release Spotlight — OpenRouter Blog Response Healing: Reduce JSON Defects by 80%+ — OpenRouter Blog The 2025 State of AI Report — OpenRouter Blog Is Implicit Caching Prompt Retention? — OpenRouter Blog Provider Variance: Introducing Exacto — OpenRouter Blog 1 million free BYOK requests per month — OpenRouter Blog The First-Ever Image Model Is Up on OpenRouter — OpenRouter Blog GPT-5 is now live — OpenRouter Blog Audio Inputs and PDF URLs for Apps — OpenRouter Blog Presets: How To Seamlessly Transfer Model Configurations Across Apps — OpenRouter Blog New Privacy-Focused Provider Drop: Venice — OpenRouter Blog Use OpenRouter Models in Cursor: Try it with Moonshot AI Updates to Our Free Tier: Sustaining Accessible AI for Everyone — OpenRouter Blog New Stealth Model: "Cypher Alpha" — OpenRouter Blog Introducing Presets: Manage LLM Configs from Your Dashboard! — OpenRouter Blog Dev & BYOK Updates: Uptime API + Smarter Key Management — OpenRouter Blog Simplifying Our Platform Fee — OpenRouter Blog GIF Prompts, Omni Search, Tool Caching, and BYOK Flags — OpenRouter Blog New Features: Reasoning Streams, Crypto Invoices, End-User IDs & More — OpenRouter Blog Passkeys, DevEx Upgrades, and a New Guide for TypeScript Agents — OpenRouter Blog New Provider Drop: Cerebras Is Here — OpenRouter Blog Better Insights, Faster Metrics, and New Developer Power Tools — OpenRouter Blog Privacy Clarity, New Providers, OAuth Upgrade, and Gemini Gets Parallel Tools — OpenRouter Blog Universal PDF Support — OpenRouter Blog Smarter Charts, Inline SVGs, and Live Usage Accounting — OpenRouter Blog Quasar Alpha and Optimus Alpha Reveal — OpenRouter Blog "Stealth" model: Optimus Alpha — OpenRouter Blog “Stealth” model: Quasar Alpha — OpenRouter Blog Never Pay for Empty AI Responses Again — OpenRouter Blog Deep Research & Many New Models — OpenRouter Blog Introducing Nitro and Floor Price Shortcuts — OpenRouter Blog Introducing Cloudflare as a new provider — OpenRouter Blog Reasoning Tokens for Thinking Models — OpenRouter Blog Introducing Web Search via the API — OpenRouter Blog Standardized finish reasons — OpenRouter Blog Happy New Year! Introducing a new Auto Router — OpenRouter Blog Holiday launches: Web Search & Price Cuts — OpenRouter Blog Bring Your Own API Keys — OpenRouter Blog Crypto Payments API — OpenRouter Blog Structured Outputs & Free Gemini Flash 2.0 — OpenRouter Blog Price Drops and Llama 3.3 70b — OpenRouter Blog Author Pages & Amazon Nova — OpenRouter Blog
Claude Code with OpenRouter: Setup, Models, and Costs — OpenRouter Blog
OpenRouter · 2026-06-17 · via OpenRouter Blog

You’re deep into a refactor. Claude Code has pulled context across a dozen files, planned the diff, and started executing. Then the session stops on a rate limit, 70% of the way through.

Routing Claude Code through OpenRouter is how you keep that session alive. OpenRouter sits between Claude Code and Anthropic’s API as a reliability and management layer. It adds provider failover, budget controls, and usage visibility, and it does that with no local proxy to run. The setup is three environment variables. This covers that setup, model routing, Fast Mode, and the cost math.

The team case is just as practical. Several developers running Claude Code at once means several Anthropic accounts, no shared spend view, and no per-developer cap until the invoice lands. One OpenRouter key fronts all of it: shared billing, per-key limits, and an Activity dashboard that shows cost per session.

Connect Claude Code in three steps

The whole setup is three environment variables, documented in the Claude Code integration guide, with no proxy, no Docker, and no local port to run.

# Add to ~/.zshrc or ~/.bashrc
export OPENROUTER_API_KEY="<your-openrouter-api-key>"
export ANTHROPIC_BASE_URL="https://openrouter.ai/api"
export ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY"
export ANTHROPIC_API_KEY=""   # must be explicitly empty

Three things to get right. The base URL is https://openrouter.ai/api. The auth token is your OpenRouter key, which starts with sk-or-. And ANTHROPIC_API_KEY has to be an empty string, not unset, or Claude Code can fall back to authenticating against Anthropic directly.

Prefer to scope it to one project? Put the same three values under an env block in .claude/settings.local.json at the project root. Don’t use a plain .env file, since the native installer doesn’t read one.

If you logged in to Claude Code with an Anthropic account before, run /logout once and relaunch, otherwise the cached login overrides your variables and you get confusing model-not-found errors. Confirm the switch with /status:

> /status
Auth token: ANTHROPIC_AUTH_TOKEN
Anthropic base URL: https://openrouter.ai/api

Your request should also show up in the Activity dashboard within seconds.

How the Anthropic Skin works without a proxy

OpenRouter exposes an endpoint compatible with the Anthropic Messages API, which it calls the Anthropic Skin. Claude Code speaks its native protocol straight to OpenRouter, and the Skin handles model mapping and passes advanced features through untouched.

That means Thinking blocks, native tool use, streaming, and multi-turn context all work as they do against Anthropic directly. Older setups leaned on a local proxy like claude-code-router to translate requests, which meant a Node.js runtime, a local port, and a translation layer to keep healthy. Native routing drops that whole tier for Anthropic workflows.

Underneath, OpenRouter load-balances across the Anthropic providers serving a model. If the one it tries first is rate-limiting you, it routes the same model to another provider that serves it, and you pay only for the call that lands. For a multi-step agentic task that holds state across many calls, that failover happening below Claude Code is the difference between a finished task and a half-applied edit.

Route each task class to the right model

Claude Code splits work across model slots. Override each one to point at a specific model on OpenRouter. The ~author/model-latest aliases always resolve to the newest version in a family, so they don’t go stale:

export ANTHROPIC_DEFAULT_OPUS_MODEL="~anthropic/claude-opus-latest"
export ANTHROPIC_DEFAULT_SONNET_MODEL="~anthropic/claude-sonnet-latest"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="~anthropic/claude-haiku-latest"
export CLAUDE_CODE_SUBAGENT_MODEL="~anthropic/claude-opus-latest"

A reasonable split: Opus for architecture and deep reasoning, Sonnet for everyday coding, Haiku for quick transformations and classification. Put these in the same shell profile or project settings file as the base URL and token.

Keep the models Anthropic, though. Claude Code is built around Anthropic request semantics, and the integration is only guaranteed to work with the Anthropic first-party provider. For maximum compatibility, set Anthropic 1P as your top-priority provider.

Fast Mode for Opus sessions

Anthropic’s Fast Mode delivers up to 2.5x faster output at premium pricing, served only by the Anthropic first-party provider. It applies to Claude Opus 4.6, 4.7, and 4.8, and no other models.

Claude Code has a built-in /fast toggle. When it’s on, Claude Code sends speed: "fast" alongside the configured Opus model, and OpenRouter reroutes to the matching -fast variant. To use it, set one variable:

export CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK=1

This needs Claude Code v2.1.96 or newer. Send speed: "fast" to a model that doesn’t support it and OpenRouter just drops the parameter, so the request runs at standard speed and price. Reach for it on interactive sessions and live debugging, where latency is the thing you feel. Check the pricing page for current Opus rates before turning it on for production.

What it costs, and the free tier

OpenRouter doesn’t mark up token pricing. You pay the same per-token rate the provider charges, shown in the model catalog, and credit purchases carry a 5.5% fee with a $0.80 minimum.

The fee is small against real usage. Take 10M tokens a month on Claude Sonnet 4.5 at an 80/20 input/output split. At $3 per million input and $15 per million output, that’s about $54 in direct token cost, and the 5.5% credit fee adds roughly $3. For that you get failover, per-key budget caps, and one billing view across the team.

There’s also a free tier for trying things. Free models run at up to 50 requests a day, rising to 1,000 a day once you add $10 in credits. They carry smaller context windows than paid Anthropic models, so they’re good for learning Claude Code’s workflow, not for production sessions. Watch spend live in the Activity dashboard, the fastest way to catch a session routed to a heavier model than the task needs.

Wire it into CI and your terminal

The same routing works beyond your local shell.

For CI, the official Claude Code GitHub Action needs two changes: pass your OpenRouter key through anthropic_api_key, and set the base URL in the step’s env.

- name: Run Claude Code
  uses: anthropics/claude-code-action@v1
  with:
    anthropic_api_key: ${{ secrets.OPENROUTER_API_KEY }}
  env:
    ANTHROPIC_BASE_URL: https://openrouter.ai/api

For live cost in your terminal, the openrouter-examples repository ships a statusline script that shows provider, model, running cost, and cache discount. Point your ~/.claude/settings.json at it:

{
  "statusLine": {
    "type": "command",
    "command": "/path/to/statusline.sh"
  }
}

Building agents on top of Claude Code? The Anthropic Agent SDK uses the Claude Code runtime, so the same three environment variables route its requests through OpenRouter with no extra config.

Frequently asked questions

Do I need an Anthropic subscription to use Claude Code with OpenRouter?

No. Requests route through your OpenRouter credits, so you need an OpenRouter account and an API key, not an Anthropic plan. If you previously logged in to Claude Code with an Anthropic account, run /logout once to clear the cached session before switching.

Can I use non-Anthropic models with Claude Code through OpenRouter?

The native integration is built for Anthropic models and is only guaranteed to work with the Anthropic first-party provider. Claude Code expects Anthropic request semantics, so non-Anthropic models aren’t supported through the native endpoint.

How much does Claude Code cost through OpenRouter?

You pay the provider’s per-token rate plus a 5.5% fee on credit purchases, with a $0.80 minimum. Inference itself stays at provider rates. The Activity dashboard shows exact per-session cost in real time.

Does OpenRouter log my source code?

No. By default OpenRouter retains only metadata like token counts, not your prompts or completions. Logging your own inputs and outputs is opt-in, and a separate opt-in lets OpenRouter use your data to improve the product for a 1% usage discount. See the Privacy Policy for the terms.

What is Fast Mode and which models support it?

Fast Mode runs up to 2.5x faster output at premium pricing, served by the Anthropic first-party provider. It’s available only on Claude Opus 4.6, 4.7, and 4.8. Toggle it with /fast inside Claude Code.

What happens if Anthropic’s API is rate-limiting me?

OpenRouter fails over to another Anthropic provider serving the same model, so the session keeps running without reconnecting. You pay the rate for whichever provider actually served the request.