openroutera-setup
v2.1.0
Published
One-click setup for all AI coding tools to connect to OpenRouterA API gateway (https://openroutera.com). Supports Claude Code, Crush, Goose, OpenClaw, Hermes Agent, Cline, RooCode, Kilocode, and Cursor.
Maintainers
Readme
OpenRouterA Setup
✨ One-click configuration for all AI coding tools to connect to the OpenRouterA API gateway, supporting 9 mainstream AI coding assistants on the market.
🌐 English Documentation
Official Website
https://openroutera.com
✨ Features
- 🚀 One-click setup: No need to manually modify multiple configuration files, complete all tool configurations with one command
- 🔧 Multi-tool support: Covers 9 mainstream AI coding assistants, including CLI tools, VS Code extensions, and standalone IDEs
- 🌍 Dual scope support: Supports global configuration and single-project configuration, flexibly adapting to different usage scenarios
- 📝 Smart configuration generation: Automatically identifies the configuration file format and path of each tool, generates compliant configurations
- 🔒 Secure and non-intrusive: Does not overwrite existing configurations, only merges and adds OpenRouterA-related configurations
🛠️ Supported Tools List
【Fully automatic configuration, no manual operation required】
| Tool Name | Type | Configuration File Path |
|---------|------|-------------|
| Claude Code | Official Anthropic CLI Tool | Global: ~/.claude/settings.jsonProject: ./.claude/settings.json |
| Crush | Charmbracelet coding assistant (official successor to OpenCode) | Global: ~/.config/crush/crush.jsonProject: ./.crush.json |
| Goose | AI coding agent by Block | Global: ~/.config/goose/profiles.yamlProject: ./.goose.yaml |
| OpenClaw | Personal AI assistant — any OS, any platform (the lobster way) | Global: ~/.openclaw/openclaw.jsonProject: ./openclaw.config.json |
| Hermes Agent | Self-improving AI agent by Nous Research | Global: ~/.hermes/config.yaml + ~/.hermes/.envProject: ./.hermes/config.yaml + ./.hermes/.env |
【Detailed manual configuration instructions provided】
| Tool Name | Type | Configuration Method | |---------|------|---------| | Cline | VS Code AI Extension (saoudrizwan.claude-dev) | Manual configuration in extension settings panel | | RooCode | VS Code AI Extension (rooveterinaryinc.roo-code) | Manual configuration in extension settings panel | | Kilocode | VS Code AI Extension (kilocode.kilo-code) | Manual configuration in extension settings panel | | Cursor | Standalone AI Code Editor | Manual configuration in IDE settings panel |
🚀 Quick Start
Method 1: One-click run (Recommended, no installation required)
npx openroutera-setupMethod 2: Use after global installation
# Global installation
npm install -g openroutera-setup
# Run configuration
openroutera-setup⚙️ Configuration Options
npx openroutera-setup [options]| Parameter | Description | Default Value |
|------|------|--------|
| --key=KEY | OpenRouterA API Key (sk-xxx) | Interactive input |
| --scope=SCOPE | Configuration scope: global or project | global |
| --haiku=MODEL | Haiku/lightweight model name | glm-4.7 |
| --sonnet=MODEL | Sonnet/balanced model name | glm-4.7 |
| --opus=MODEL | Opus/high-performance model name | glm-5.1 |
| --tool=TOOL | Specify tool to configure: claude-code, crush, goose, openclaw, hermes, cline, roocode, kilocode, cursor, all | Interactive selection |
| -h, --help | Show help information | - |
Non-interactive batch configuration example
# One-click configuration of all tools supporting automatic configuration (global scope)
npx openroutera-setup \
--key=sk-your-openroutera-api-key \
--tool=all \
--scope=global \
--haiku=glm-4.7 \
--sonnet=glm-4.7 \
--opus=glm-5.1📋 Supported Models
OpenRouterA API gateway supports a wide range of mainstream large language models, you can choose the appropriate model according to your needs:
- MiniMax-M2.5: High-performance general-purpose model by MiniMax
- deepseek-v3.2: Latest coding-optimized model by DeepSeek
- doubao-seed-2.0-code: ByteDance Doubao series coding-specific model
- doubao-seed-2.0-lite: Lightweight fast-response model in Doubao Seed 2.0 series
- doubao-seed-2.0-pro: High-performance flagship model in Doubao Seed 2.0 series
- doubao-seed-code: Classic coding-optimized model in Doubao Seed series
- glm-4.7: Balanced general-purpose model by Zhipu AI
- glm-5-turbo: High-speed inference model in GLM-5 series
- glm-5.1: Flagship high-performance model in GLM-5 series
- kimi-k2.5: Latest generation model by Moonshot AI
📝 Configuration Description
Claude Code
After configuration, Claude Code will automatically use OpenRouterA as the API gateway, no additional settings required. Configuration includes:
- API base URL:
https://openroutera.com - API Key: The key you entered
- Timeout: 300 seconds
- Default model configuration: Haiku, Sonnet, Opus correspond to the models you selected
Crush
A custom provider named openroutera will be added to the configuration and set as the default provider. Includes 3 common model configurations, just select and use directly in Crush.
Goose
A configuration profile named openroutera will be added, using the model you configured by default. Needs to be used with environment variables:
export ANTHROPIC_API_KEY=sk-your-api-key
export ANTHROPIC_BASE_URL=https://openroutera.comOpenClaw
A custom provider named openroutera will be added to ~/.openclaw/openclaw.json, configured with the Anthropic Messages API. The API key is stored in ~/.openclaw/.env. OpenClaw will use the Sonnet model as default.
Hermes Agent
The Anthropic API key and base URL will be written to ~/.hermes/.env, routing all Anthropic calls through OpenRouterA. If no existing config.yaml is found, the model will be set automatically. Otherwise, run:
hermes config set model anthropic/your-model-nameVS Code Extensions (Cline/RooCode/Kilocode)
Follow the steps prompted by the tool to manually add an OpenAI-compatible provider in the extension settings:
- Name: OpenRouterA
- Base URL:
https://openroutera.com - API Key: Your OpenRouterA key
- Model: The model name you selected
Cursor
Add a custom OpenAI model in Cursor settings, enter your API Key and model name to use.
🌐 中文文档 | Chinese Documentation
官网
https://openroutera.com
✨ 功能特性
- 🚀 一键配置:无需手动修改多个配置文件,一行命令完成所有工具配置
- 🔧 多工具支持:覆盖9种主流AI编码助手,包括CLI工具、VS Code扩展、独立IDE
- 🌍 双作用域支持:支持全局配置和单项目配置,灵活适配不同使用场景
- 📝 智能配置生成:自动识别各工具的配置文件格式和路径,生成符合规范的配置
- 🔒 安全无侵入:不会覆盖原有配置,只会合并新增OpenRouterA相关配置
🛠️ 支持的工具列表
【全自动配置,无需手动操作】
| 工具名称 | 类型 | 配置文件路径 |
|---------|------|-------------|
| Claude Code | 官方 Anthropic CLI 工具 | 全局:~/.claude/settings.json项目:./.claude/settings.json |
| Crush | Charmbracelet 编码助手(OpenCode 官方继任者) | 全局:~/.config/crush/crush.json项目:./.crush.json |
| Goose | Block 出品的 AI 编码代理 | 全局:~/.config/goose/profiles.yaml项目:./.goose.yaml |
| OpenClaw | 个人 AI 助手 — 全平台支持 (the lobster way) | 全局:~/.openclaw/openclaw.json项目:./openclaw.config.json |
| Hermes Agent | Nous Research 出品的自我改进 AI 代理 | 全局:~/.hermes/config.yaml + ~/.hermes/.env项目:./.hermes/config.yaml + ./.hermes/.env |
【提供详细手动配置说明】
| 工具名称 | 类型 | 配置方式 | |---------|------|---------| | Cline | VS Code AI 扩展(saoudrizwan.claude-dev) | 扩展设置面板手动配置 | | RooCode | VS Code AI 扩展(rooveterinaryinc.roo-code) | 扩展设置面板手动配置 | | Kilocode | VS Code AI 扩展(kilocode.kilo-code) | 扩展设置面板手动配置 | | Cursor | 独立 AI 代码编辑器 | IDE 设置面板手动配置 |
🚀 快速开始
方式1:一键运行(推荐,无需安装)
npx openroutera-setup方式2:全局安装后使用
# 全局安装
npm install -g openroutera-setup
# 运行配置
openroutera-setup⚙️ 配置选项
npx openroutera-setup [options]| 参数 | 说明 | 默认值 |
|------|------|--------|
| --key=KEY | OpenRouterA API Key(sk-xxx) | 交互式输入 |
| --scope=SCOPE | 配置作用域:global(全局)或 project(当前项目) | global |
| --haiku=MODEL | Haiku/轻量模型名称 | glm-4.7 |
| --sonnet=MODEL | Sonnet/平衡模型名称 | glm-4.7 |
| --opus=MODEL | Opus/高性能模型名称 | glm-5.1 |
| --tool=TOOL | 指定要配置的工具:claude-code、crush、goose、openclaw、hermes、cline、roocode、kilocode、cursor、all | 交互式选择 |
| -h, --help | 显示帮助信息 | - |
非交互式批量配置示例
# 一键配置所有支持自动配置的工具(全局作用域)
npx openroutera-setup \
--key=sk-your-openroutera-api-key \
--tool=all \
--scope=global \
--haiku=glm-4.7 \
--sonnet=glm-4.7 \
--opus=glm-5.1📋 支持的模型列表
OpenRouterA API网关支持丰富的主流大语言模型,您可以根据需求选择合适的模型:
- MiniMax-M2.5: MiniMax出品的高性能通用模型
- deepseek-v3.2: DeepSeek最新的代码优化模型
- doubao-seed-2.0-code: 字节跳动豆包系列代码专用模型
- doubao-seed-2.0-lite: 豆包Seed 2.0系列轻量快速响应模型
- doubao-seed-2.0-pro: 豆包Seed 2.0系列高性能旗舰模型
- doubao-seed-code: 豆包Seed系列经典代码优化模型
- glm-4.7: 智谱AI出品的平衡型通用模型
- glm-5-turbo: GLM-5系列高速推理模型
- glm-5.1: GLM-5系列旗舰高性能模型
- kimi-k2.5: 月之暗面最新一代模型
📝 配置说明
Claude Code
配置完成后,Claude Code 会自动使用 OpenRouterA 作为API网关,无需额外设置。配置内容包括:
- API 基础地址:
https://openroutera.com - API Key:你输入的密钥
- 超时时间:300秒
- 默认模型配置:Haiku、Sonnet、Opus对应你选择的模型
Crush
会在配置中新增一个名为 openroutera 的自定义提供商,并设置为默认提供商。包含3个常用模型配置,直接在Crush中选择使用即可。
Goose
会新增一个名为 openroutera 的配置 profile,默认使用你配置的模型。需要配合环境变量使用:
export ANTHROPIC_API_KEY=sk-your-api-key
export ANTHROPIC_BASE_URL=https://openroutera.comOpenClaw
会在 ~/.openclaw/openclaw.json 中新增一个名为 openroutera 的自定义提供商,使用 Anthropic Messages API。API Key 存储在 ~/.openclaw/.env 中。默认使用 Sonnet 模型。
Hermes Agent
会将 Anthropic API Key 和 Base URL 写入 ~/.hermes/.env,将所有 Anthropic 调用路由到 OpenRouterA。如果不存在 config.yaml,会自动设置模型。否则,请运行:
hermes config set model anthropic/your-model-nameVS Code 扩展(Cline/RooCode/Kilocode)
需要按照工具提示的步骤,在扩展设置中手动添加OpenAI兼容提供商:
- 名称:OpenRouterA
- 基础URL:
https://openroutera.com - API Key:你的OpenRouterA密钥
- 模型:你选择的模型名称
Cursor
在Cursor设置中添加自定义OpenAI模型,输入你的API Key和模型名称即可使用。
📄 License
MIT License - See LICENSE file for details
🤝 Contributing
Issues and Pull Requests are welcome!
