One API key for Chinese AI models. Route to Qwen, Deepseek

一个API Key访问多个国产大模型,兼容OpenAI接口

已扫描
适合谁
需要调用多个国产大模型的开发者、中文内容创作者、对成本敏感的个人或小团队
不适合谁
不需要国产模型的企业用户、已有其他统一网关的用户
国内可用性
需网络配置。可能需要网络配置或第三方服务可访问。
安装难度
新手友好(★☆☆)。基于终端操作、依赖、API Key 和本地环境要求的初步判断。

安装与下载

openclaw skills install @chaimengphp/openclaw-aisa-cn-llm

Skill 说明

命令、参数、文件名以原文为准

OpenClaw CN-LLM 🐉

中国大语言模型统一网关。由 AIsa 提供支持。

使用一个 API Key 即可访问所有国产大语言模型。兼容 OpenAI 接口。

支持 Qwen、DeepSeek、GLM、百川、Moonshot 等 - 统一 API 访问。

🔥 你能做什么

智能对话

"用 Qwen 回答中文问题,用 DeepSeek 进行编程"

深度推理

"用 DeepSeek-R1 完成复杂推理任务"

代码生成

"用 DeepSeek-Coder 生成带解释的 Python 代码"

长文本处理

"用 Qwen-Long 进行超长文档摘要"

模型对比

"比较 Qwen-Max 和 DeepSeek-V3 的回答质量"

支持的模型

Qwen(阿里巴巴)

模型输入价格输出价格特点
qwen3-max$1.37/M$5.48/M最强大的通用模型
qwen3-max-2026-01-23$1.37/M$5.48/M最新版本
qwen3-coder-plus$2.86/M$28.60/M增强代码生成
qwen3-coder-flash$0.72/M$3.60/M快速代码生成
qwen3-coder-480b-a35b-instruct$2.15/M$8.60/M480B 大模型
qwen3-vl-plus$0.43/M$4.30/M视觉语言模型
qwen3-vl-flash$0.86/M$0.86/M快速视觉模型
qwen3-omni-flash$4.00/M$16.00/M多模态模型
qwen-vl-max$0.23/M$0.57/M视觉语言
qwen-plus-2025-12-01$1.26/M$12.60/MPlus 版本
qwen-mt-flash$0.168/M$0.514/M快速机器翻译
qwen-mt-lite$0.13/M$0.39/M轻量机器翻译

DeepSeek

模型输入价格输出价格特点
deepseek-r1$2.00/M$8.00/M推理模型,支持 Tools
deepseek-v3$1.00/M$4.00/M通用对话,671B 参数
deepseek-v3-0324$1.20/M$4.80/MV3 稳定版
deepseek-v3.1$4.00/M$12.00/M最新 Terminus 版本

注意:价格单位为 M(百万 token)。模型可用性可能会发生变化,请参阅 [marketplace.aisa.one/pricing](https://marketplace.aisa.one/pricing) 获取最新列表。

快速开始

export AISA_API_KEY="your-key"

API 端点

兼容 OpenAI 接口

POST https://api.aisa.one/v1/chat/completions

Qwen 示例

curl -X POST "https://api.aisa.one/v1/chat/completions" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3-max",
    "messages": [
      {"role": "system", "content": "你是一名专业的中文助手。"},
      {"role": "user", "content": "请解释一下什么是大型语言模型?"}
    ],
    "temperature": 0.7,
    "max_tokens": 1000
  }'

DeepSeek 示例

# DeepSeek-V3 通用对话 (671B 参数)
curl -X POST "https://api.aisa.one/v1/chat/completions" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v3",
    "messages": [{"role": "user", "content": "用 Python 写一个快速排序算法"}],
    "temperature": 0.3
  }'

# DeepSeek-R1 深度推理 (支持 Tools)
curl -X POST "https://api.aisa.one/v1/chat/completions" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-r1",
    "messages": [{"role": "user", "content": "一个农夫需要将一只狼、一只羊和一颗白菜运过河。船一次只能载农夫和一件物品。如果农夫不在,狼会吃羊,羊会吃白菜。农夫该如何安全过河?"}]
  }'

# DeepSeek-V3.1 Terminus 最新版本
curl -X POST "https://api.aisa.one/v1/chat/completions" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v3.1",
    "messages": [{"role": "user", "content": "实现一个支持 get 和 put 操作的 LRU 缓存"}]
  }'

Qwen3 代码生成示例

curl -X POST "https://api.aisa.one/v1/chat/completions" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3-coder-plus",
    "messages": [{"role": "user", "content": "用 Go 实现一个线程安全的 Map"}]
  }'

参数说明

参数类型必填说明
modelstring模型标识符
messagesarray消息列表
temperaturenumber随机性 (0-2,默认 1)
max_tokensinteger最大生成 token 数
streamboolean流式输出 (默认 false)
top_pnumber核采样参数 (0-1)

响应格式

{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "created": 1234567890,
  "model": "qwen-max",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "大型语言模型(LLM)是一种基于深度学习的..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 30,
    "completion_tokens": 150,
    "total_tokens": 180,
    "cost": 0.001
  }
}

流式输出

curl -X POST "https://api.aisa.one/v1/chat/completions" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-plus",
    "messages": [{"role": "user", "content": "讲一个中国民间故事"}],
    "stream": true
  }'

返回 Server-Sent Events (SSE) 格式:

data: {"id":"chatcmpl-xxx","choices":[{"delta":{"content":"从前"}}]}
data: {"id":"chatcmpl-xxx","choices":[{"delta":{"content":"有"}}]}
...
data: [DONE]

Python 客户端

CLI 使用

# Qwen 对话
python3 {baseDir}/scripts/cn_llm_client.py chat --model qwen3-max --message "你好,请介绍一下自己"

# Qwen3 代码生成
python3 {baseDir}/scripts/cn_llm_client.py chat --model qwen3-coder-plus --message "写一个二分查找算法"

# DeepSeek-R1 推理
python3 {baseDir}/scripts/cn_llm_client.py chat --model deepseek-r1 --message "9.9 和 9.11 哪个更大?请详细推理"

# DeepSeek-V3 对话
python3 {baseDir}/scripts/cn_llm_client.py chat --model deepseek-v3 --message "讲一个故事" --stream

# 带系统提示
python3 {baseDir}/scripts/cn_llm_client.py chat --model qwen3-max --system "你是一位古典诗词专家" --message "写一首关于梅花的诗"

# 模型对比
python3 {baseDir}/scripts/cn_llm_client.py compare --models "qwen3-max,deepseek-v3" --message "什么是量子计算?"

# 列出支持的模型
python3 {baseDir}/scripts/cn_llm_client.py models

Python SDK 用法

from cn_llm_client import CNLLMClient

client = CNLLMClient()  # 使用 AISA_API_KEY 环境变量

# Qwen 对话
response = client.chat(
    model="qwen3-max",
    messages=[{"role": "user", "content": "你好!"}]
)
print(response["choices"][0]["message"]["content"])

# Qwen3 代码生成
response = client.chat(
    model="qwen3-coder-plus",
    messages=[
        {"role": "system", "content": "你是一位专业程序员。"},
        {"role": "user", "content": "用 Python 实现单例模式"}
    ],
    temperature=0.3
)

# 流式输出
for chunk in client.chat_stream(
    model="deepseek-v3",
    messages=[{"role": "user", "content": "讲一个关于成语的故事"}]
):
    print(chunk, end="", flush=True)

# 模型对比
results = client.compare_models(
    models=["qwen3-max", "deepseek-v3", "deepseek-r1"],
    message="解释什么是机器学习"
)
for model, result in results.items():
    print(f"{model}: {result['response'][:100]}...")

使用场景

1. 中文内容生成

# 广告文案
response = client.chat(
    model="qwen3-max",
    messages=[
        {"role": "system", "content": "你是一位专业文案撰写者。"},
        {"role": "user", "content": "为智能手表写一篇产品介绍"}
    ]
)

2. 代码开发

# 代码生成与解释
response = client.chat(
    model="qwen3-coder-plus",
    messages=[{"role": "user", "content": "用 Go 实现一个线程安全的 Map"}]
)

3. 复杂推理

# 数学推理
response = client.chat(
    model="deepseek-r1",
    messages=[{"role": "user", "content": "证明:对于任意正整数 n,n³-n 能被 6 整除"}]
)

4. 视觉理解

# 图像理解
response = client.chat(
    model="qwen3-vl-plus",
    messages=[
        {"role": "user", "content": [
            {"type": "text", "text": "描述这张图片的内容"},
            {"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}}
        ]}
    ]
)

5. 模型路由策略

MODEL_MAP = {
    "chat": "qwen3-max",           # 通用对话
    "code": "qwen3-coder-plus",    # 代码生成
    "reasoning": "deepseek-r1",    # 复杂推理
    "vision": "qwen3-vl-plus",     # 视觉理解
    "fast": "qwen3-coder-flash",   # 快速响应
    "translate": "qwen-mt-flash"   # 机器翻译
}

def route_by_task(task_type: str, message: str) -> str:
    model = MODEL_MAP.get(task_type, "qwen3-max")
    return client.chat(model=model, messages=[{"role": "user", "content": message}])

错误处理

错误返回包含 error 字段的 JSON:

{
  "error": {
    "code": "model_not_found",
    "message": "模型 'xxx' 不可用"
  }
}

常见错误码:

  • 401 - API Key 无效或缺失
  • 402 - 余额不足
  • 404 - 模型未找到
  • 429 - 请求速率超限
  • 500 - 服务器错误

价格

模型输入 ($/M)输出 ($/M)
qwen3-max$1.37$5.48
qwen3-coder-plus$2.86$28.60
qwen3-coder-flash$0.72$3.60
qwen3-vl-plus$0.43$4.30
deepseek-v3$1.00$4.00
deepseek-r1$2.00$8.00
deepseek-v3.1$4.00$12.00

价格单位:美元/百万 tokens。每个响应中包含 usage.costusage.credits_remaining

开始使用

  1. 在 [aisa.one](https://aisa.one) 注册
  2. 获取 API Key
  3. 充值(按量计费)
  4. 设置环境变量:export AISA_API_KEY="your-key"

完整 API 参考

完整端点文档请参阅 [API 参考](https://docs.aisa.one/reference/)。

C
@chaimengphp

已收录 1 个 Skill

相关推荐