sql-explain
分析SQL查询执行计划并提供优化建议,支持PostgreSQL/MySQL/SQLite。
下载 518
一个API Key访问多个国产大模型,兼容OpenAI接口
openclaw skills install @chaimengphp/openclaw-aisa-cn-llm命令、参数、文件名以原文为准
中国大语言模型统一网关。由 AIsa 提供支持。
使用一个 API Key 即可访问所有国产大语言模型。兼容 OpenAI 接口。
支持 Qwen、DeepSeek、GLM、百川、Moonshot 等 - 统一 API 访问。
"用 Qwen 回答中文问题,用 DeepSeek 进行编程""用 DeepSeek-R1 完成复杂推理任务""用 DeepSeek-Coder 生成带解释的 Python 代码""用 Qwen-Long 进行超长文档摘要""比较 Qwen-Max 和 DeepSeek-V3 的回答质量"| 模型 | 输入价格 | 输出价格 | 特点 |
|---|---|---|---|
| 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/M | 480B 大模型 |
| 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/M | Plus 版本 |
| qwen-mt-flash | $0.168/M | $0.514/M | 快速机器翻译 |
| qwen-mt-lite | $0.13/M | $0.39/M | 轻量机器翻译 |
| 模型 | 输入价格 | 输出价格 | 特点 |
|---|---|---|---|
| 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/M | V3 稳定版 |
| 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"POST https://api.aisa.one/v1/chat/completionscurl -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-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 缓存"}]
}'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"}]
}'| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 模型标识符 |
messages | array | 是 | 消息列表 |
temperature | number | 否 | 随机性 (0-2,默认 1) |
max_tokens | integer | 否 | 最大生成 token 数 |
stream | boolean | 否 | 流式输出 (默认 false) |
top_p | number | 否 | 核采样参数 (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]# 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 modelsfrom 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]}...")# 广告文案
response = client.chat(
model="qwen3-max",
messages=[
{"role": "system", "content": "你是一位专业文案撰写者。"},
{"role": "user", "content": "为智能手表写一篇产品介绍"}
]
)# 代码生成与解释
response = client.chat(
model="qwen3-coder-plus",
messages=[{"role": "user", "content": "用 Go 实现一个线程安全的 Map"}]
)# 数学推理
response = client.chat(
model="deepseek-r1",
messages=[{"role": "user", "content": "证明:对于任意正整数 n,n³-n 能被 6 整除"}]
)# 图像理解
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"}}
]}
]
)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.cost和usage.credits_remaining。
export AISA_API_KEY="your-key"完整端点文档请参阅 [API 参考](https://docs.aisa.one/reference/)。
已收录 1 个 Skill