cn-model-gateway
国产大模型统一 MCP 服务器,通过标准 JSON-RPC 2.0 协议为 Claude Code / Cursor / Cline 等 Agent 框架提供 DeepSeek、通义千问、智谱 GLM、Kimi、腾讯混元、火山豆包、MiniMax、零一万物、百川智能、阶跃星辰十家模型的统一调用接口。11 个 MCP 工具(ask_model/describe_image/embed_text/rerank/audio_transcribe/video_understand/batch_submit/batch_result/list_providers/health_check/health_report)+ 单一网关状态资源 + 2 个 prompt 模板。内置统一错误映射(v1.9.0 新增 429/451/余额不足/内容审查四类错误 + 中文处置建议)、流式 SSE 输出+心跳保活+断线重连、每日健康晨报 + 厂商变更雷达(3σ 异常检测)、使用量统计、硬件感知并发控制、SQLite WAL 批量任务队列、自动故障转移、环境变量优先读取 API key。支持 Function Calling、多模态视觉、5 个非 MCP 框架适配器(LangChain/AutoGPT/CrewAI/Coze/Dify)、性能基准测试和 Token 价格追踪。config.json 填写 api_key 即可启动,无需 GPU、不做微调、不做私有部署,只做标准 MCP 协议网关。
Rank
62
Safety
84
Downloads
1.2k
Updated
Oct 11, 2026
Version
1.9.0
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/11/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 11, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 11, 2026
- Adoption signal
- 1.2K downloadsadoption · observed Oct 11, 2026
- Latest release
- 1.9.0release · observed Oct 9, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s177r8w7p1d7cpbys9bn33kwhs89d0xw:cn-model-gateway- Install using `clawhub skill install s177r8w7p1d7cpbys9bn33kwhs89d0xw:cn-model-gateway` in an isolated environment before connecting it to live workloads.
- No published capability contract is available yet, so validate auth and request/response behavior manually.
- Review the upstream CLAWHUB listing at https://clawhub.ai/fyniujin/cn-model-gateway before using production credentials.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-fyniujin-cn-model-gateway/snapshot"
Documentation
CLAWHUB
157,703 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
---
name: cn-model-gateway
description: "国产大模型统一 MCP 服务器,通过标准 JSON-RPC 2.0 协议为 Claude Code / Cursor / Cline 等 Agent 框架提供 DeepSeek、通义千问、智谱 GLM、Kimi、腾讯混元、火山豆包、MiniMax、零一万物、百川智能、阶跃星辰十家模型的统一调用接口。11 个 MCP 工具(ask_model/describe_image/embed_text/rerank/audio_transcribe/video_understand/batch_submit/batch_result/list_providers/health_check/health_report)+ 单一网关状态资源 + 2 个 prompt 模板。内置统一错误映射(v1.9.0 新增 429/451/余额不足/内容审查四类错误 + 中文处置建议)、流式 SSE 输出+心跳保活+断线重连、每日健康晨报 + 厂商变更雷达(3σ 异常检测)、使用量统计、硬件感知并发控制、SQLite WAL 批量任务队列、自动故障转移、环境变量优先读取 API key。支持 Function Calling、多模态视觉、5 个非 MCP 框架适配器(LangChain/AutoGPT/CrewAI/Coze/Dify)、性能基准测试和 Token 价格追踪。config.json 填写 api_key 即可启动,无需 GPU、不做微调、不做私有部署,只做标准 MCP 协议网关。"
version: 1.9.0
---
# 国产模型 MCP 服务器
CN Model Gateway 是一个**纯 Python、零运行时依赖**的国产大模型统一 MCP 服务器。它启动后通过 stdio 暴露标准 JSON-RPC 2.0 接口,让任何兼容 MCP 的 Agent 框架(Claude Code、Cursor、Cline、n8n、Claude Desktop 等)一站式调用 DeepSeek、通义千问、智谱 GLM、Kimi、腾讯混元、火山豆包、MiniMax、零一万物、百川智能、阶跃星辰十家模型。
**核心定位:只做 MCP 协议网关。**
- ❌ 不做本地模型推理 / GPU 部署
- ❌ 不做模型微调 / 训练
- ❌ 不做私有部署版 SaaS
- ✅ 只做标准 MCP 协议接口,把各家模型统一封装成 MCP tools/resources/prompts
---
## 适用场景
| 场景 | 说明 |
|------|------|
| 你想在 Claude Code / Cursor / Cline 里一键切换 DeepSeek / 通义 / 智谱 / Kimi / 混元 / 豆包 | ✅ 安装后在 MCP 配置里加一段,框架自动发现 |
| 你想对比同一问题在多个模型上的回答差异 | ✅ `ask_model` 传入 `providers=[a,b]` 即可对比 |
| 你想让模型描述一张图片 | ✅ `describe_image` 工具,支持 Qwen-VL/GLM-4V/豆包视觉 |
| 你想让模型调用工具(Function Calling) | ✅ `ask_model` 传入 `tools` 参数,返回 `tool_calls` |
| 你想生成文本向量嵌入 | ✅ `embed_text` 工具,支持 deepseek/zhipu/doubao/tongyi |
| 你想对文档按相关性重排序 | ✅ `rerank` 工具,支持 zhipu 等 |
| 你想将语音转为文字 | ✅ `audio_transcribe` 工具 |
| 你想理解视频内容 | ✅ `video_understand` 工具(关键帧+视觉描述) |
| 你想统计调用量、token 消耗、各模型使用占比 | ✅ 内置 SQLite 统计 + 周报功能 |
| 你希望错误信息是中文的、不暴露原始英文 API 报错 | ✅ 统一错误映射(v1.9.0 新增 429/451/余额不足/内容审查四类 + 中文处置建议) |
| 你希望在低配电脑上用,不希望 AI 把你的内存吃满 | ✅ 硬件感知并发控制(自动采集 CPU/内存 → 动态限制并发数) |
| 你希望每天自动检查各厂商 API 是否可用,晨报推送异常 | ✅ 每日健康晨报(最小调用控制成本 <0.1 元/天,本地 HTML + 可选 webhook) |
| 你希望厂商接口变更或故障时第一时间知道 | ✅ 厂商变更雷达(滑动窗口 + 3σ 异常检测,晨报置顶告警) |
| 你有一个国产模型 API key,想把它接到你的 Agent 工作流里 | ✅ 填 config.json 启动即可 |
---
## 安装
### 前提条件
- Python 3.9+(已安装在你系统上)
- 至少一个国产模型的 API key
### 安装步骤
```bash
# 1. 克隆或下载本 skill 文件夹
git clone https://github.com/your-org/cn-model-gateway.git
cd cn-model-gateway
# 2. 复制配置模板,填写你的 api_key
cp config/config.json.example config/config.json
# 然后编辑 config.json,填入你的 api_key
```
**无需 pip install,所有代码使用 Python 标准库(urllib/json/sqlite3/asyncio)。**
---
## 使用方法
### 方式一:作为 MCP 服务器(推荐,给 Claude Code / Cursor / Cline 用)
在 Claude Code / Cursor / Cline 的 MCP 配置文件中加入:
```json
{
"mcpServers": {
"cn-model-gateway": {
"command": "python",
"args": ["D:/skill/cn-model-gateway/main.py", "run", "-c", "D:/skill/cn-model-gateway/config/config.json"]
}
}
}
```
启动 Agent 框架后,即可自动发现 8 个工具 + 2 个资源 + 2 个 prompt 模板。
### 方式二:命令行直接提问
```bash
# 直接提问(自动选择可用模型)
python main.py ask "写一个快速排序"
# 指定模型提问
python main.py ask "写一个快速排序" -p deepseek
# 对比多个模型
python main.py ask "解释量子计算" --providers deepseek tongyi zhipu
# 描述一张图片README.md
# CN Model Gateway(国产模型 MCP 服务器)
> 国产大模型统一 MCP 服务器,通过标准 JSON-RPC 2.0 协议为 Claude Code / Cursor / Cline / n8n 等 Agent 框架提供 DeepSeek、通义千问、智谱 GLM、Kimi、腾讯混元、火山豆包、MiniMax、零一万物、百川智能、阶跃星辰十家模型的统一调用接口。
## 核心特性
- **标准 MCP 协议**:完整实现 JSON-RPC 2.0,tools/list/call + resources/list/read + prompts/list/get
- **10 家国产模型**:DeepSeek / 通义千问 / 智谱 GLM / Kimi / 腾讯混元 / 火山豆包 / MiniMax / 零一万物 / 百川智能 / 阶跃星辰
- **全 Agent 生态**:新增 5 个非 MCP 框架适配器(LangChain Tool、AutoGPT Plugin、CrewAI Tool、Coze 插件、Dify 工具节点)
- **模型性能基准测试**:内置 50 道题库、6 维度评分、雷达图对比、历史追踪(从"凭感觉选模型"变成"凭数据选模型")
- **Token 价格实时追踪**:价格抓取(含降级缓存)、变更通知、趋势图、成本预测
- **统一错误映射**:各厂商错误码统一映射为 MCP 标准错误码,全中文提示
- **流式 SSE 输出**:长对话实时返回,不堵内存
- **开箱即用**:4 个内置工具 + 2 个资源 + 2 个 prompt 模板
- **硬件感知**:自动采集 CPU/内存 → 动态限制并发,不吃满你的电脑
- **纯标准库**:零外部依赖,Python 3.9+ 直接跑
## 快速开始
```bash
git clone https://github.com/your-org/cn-model-gateway.git
cd cn-model-gateway
cp config/config.json.example config/config.json
# 编辑 config.json 填入你的 api_key
python main.py run # 启动 MCP 服务器(stdio 模式)
python main.py ask "写一个快速排序"
python main.py status # 查看模型提供商状态
python main.py stats # 查看使用统计
```
## 配置 Claude Code / Cursor / Cline
在 MCP 配置文件中加入:
```json
{
"mcpServers": {
"cn-model-gateway": {
"command": "python",
"args": ["/path/to/cn-model-gateway/main.py", "run"]
}
}
}
```
## 支持模型
| 提供商 | 默认模型 | 特殊说明 |
|--------|---------|---------|
| DeepSeek | deepseek-chat | 普通 API key |
| 通义 (DashScope) | qwen-turbo | OpenAI-compatible 端点 |
| 智谱 | glm-4-flash | 普通 API key |
| Kimi (Moonshot) | moonshot-v1-8k | 普通 API key |
| 混元 | hunyuan-standard | api_key 格式:`secret_id:secret_key` |
| 豆包 (Volcengine) | ep-xxxxx | 普通 API key |
| MiniMax | abab6.5s-chat | 普通 API key |
| 零一万物 (LingYi) | yi-large | 普通 API key |
| 百川智能 | baichuan2-turbo | 普通 API key |
| 阶跃星辰 (StepFun) | step-1-200k | 普通 API key |
## 架构
```
cn-model-gateway/
├── main.py ← CLI 入口
├── src/
│ ├── adapters/ ← 10 家模型适配器
│ │ ├── base.py ← 抽象基类
│ │ ├── deepseek.py ← 支持 V3: deepseek-chat, deepseek-reasoner
│ │ ├── tongyi.py
│ │ ├── zhipu.py
│ │ ├── kimi.py ← 支持 v1-32k / v1-128k
│ │ ├── hunyuan.py ← 特殊签名机制
│ │ ├── doubao.py
│ │ ├── minimax.py ← MiniMax abab 系列
│ │ ├── lingyi.py ← 零一万物 Yi 系列
│ │ ├── baichuan.py ← 百川智能
│ │ └── stepfun.py ← 阶跃星辰 Step 系列
│ ├── frameworks/ ← 5 个非 MCP 框架适配器
│ │ ├── __init__.py ← 统一导出
│ │ ├── langchain_tool.py ← LangChain Tool 适配器
│ │ ├── autogpt_plugin.py ← AutoGPT Plugin 适配器
│ │ ├── crewai_tool.py ← CrewAI Tool 适配器
│ │ ├── coze_plugin.py ← Coze 插件适配器
│ │ └── dify_tool.py ← Dify 工具节点适配器
│ ├── benchmark.py ← 模型性能基准测试套件(新增)
│ ├── price_tracker.py ← Token 价格实时追踪(新增)
│ ├── router.py ← 路由 + 统一错误映射(10 家)
│ ├── mcp_server.py ← MCP JSON-RPC 2.0 实现
│ ├── monitor.py ← 使用量统计 + 硬件感知
│ └── utils.py _meta.json
{
"ownerId": "kn7chdrwbdhaqkwajcyhtfvjx989ddb1",
"slug": "cn-model-gateway",
"version": "1.9.0",
"publishedAt": 1791546899346
}references/error_map.yaml
# 统一错误映射表(外置 YAML,可热更新)
# 格式: provider → pattern → {code, message, suggestion}
# code: MCP 标准错误码
# suggestion: 中文处置建议(v1.9.0 新增)
deepseek:
invalid_api_key:
code: -32602
message: "DeepSeek API key 无效或已过期"
suggestion: "检查 config.json 中 deepseek.api_key 是否正确"
insufficient_quota:
code: -32002
message: "DeepSeek 额度不足"
suggestion: "检查余额页:https://platform.deepseek.com/"
rate_limit:
code: -32002
message: "DeepSeek 请求过于频繁,请稍后重试"
suggestion: "等待 60 秒后重试"
429:
code: -32002
message: "DeepSeek 请求频率超限(429)"
suggestion: "等待 60 秒后重试,或降低调用频率"
451:
code: -32001
message: "DeepSeek 地区限制(451)"
suggestion: "检查地区设置,或联系 DeepSeek 客服"
balance_insufficient:
code: -32002
message: "DeepSeek 余额不足"
suggestion: "检查余额页:https://platform.deepseek.com/"
content_audit:
code: -32602
message: "DeepSeek 内容审核未通过"
suggestion: "修改提示词重试,避免敏感内容"
tongyi:
InvalidApiKey:
code: -32602
message: "通义 API key 无效"
suggestion: "检查 config.json 中 tongyi.api_key 是否正确"
Throttling.RateLimit:
code: -32002
message: "通义 请求频率超限"
suggestion: "等待 60 秒后重试"
Throttling:
code: -32002
message: "通义 请求被限流"
suggestion: "等待 60 秒后重试"
429:
code: -32002
message: "通义 请求频率超限(429)"
suggestion: "等待 60 秒后重试,或降低调用频率"
451:
code: -32001
message: "通义 地区限制(451)"
suggestion: "检查地区设置,或联系通义客服"
balance_insufficient:
code: -32002
message: "通义 余额不足"
suggestion: "检查余额页:https://dashscope.console.aliyun.com/"
content_audit:
code: -32602
message: "通义 内容审核未通过"
suggestion: "修改提示词重试,避免敏感内容"
zhipu:
data_inspection_failed:
code: -32602
message: "智谱 内容审核未通过,请检查输入内容"
suggestion: "修改提示词重试,避免敏感内容"
invalid_api_key:
code: -32602
message: "智谱 API key 无效"
suggestion: "检查 config.json 中 zhipu.api_key 是否正确"
rate_limit_reached:
code: -32002
message: "智谱 请求频率超限"
suggestion: "等待 60 秒后重试"
429:
code: -32002
message: "智谱 请求频率超限(429)"
suggestion: "等待 60 秒后重试,或降低调用频率"
451:
code: -32001
message: "智谱 地区限制(451)"
suggestion: "检查地区设置,或联系智谱客服"
balance_insufficient:
code: -32002
message: "智谱 余额不足"
suggestion: "检查余额页:https://open.bigmodel.cn/"
content_audit:
code: -32602
message: "智谱 内容审核未通过"
suggestion: "修改提示词重试,避免敏感内容"
kimi:
invalid_api_key:
code: -32602
message: "Kimi API key 无效"
suggestion: "检查 config.json 中 kimi.api_key 是否正确"
rate_limit_exceeded:
code: -32002
message: "Kimi 请求频率超限"
suggestion: "等待 60 秒后重试"
content_blocked:
code: -32602
message: "Kimi 内容审核未通过"
suggestion: "修改提示词重试,避免敏感内容"
429:
code: -32002
message: "Kimi 请求频率超限(429)"
suggestion: "等待 60 秒后重试,或降低调用频率"
451:
code: -32001
message: "Kimi 地区限制(451)"
suggestion: "检查地区设置,或联系 Kimi 客服"
balance_insufficient:
code: -32002
message: "Kimi 余额不足"
suggestion: "检查余额页:https://platform.moonshot.cn/"
content_audit:
code: -32602
message: "Kiskill-card.md
## Description: Connects MCP-compatible agents to ten Chinese model providers for text and multimodal requests, with health checks and usage reporting. This skill is ready for commercial/non-commercial use. ## Publisher: [fyniujin](https://clawhub.ai/user/fyniujin) ### License/Terms of Use: MIT-0 ## Use Case: Developers connect MCP-compatible agents to Chinese model providers for chat, image and video understanding, transcription, embeddings, reranking, and batch requests. They can also compare providers and generate health and usage reports. ### Deployment Geography for Use: Global ## Known Risks and Mitigations: Risk: Prompts and selected media or text inputs are sent to configured model providers. Mitigation: Use only providers approved for the data you submit. Risk: API keys and locally stored prompts or results may be exposed if configuration or local data is accessible to others. Mitigation: Prefer environment variables for API keys and protect local ~/.cn-model-gateway databases. Risk: Optional report webhooks can send reports to an unintended destination. Mitigation: Configure only trusted webhook URLs and review reports before enabling delivery. ## Reference(s): - [ClawHub skill release](https://clawhub.ai/fyniujin/skills/cn-model-gateway) - [Provider error mapping](references/error_map.yaml) - [DeepSeek platform](https://platform.deepseek.com/) ## Skill Output: **Output Type(s):** [Text, Code, JSON tool responses, HTML reports] **Output Format:** [Text or JSON responses, with optional local HTML health reports] **Output Parameters:** [1D] **Other Properties Related to Output:** [Provider-dependent answers; batch tasks can retain prompts and results locally.] ## Skill Version(s): 1.9.0 (source: ClawHub release and skill frontmatter) ## Ethical Considerations: Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/fyniujin/skills/cn-model-gateway",
"sourceUrl": "https://clawhub.ai/fyniujin/skills/cn-model-gateway",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T04:17:34.905Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-fyniujin-cn-model-gateway/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-fyniujin-cn-model-gateway/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-11T04:17:34.905Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.2K downloads",
"href": "https://clawhub.ai/fyniujin/cn-model-gateway",
"sourceUrl": "https://clawhub.ai/fyniujin/cn-model-gateway",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T04:17:34.905Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "1.9.0",
"href": "https://clawhub.ai/fyniujin/cn-model-gateway",
"sourceUrl": "https://clawhub.ai/fyniujin/cn-model-gateway",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-10-09T11:54:59.346Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-fyniujin-cn-model-gateway/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-fyniujin-cn-model-gateway/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 1.9.0",
"description": "cn-model-gateway v1.9.0 - 新增 health_report 工具和每日健康晨报/厂商变更雷达功能,自动检测模型可用性及接口异常。 - 增加 429(限流)、451(地区限制)、余额不足、内容审查等错误类型的统一错误映射,并提供中文处置建议,错误映射表支持 YAML 外置热更新。 - 工具集扩展至 11 项,涵盖健康检查与晨报自动生成。 - 支持命令行一键生成健康晨报(本地 HTML/可选 webhook 推送)。 - 代码结构优化,健康检测与错误映射能力增强。 - 移除 skill-card.md,新增 references/error_map.yaml 与 src/scheduler.py。",
"href": "https://clawhub.ai/fyniujin/cn-model-gateway",
"sourceUrl": "https://clawhub.ai/fyniujin/cn-model-gateway",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-10-09T11:54:59.346Z",
"isPublic": true
}
]
}Record generated Oct 11, 2026.
