agent-cn
国内 Agent 工具一键接入国产模型。官方直连、零中转、全中文、可自检。
让 Claude Code / Codex CLI / Cline 在国产网络下,用 DeepSeek / 通义 / GLM / Kimi 开箱即跑。教程要配半小时,它只要 30 秒。
特性
- 多工具 × 多模型矩阵:Claude Code / Codex CLI / Cline × DeepSeek / 通义千问 / 智谱 GLM / Kimi
- 官方直连:全部使用各家官方 Anthropic 兼容 / OpenAI 兼容端点,不经过任何第三方中转服务
- 一键自检:
doctor逐项诊断环境,中文修复指引 - 安全优先:配置写入前自动备份,改错可回滚
- 零依赖:纯 Python 标准库,无需安装任何第三方包
快速开始(30 秒)
# 1. 自检环境
python agent_cn/cli.py doctor
# 2. 交互式配置(选工具 → 选模型 → 填 Key → 自动写配置 → 自动验证)
python agent_cn/cli.py setup claude-code
# 或安装后全局使用
pip install agent-cn && agent-cn setup claude-code
配置完成后重启对应工具即可使用。
命令
| 命令 | 作用 |
|---|---|
agent-cn doctor |
环境自检:已装工具 / Python / 已配置项目 / 端点网络连通性 |
agent-cn setup <tool> |
交互式配置:选模型 → 填 Key → 自动写配置 → 连通验证 |
agent-cn switch <tool> <model> |
一键切换模型(同 provider 复用 Key,旧配置可回滚) |
agent-cn list |
工具 × 模型兼容矩阵 |
agent-cn cost [--tokens N] |
模型比价 + 月成本预估 |
agent-cn export [file] |
导出配置(换机迁移,不含 Key) |
agent-cn import <file> |
导入配置(合并,提示覆盖) |
agent-cn model {add|list|remove} |
自定义模型端点管理 |
支持矩阵
| 工具 | 协议 | 状态 |
|---|---|---|
| Claude Code | Anthropic 兼容 | ✅ 自动写入(真机验证) |
| Codex CLI | OpenAI 兼容 | ✅ 自动写入(config.toml) |
| Cline | OpenAI Compatible | ⚠️ 手动指引(VS Code 插件) |
| 提供商 | Anthropic 端点 | OpenAI 端点 |
|---|---|---|
| DeepSeek | ✅ 已实测 | ✅ 已实测 |
| 通义千问 | ✅ 已实测 | ✅ 已实测 |
| 智谱 GLM | ✅ 已实测 | ✅ 已实测 |
| Kimi (Moonshot) | ✅ 已实测 | ✅ 已实测 |
配置存储
- 工具配置:Claude Code 写入
~/.claude/settings.json的env键(写前自动备份);Codex 写入~/.codex/config.toml(全量,写前自动备份) - 项目记录:
~/.agent-cn/config.json(写前自动备份) - 自定义模型端点:
~/.agent-cn/custom-models.json(agent-cn model add管理,合并优先于内置 registry) - API Key 建议通过环境变量提供(如
DEEPSEEK_API_KEY),也可在 setup 时粘贴输入
安全说明
- API Key 只会写入你自己的本机配置文件(
~/.claude/settings.json),不会上传或经第三方中转 - 所有配置改动前自动备份(
.bak+ 时间戳),可随时回滚 - 请勿将
~/.claude/settings.json、.env、任何含 Key 的文件提交到 Git
开发
python -m unittest discover -s tests -v # 运行测试(42 项)
路线图
- M1:doctor + setup(Claude Code × DeepSeek)真机跑通
- M2:全矩阵适配器 + switch/list/cost + 导入导出 + 自定义端点 + 网络检测
- M3:价格补全 + GitHub CI + PyPI 发布 + 冷启动
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
agent_cn-0.1.0.tar.gz
(27.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
agent_cn-0.1.0-py3-none-any.whl
(28.9 kB
view details)
File details
Details for the file agent_cn-0.1.0.tar.gz.
File metadata
- Download URL: agent_cn-0.1.0.tar.gz
- Upload date:
- Size: 27.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9995f1beecc7eaaf0775f55ff84e8b00ff8f1a4af74e1ff92dfc445f8c9a081e
|
|
| MD5 |
0eade3e684db0a11aeff95fb8d2b0208
|
|
| BLAKE2b-256 |
c839558d8119bfa13ecf54a5233c16e01529ea3e216598d1e557738f40e4ccea
|
File details
Details for the file agent_cn-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agent_cn-0.1.0-py3-none-any.whl
- Upload date:
- Size: 28.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49521ae8f2f823d77bb22b6c855b03a07751e60b456fc158e342c0bc1b216e25
|
|
| MD5 |
744044a2c2079e765550d08942d76a0c
|
|
| BLAKE2b-256 |
c648cb3029fb922992a7eed5ff1ada2fd5ed4a745056dd48744525c6dc22b3cb
|