跳到正文
原文
OpenRouter:Blog(Announcements)·· 2026-08-04AI 评分29

OpenRouter 发布 ori CLI,为 Claude Code 等 Agent 工具生成开箱即用配置

Ori Harness: The Best Way to Use OpenRouter with Any Harness

文章要点
  • 1OpenRouter 发布 ori CLI,为 Claude Code、Codex、OpenCode、Hermes 提供开箱即用配置
  • 2此前经 OpenRouter 网关使用 Claude Code 需手动设置十余个环境变量才能接近第一方体验
  • 3官方称开启 tool search 可为 Anthropic 模型省近一半系统提示词 token,多数开源模型尚不支持
  • 4ori 会按 --model 参数自动切换最优设置,后续计划加入用量工具栏与 WebSearch 插件
决策要点

OpenRouter 把网关接入 Agent 工具的配置成本做成了产品,第三方网关与第一方体验的差距正在成为竞争点。

  • 影响:经网关使用 Claude Code 的团队若配置不当,token 消耗和任务轮数会高于第一方默认体验;多数开源模型不支持 tool search,换模型会带来成本与行为差异。
  • 参考:可考虑选一个在用 Claude Code 的项目试点 ori,对比手工维护环境变量的成本;值得盘点团队在用的 Agent 编程工具和模型组合,再决定是否统一走网关接入。
  • 依据:均来自 OpenRouter 官方博客,token 节省效果为官方口径,暂无独立验证;支持的工具清单与未来计划以官方说明为准。
正文

We often see folks trying to use OpenRouter with their favorite harnesses resort to writing ad-hoc scripts or complex config to tweak them to fit just right. Some harnesses require minimal configuration, maybe just one environment variable, but others like Claude Code require many more.

You can now install the ori CLI, log in with OpenRouter, and immediately have an optimized configuration right out of the box that works with all your favorite harnesses:

# Install ori cli
curl -fsSL https://openrouter.ai/labs/ori/install.sh | bash

ori login # Log in to OpenRouter

# Set up and optimized for OpenRouter
ori claude
ori codex
ori opencode
ori hermes
# ... more to come

Why do I need this if I can just change a few settings?

When using a gateway like OpenRouter, to get the same out-of-the-box experience with Claude Code as you get using Anthropic’s first-party harness, there’s a lot of environment variables you need to set…

ANTHROPIC_BASE_URL=https://openrouter.ai/api
ANTHROPIC_AUTH_TOKEN=<openrouter-api-key>
ANTHROPIC_API_KEY=
OPENROUTER_API_KEY=<openrouter-api-key>
CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK=1
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1
ENABLE_TOOL_SEARCH=true
CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=1
ANTHROPIC_DEFAULT_HAIKU_MODEL=~anthropic/claude-haiku-latest
ANTHROPIC_DEFAULT_SONNET_MODEL=~anthropic/claude-sonnet-latest
ANTHROPIC_DEFAULT_OPUS_MODEL=~anthropic/claude-opus-latest
ANTHROPIC_DEFAULT_FABLE_MODEL=~anthropic/claude-fable-latest[1m]
ANTHROPIC_DEFAULT_FABLE_MODEL_NAME=Fable

For Anthropic models, enabling ENABLE_TOOL_SEARCH will save you almost half the system prompt in tokens, and is the default setting on modern Claude models… when Claude Code detects the first-party harness.

Tool search meaningfully changes the agent’s behavior as well: when tool search is disabled, Claude uses more tokens, more turns to accomplish the same task, and uses the Todo tool more!

However, most open models today do not support tool search at all. In ori claude, we detect your --model flag and switch the settings to be most optimal for the model you’re using. In the future, we plan to take this further and optimize tool settings, system prompt verbosity, and more depending on the model.

That’s it

Claude Code is a particularly tricky example, but we’ll be optimizing ori harness for many harnesses. Today we support:

  • Claude Code
  • Codex
  • OpenCode
  • Hermes

Please give it a try!

Some future plans and ideas:

  • Better support desktop apps
  • A toolbar widget to track your usage, and toggle global switching to OpenRouter
  • Including WebSearch plugins out of the box for harnesses like OpenCode and Pi

If any of those sound appealing, or if you have feedback on a harness you’d like us to support, please join the Discord and leave us a note in the #ori-feedback channel.

来源:OpenRouter:Blog(Announcements) · openrouter.ai