Back to Newsroom

Claude Code Can Connect to OpenRouter Directly — No CCR Proxy Required

By Modelverse Editorial·August 23, 2026·5 min read
Claude Code Can Connect to OpenRouter Directly — No CCR Proxy Required

Claude Code users who have been relying on claude-code-router (CCR) to reach alternative models now have a simpler path: OpenRouter can accept Claude Code''s native Anthropic-format traffic directly.

OpenRouter calls the compatibility layer its “Anthropic Skin.” Instead of placing a local translation proxy between Claude Code and the backend, Claude Code can point its Anthropic base URL at OpenRouter and send native Messages API requests straight to the gateway. The practical upside is fewer moving parts: no CCR process, no local proxy port, and no request transformer sitting between Claude Code and newer model capabilities.

The direct setup

OpenRouter''s current Claude Code documentation uses this configuration:

export OPENROUTER_API_KEY="<your-openrouter-api-key>"
export ANTHROPIC_BASE_URL="https://openrouter.ai/api"
export ANTHROPIC_API_KEY="$OPENROUTER_API_KEY"
export ANTHROPIC_AUTH_TOKEN=""
export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1

claude

That last auth detail matters. Earlier community configurations sometimes put the OpenRouter key in ANTHROPIC_AUTH_TOKEN, but OpenRouter''s current official Claude Code guide specifies the reverse: use the OpenRouter key as ANTHROPIC_API_KEY and explicitly leave ANTHROPIC_AUTH_TOKEN empty to avoid credential conflicts.

For project-scoped configuration, OpenRouter documents the same approach through .claude/settings.local.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://openrouter.ai/api",
    "ANTHROPIC_API_KEY": "<your-openrouter-api-key>",
    "ANTHROPIC_AUTH_TOKEN": "",
    "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
  }
}

Do not put the secret in a committed repository settings file. settings.local.json, shell keychains, or another secrets mechanism are safer choices.

Why this can be cleaner than CCR

CCR is useful when a workflow genuinely needs local routing and protocol transformation. But every compatibility layer can become a source of drift when a new model introduces behavior the transformer does not yet understand.

With OpenRouter''s Anthropic-compatible endpoint, Claude Code keeps speaking its native protocol. OpenRouter handles the gateway side, including model mapping and advanced request features such as thinking blocks and native tool use. That means there is no separate CCR transformer to debug when a newly released model behaves differently.

The direct path also removes operational friction: there is no local proxy to start, monitor, restart, or accidentally leave pointing at stale configuration.

Model discovery and routing

Setting CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 enables OpenRouter''s gateway model picker. Claude Code can then discover a curated selection of models through OpenRouter.

Specific model classes can also be pinned with environment variables such as ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL, and ANTHROPIC_DEFAULT_FABLE_MODEL. OpenRouter supports ~provider/model-latest aliases for model families where appropriate.

There is an important compatibility boundary, however: OpenRouter''s documentation says Claude Code compatibility is only guaranteed with Anthropic''s first-party provider. Other models can be exposed through the gateway, but tool behavior and other Claude Code assumptions may not be equally reliable. For maximum compatibility, Anthropic''s first-party provider should be prioritized.

How to verify the connection

Start a fresh Claude Code session and run:

/status

A successful configuration should show the OpenRouter base URL:

Anthropic base URL: https://openrouter.ai/api

If you previously logged into Claude Code directly with an Anthropic account, OpenRouter also recommends running /logout once to clear the cached login before restarting Claude Code. A stale direct-Anthropic session can conflict with the environment-based OpenRouter configuration.

You can then use /model to inspect available model classes and check the OpenRouter Activity Dashboard to confirm requests are arriving through the gateway.

Billing and trade-offs

Requests sent through this setup consume OpenRouter credits, with usage visible in OpenRouter''s activity and analytics tools. That includes reasoning-related usage reported by the routed request.

CCR still has a place when you specifically want elaborate local routing policies or proxy-level behavior. But for the simpler goal — connecting Claude Code to OpenRouter without adding another translation layer — the native Anthropic-compatible endpoint is the cleaner setup.

Bottom line

The key distinction is straightforward: Claude Code no longer needs a CCR proxy just to speak to OpenRouter. Point ANTHROPIC_BASE_URL at https://openrouter.ai/api, provide the OpenRouter key using the configuration in OpenRouter''s current official guide, clear conflicting cached authentication if necessary, and launch claude.

For new models where a third-party transformer may lag behind protocol changes, keeping the request path native from Claude Code to OpenRouter can eliminate an entire class of compatibility problems.

Share this article

Found this insightful? Share it with your community on Reddit, X, or copy the link.

ai-newsclaude-codeopenroutercoding-agentsanthropic-apideveloper-tools

Related content

Building an End-to-End Document Intelligence Pipeline with deepDoctection

Build an end-to-end document intelligence pipeline with deepDoctection. This tutorial covers configuring layout analysis, DocTR OCR, and table extraction, while demonstrating how t...

Read article

Vercel Introduces 'Is Agentic', a Free Agent-Readiness Scoring Tool That Audits Public Websites Using Ora's 100+ Checks

Vercel and Ora launched Is Agentic, a free audit scoring website readiness for AI agents across 118 checks. The post Vercel Introduces 'Is Agentic', a Free Agent-Readiness Scoring ...

Read article

Ox Alpha Lands on OpenRouter as a Free 1M-Context Stealth Model for Coding and Agentic Work

Ox Alpha is a new anonymous reasoning model on OpenRouter with a 1M-token context window, multimodal inputs, tool calling and free preview pricing — aimed at coding and long-running AI agents.

Read article