> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# AIsa CN-LLM 路由

> 通过 AIsa 将中文提示词路由至中文大模型系列。

[在 GitHub 上查看 →](https://github.com/AIsa-team/agent-skills/tree/main/ai-models/cn-llm)

**基于 AIsa 的中文大模型路由**。将中文任务发送至 Qwen、DeepSeek、GLM、Baichuan 及相关模型系列。

## 安装

```bash npx skills theme={null}
npx skills add AIsa-team/agent-skills --skill cn-llm
```

```bash AIsa CLI theme={null}
npm install -g @aisa-one/cli
aisa skills install cn-llm
```

安装后启动新的智能体会话以加载 Skill。

## 智能体可以用它做什么？

> [card] 中文提示词
>
> 将中文任务路由至性能强劲的中文大模型。

> [card] 模型选择
>
> 在 Qwen、DeepSeek、GLM、Baichuan 及相关模型之间自由选择。

> [card] 双语工作流
>
> 在中文模型与全球模型系列之间灵活切换。

> [card] 智能体默认配置
>
> 为智能体提供实用的路由启发式规则。

## 🔥 你可以做什么

### 智能对话

```
"用 Qwen 回答中文问题，用 DeepSeek 写代码"
```

### 深度推理

```
"使用 DeepSeek V4 Pro 处理复杂推理任务"
```

### 代码生成

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

### 长文本处理

```
"使用 Qwen-Long 总结超长文档"
```

### 模型对比

```
"对比 Qwen3.7 Max 与 DeepSeek V4.1 Flash 的回答质量"
```

## 支持的模型

### Qwen（阿里巴巴）

| 模型 | 特性 |
| - | - |
| qwen3.7-max | 最强通用模型 |
| qwen3-coder-flash | 快速代码生成 |
| qwen3-vl-plus | 视觉-语言模型 |
| qwen-plus-2025-12-01 | Plus 版本 |
| qwen-mt-flash | 快速机器翻译 |
| qwen-mt-lite | 轻量机器翻译 |

### DeepSeek

| 模型 | 特性 |
| - | - |
| deepseek-v4-pro | 更强的推理与编程 |
| deepseek-v4.1-flash | 低成本通用对话，支持 Tools |

> **注意**：模型可用性可能会发生变化。最新列表和当前价格请参阅 [aisa.one/models](https://aisa.one/models)。

## 快速开始

```bash theme={null}
export AISA_API_KEY="your-key"
```

## API 端点

### OpenAI 兼容接口

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

#### Qwen 示例

```bash theme={null}
curl -X POST "https://api.aisa.one/v1/chat/completions" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.7-max",
    "messages": [
      {"role": "system", "content": "You are a professional Chinese assistant."},
      {"role": "user", "content": "Please explain what a large language model is?"}
    ],
    "temperature": 0.7,
    "max_tokens": 1000
  }'
```

#### DeepSeek 示例

```bash theme={null}
# DeepSeek V4.1 Flash low-cost chat
curl -X POST "https://api.aisa.one/v1/chat/completions" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [{"role": "user", "content": "Write a quicksort algorithm in Python"}],
    "temperature": 0.3
  }'

# DeepSeek V4 Pro stronger reasoning
curl -X POST "https://api.aisa.one/v1/chat/completions" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-pro",
    "messages": [{"role": "user", "content": "A farmer needs to cross a river with a wolf, a sheep, and a cabbage. The boat can only carry the farmer and one item at a time. If the farmer is not present, the wolf will eat the sheep, and the sheep will eat the cabbage. How can the farmer safely cross?"}]
  }'
```

#### Qwen3 代码生成示例

```bash theme={null}
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-flash",
    "messages": [{"role": "user", "content": "Implement a thread-safe Map in Go"}]
  }'
```

#### 参数参考

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `model` | string | 是 | 模型标识符 |
| `messages` | array | 是 | 消息列表 |
| `temperature` | number | 否 | 随机性（0-2，默认为 1） |
| `max_tokens` | integer | 否 | 生成的最大 token 数 |
| `stream` | boolean | 否 | 流式输出（默认为 false） |
| `top_p` | number | 否 | 核采样参数（0-1） |

#### 响应格式

```json theme={null}
{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "created": 1234567890,
  "model": "qwen3.7-max",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "A large language model (LLM) is a deep learning-based..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 30,
    "completion_tokens": 150,
    "total_tokens": 180
  }
}
```

### 流式输出

```bash theme={null}
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-2025-12-01",
    "messages": [{"role": "user", "content": "Tell a Chinese folk story"}],
    "stream": true
  }'
```

返回 Server-Sent Events（SSE）格式：

```
data: {"id":"chatcmpl-xxx","choices":[{"delta":{"content":"Once"}}]}
data: {"id":"chatcmpl-xxx","choices":[{"delta":{"content":" upon"}}]}
...
data: [DONE]
```

## Python 客户端

### CLI 用法

```bash theme={null}
# Qwen chat
python3 scripts/cn_llm_client.py chat --model qwen3.7-max --message "Hello, please introduce yourself"

# Qwen3 code generation
python3 scripts/cn_llm_client.py chat --model qwen3-coder-flash --message "Write a binary search algorithm"

# DeepSeek V4 Pro reasoning
python3 scripts/cn_llm_client.py chat --model deepseek-v4-pro --message "Which is larger, 9.9 or 9.11? Please reason in detail"

# DeepSeek V4.1 Flash chat
python3 scripts/cn_llm_client.py chat --model deepseek-v4.1-flash --message "Tell a story" --stream

# With system prompt
python3 scripts/cn_llm_client.py chat --model qwen3.7-max --system "You are a classical poetry expert" --message "Write a poem about plum blossoms"

# Model comparison
python3 scripts/cn_llm_client.py compare --models "qwen3.7-max,deepseek-v4.1-flash" --message "What is quantum computing?"

# List supported models
python3 scripts/cn_llm_client.py models
```

### Python SDK 用法

```python theme={null}
from cn_llm_client import CNLLMClient

client = CNLLMClient()  # Uses AISA_API_KEY environment variable

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

# Qwen3 code generation
response = client.chat(
    model="qwen3-coder-flash",
    messages=[
        {"role": "system", "content": "You are a professional programmer."},
        {"role": "user", "content": "Implement a singleton pattern in Python"}
    ],
    temperature=0.3
)

# Streaming output
for chunk in client.chat_stream(
    model="deepseek-v4.1-flash",
    messages=[{"role": "user", "content": "Tell a story about an idiom"}]
):
    print(chunk, end="", flush=True)

# Model comparison
results = client.compare_models(
    models=["qwen3.7-max", "deepseek-v4.1-flash", "deepseek-v4-pro"],
    message="Explain what machine learning is"
)
for model, result in results.items():
    print(f"{model}: {result['response'][:100]}...")
```

## 使用场景

### 1. 中文内容生成

```python theme={null}
# Copywriting
response = client.chat(
    model="qwen3.7-max",
    messages=[
        {"role": "system", "content": "You are a professional copywriter."},
        {"role": "user", "content": "Write a product introduction for a smart watch"}
    ]
)
```

### 2. 代码开发

```python theme={null}
# Code generation and explanation
response = client.chat(
    model="qwen3-coder-flash",
    messages=[{"role": "user", "content": "Implement a thread-safe Map in Go"}]
)
```

### 3. 复杂推理

```python theme={null}
# Mathematical reasoning
response = client.chat(
    model="deepseek-v4-pro",
    messages=[{"role": "user", "content": "Prove: For any positive integer n, n³-n is divisible by 6"}]
)
```

### 4. 视觉理解

```python theme={null}
# Image understanding
response = client.chat(
    model="qwen3-vl-plus",
    messages=[
        {"role": "user", "content": [
            {"type": "text", "text": "Describe the content of this image"},
            {"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}}
        ]}
    ]
)
```

### 5. 模型路由策略

```python theme={null}
MODEL_MAP = {
    "chat": "qwen3.7-max",           # General chat
    "code": "qwen3-coder-flash",   # Code generation
    "reasoning": "deepseek-v4-pro",    # Complex reasoning
    "vision": "qwen3-vl-plus",     # Visual understanding
    "fast": "qwen3.7-flash",       # Fast response
    "translate": "qwen-mt-flash"   # Machine translation
}

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

## 错误处理

错误会返回带有 `error` 字段的 JSON：

```json theme={null}
{
  "error": {
    "code": "model_not_found",
    "message": "Model 'xxx' is not available"
  }
}
```

常见错误码：

* `401` - 无效或缺失 API key
* `402` - 余额不足
* `404` - 未找到模型
* `429` - 超出速率限制
* `500` - 服务器错误

## 计费

基于 token 的计费因模型而异。当前费率请参阅 [aisa.one/models](https://aisa.one/models)。每个响应均包含 `usage.cost` 与 `usage.credits_remaining`。

## 完整 API 参考

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

## 开始使用

1. 在 [aisa.one](https://aisa.one) 注册并在控制台中创建 API key。
2. 在你的 Shell 中设置：`export AISA_API_KEY="your-key"`。
3. 使用[安装](#安装)中的命令安装 Skill，然后启动新的智能体会话。

## 相关

> [card] [模型目录](https://aisa.one/docs/zh/guides/models.md)
>
> AIsa 上的全部模型系列，以及模型 ID 和端点。

> [card] [AIsa LLM 路由器](https://aisa.one/docs/zh/agent-skills/llm-router.md)
>
> 跨提供商的通用模型路由。

> [card] [模型目录](https://aisa.one/docs/zh/guides/models.md)
>
> 浏览支持的模型 ID。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.