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

推荐订阅源

U
Unit 42
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
S
Secure Thoughts
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News | PayPal Newsroom
Application and Cybersecurity Blog
Application and Cybersecurity Blog
O
OpenAI News
S
Security @ Cisco Blogs
宝玉的分享
宝玉的分享
Hacker News: Ask HN
Hacker News: Ask HN
T
Troy Hunt's Blog
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
TaoSecurity Blog
TaoSecurity Blog
Help Net Security
Help Net Security
Latest news
Latest news
NISL@THU
NISL@THU
S
Security Affairs
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 聂微东
AI
AI
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
小众软件
小众软件
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
AWS News Blog
AWS News Blog
W
WeLiveSecurity
Google DeepMind News
Google DeepMind News
I
InfoQ
Schneier on Security
Schneier on Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
The Exploit Database - CXSecurity.com
IT之家
IT之家
T
Threatpost
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
腾讯CDC
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
News and Events Feed by Topic
L
LINUX DO - 最新话题
F
Full Disclosure
大猫的无限游戏
大猫的无限游戏
H
Heimdal Security Blog
S
SegmentFault 最新的问题

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 Claude Code with OpenRouter: Setup, Models, and Costs — 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
Codex CLI with OpenRouter: config.toml Setup and Models — OpenRouter Blog
OpenRouter · 2026-06-17 · via OpenRouter Blog

Codex CLI runs an agentic coding loop in your terminal, and it already supports custom OpenAI-compatible providers. That hook is all you need to route it through OpenRouter.

The payoff is one API key in front of 300+ models, automatic provider failover, and consolidated usage tracking, with no change to Codex itself. The setup is a small config.toml block, but Codex has two requirements that trip people up if you miss them. This walks through the full setup and the two errors you’re most likely to hit.

Point Codex at OpenRouter in five steps

Install Codex CLI from the openai/codex repo, then create a key on your API Keys page. It starts with sk-or-.

Open ~/.codex/config.toml, creating it if it doesn’t exist, and add this:

# ~/.codex/config.toml
model = "openai/gpt-5.3-codex"
model_provider = "openrouter"
model_reasoning_effort = "high"

[model_providers.openrouter]
name = "OpenRouter"
base_url = "https://openrouter.ai/api/v1"
env_key = "OPENROUTER_API_KEY"
wire_api = "responses"

Two fields need attention. model must be a complete OpenRouter slug including the provider prefix, copied from the models page. And wire_api must be "responses", which we get to below.

One more placement rule: model_provider and model_providers only take effect in your user-level ~/.codex/config.toml. Codex ignores them in a project-local .codex/config.toml and prints a startup warning.

Then export your key in the shell profile Codex loads, run codex in a project, and send a test prompt:

export OPENROUTER_API_KEY="sk-or-..."
cd /path/to/your/project
codex

Open the Activity dashboard and confirm the request shows up with the right model name and a token count. If it does, you’re routed.

Set wire_api to responses

Codex used to speak the older chat/completions protocol, but OpenAI deprecated that path and removed it in February 2026. A custom provider with wire_api = "chat", or with no wire_api at all, now fails on startup.

Setting wire_api = "responses" puts Codex on the Responses API, which is what OpenRouter expects. The config block above already includes it. One related gotcha: the provider IDs openai, ollama, and lmstudio are reserved, so you can’t reach OpenRouter by overriding the built-in openai provider’s base URL. Define a new provider like openrouter instead.

Pin a Codex model and watch the spend

Codex models on OpenRouter share a 400K context window, so the choice comes down to price against task difficulty. Current rates from the model catalog, before the platform fee:

OpenRouter slugInput $/MOutput $/M
openai/gpt-5.3-codex$1.75$14
openai/gpt-5.1-codex$1.25$10
openai/gpt-5.1-codex-mini$0.25$2

Reach for gpt-5.1-codex-mini on iterative or exploratory work, and gpt-5.3-codex on the hardest tasks. You can also point model at any non-Codex slug, say anthropic/claude-sonnet-4.6, without touching anything else.

Agentic sessions burn more tokens than a prompt’s length suggests, because the model reprocesses repo files, tool outputs, and reasoning traces on every turn. Three controls keep that predictable. Set a spending guardrail on the key so requests are rejected once you hit a daily or monthly cap. Match the model to the task, since gpt-5.3-codex costs 7x more per output token than gpt-5.1-codex-mini. And drop model_reasoning_effort to "low" or "medium" on routine edits.

The fee math is light. OpenRouter doesn’t mark up provider pricing, so you pay the rates above plus a 5.5% fee on credit purchases. A focused session that reads 200K input tokens and writes 50K output on gpt-5.3-codex runs about $1.05 in token cost, and the credit fee adds about 6 cents. Failed requests aren’t billed.

Fix model_not_found

model_not_found is the other common error. Work through these in order:

  • The slug isn’t exact. It has to match an OpenRouter slug character for character. Copy it straight from openrouter.ai/models.
  • The prefix is missing. Codex slugs look like openai/gpt-5.3-codex. The openai/ prefix is required; gpt-5.3-codex alone won’t match.
  • The shorthand points elsewhere. The ~openai/gpt-latest alias tracks OpenAI’s latest general model, which may not be the Codex variant you want, so pin a Codex slug explicitly.
  • The config is in the wrong file. Move model_provider and model_providers to your user-level ~/.codex/config.toml.

When routing through OpenRouter pays off

OpenRouter earns its place in a Codex workflow when you want to switch quickly between many models, try open-source models alongside the OpenAI defaults, get failover across 70+ providers, see real-time usage visibility, or set team cost controls from one dashboard. Switching models is a one-line change to model in config.toml, with no new key and no reinstall. You can also run BYOK, routing through your own provider key for 5% of what the provider would bill, a fee waived for the first 1M requests each month.

Frequently asked questions

Can Codex CLI be used with OpenRouter?

Yes. Add a [model_providers.openrouter] block in your user-level ~/.codex/config.toml, point base_url at https://openrouter.ai/api/v1, set model_provider = "openrouter" and wire_api = "responses", then pin a model slug. Codex routes through OpenRouter from that point on.

Why do I get model_not_found with Codex and OpenRouter?

The model value has to be an exact OpenRouter slug including the provider prefix, like openai/gpt-5.3-codex. A bare gpt-5.3-codex is the most common cause. The provider block also has to live in your user-level ~/.codex/config.toml, not a project-local one.

Do I need an OpenAI subscription to use Codex CLI through OpenRouter?

No. Once you configure the custom provider and export OPENROUTER_API_KEY, requests route through and bill on OpenRouter. No separate OpenAI plan is required.

How much does Codex cost through OpenRouter?

You pay the provider’s per-token rate plus a 5.5% fee on credit purchases, with no provider markup. For example, gpt-5.3-codex is $1.75 per million input tokens and $14 per million output tokens before that fee. Failed requests aren’t billed.

What is wire_api and why does it need to be set?

wire_api controls which API protocol Codex uses to talk to a provider. As of February 2026, Codex removed support for the older chat value, so custom providers must set wire_api = "responses" or Codex errors on startup.