DragonAI API 文档

DragonAI Engine 提供完全兼容 OpenAI 的 API 接口,使用龙系列模型名称调用大模型。

龙系列模型

模型名称 API 名称 参数规模 参考模型 调用频率
白龙 白龙 white-dragon 80B Qwen3 80B 1分钟/次
绿龙 绿龙 green-dragon 122B Qwen3.5 122B 40秒/次
红龙 红龙 red-dragon 200B MiniMax M2.7 30秒/次
金龙 金龙 gold-dragon 400B Qwen3 Coder 480B 20秒/次
白金龙 白金龙 platinum-dragon 1000B Kimi 2.6 15秒/次
紫金龙 紫金龙 至尊 purplegold-dragon 1.6T DeepSeek-V4-Pro 10秒/次

接口端点

方法 端点 说明
POST /v1/chat/completions 聊天补全(支持流式/非流式)
GET /v1/models 获取可用模型列表

认证方式

在请求头中添加 Authorization: Bearer YOUR_API_KEY,其中 YOUR_API_KEY 为你在控制台获取的客户端 Key(以 dragon- 开头)。

权限说明

不同龙等级的用户可以使用的模型不同:

账号等级限速

⚡ 限速基于账号等级,非模型等级

用户的请求频率限制由其账号龙等级决定,与使用的模型无关。高等级账号使用低等级模型时,仍享受高等级的限速待遇。

账号等级 限速 示例说明
白龙 白龙 60秒/次 白龙用户使用白龙模型,60秒可请求1次
绿龙 绿龙 40秒/次 绿龙用户使用任意可用模型,40秒可请求1次
红龙 红龙 30秒/次 红龙用户使用任意可用模型,30秒可请求1次
金龙 金龙 20秒/次 金龙用户使用任意可用模型,20秒可请求1次
白金龙 白金龙 15秒/次 白金龙用户使用任意可用模型,15秒可请求1次
紫金龙 紫金龙 10秒/次 紫金龙用户使用任意模型(含白龙),10秒可请求1次

💡 限速优势示例:紫金龙用户使用白龙模型时,享受 10秒/次 的限速,而白龙用户使用白龙模型为 60秒/次。升级账号等级可显著提升请求频率!

并发请求支持

⚡ 支持多请求同时处理,实现多Agent协作 · 独立限速

💡 独立限速优势:并发请求不会降低单个请求的速度,反而会增加整个账号的吞吐量。例如5个并发时,整体吞吐速度提升约5倍!

应用场景:多Agent协作开发、并行数据分析、批量文档处理、多人同时使用等场景,都可以充分利用并发能力,显著提升处理速度。

Python 示例代码

⚠️ 重要提示:示例代码中的 dragon-your-api-key 需要替换为您自己的 API Key。

安装依赖

bash
pip install openai

请求参数说明

参数 类型 默认值 说明
model string 必填 龙系列模型名称(如 green-dragon
messages array 必填 对话消息列表
thinking boolean true 是否启用 thinking 模式(深度推理),设为 false 可禁用
stream boolean false 是否启用流式输出
max_tokens integer 8192 最大生成 token 数
temperature float 0.7 温度参数(0-2)

💡 Thinking 模式:启用后,模型会进行深度推理,输出更详细的思考过程。适用于复杂推理、数学计算、代码分析等场景。如需快速响应,可设置 "thinking": false 禁用。

非流式输出

Python
from openai import OpenAI

client = OpenAI(
    api_key="dragon-your-api-key",
    base_url="https://dragonaiengine.com.cn/v1"
)

# 使用白金龙模型(启用 thinking 模式)
response = client.chat.completions.create(
    model="platinum-dragon",  # 龙系列模型名称
    messages=[{"role": "user", "content": "介绍你自己"}],
    thinking=True  # 启用深度推理(默认启用)
)

print(response.choices[0].message.content)

流式输出

Python
from openai import OpenAI

client = OpenAI(
    api_key="dragon-your-api-key",
    base_url="https://dragonaiengine.com.cn/v1"
)

# 使用金龙模型流式输出(禁用 thinking 模式以加快响应)
stream = client.chat.completions.create(
    model="gold-dragon",
    messages=[{"role": "user", "content": "介绍你自己"}],
    thinking=False,  # 禁用深度推理
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

print()

curl 示例

启用 thinking 模式(默认)

bash
curl https://dragonaiengine.com.cn/v1/chat/completions \
  -H "Authorization: Bearer dragon-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "red-dragon",
    "messages": [{"role": "user", "content": "介绍你自己"}],
    "thinking": true
  }'

禁用 thinking 模式

bash
curl https://dragonaiengine.com.cn/v1/chat/completions \
  -H "Authorization: Bearer dragon-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "green-dragon",
    "messages": [{"role": "user", "content": "快速回答:1+1等于几?"}],
    "thinking": false,
    "stream": true
  }'

OpenClaw 配置

1. 找到配置文件

操作系统 文件路径
Windows C:\Users\你的用户名\.openclaw\openclaw.json
macOS / Linux ~/.openclaw/openclaw.json

2. 添加 DragonAI Provider

打开 openclaw.json,找到 "providers" 部分,在其中添加以下配置:

providers 部分添加内容
"dragonai": {
  "baseUrl": "https://dragonaiengine.com.cn/v1",
  "apiKey": "dragon-your-api-key",
  "api": "openai-completions",
  "models": [
    {
      "id": "white-dragon",
      "name": "白龙 - White Dragon (80B)",
      "reasoning": true,
      "input": ["text"],
      "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0},
      "contextWindow": 128000,
      "maxTokens": 8192
    },
    {
      "id": "green-dragon",
      "name": "绿龙 - Green Dragon (122B)",
      "reasoning": true,
      "input": ["text"],
      "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0},
      "contextWindow": 128000,
      "maxTokens": 8192
    },
    {
      "id": "red-dragon",
      "name": "红龙 - Red Dragon (200B)",
      "reasoning": true,
      "input": ["text"],
      "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0},
      "contextWindow": 128000,
      "maxTokens": 8192
    },
    {
      "id": "gold-dragon",
      "name": "金龙 - Gold Dragon (400B)",
      "reasoning": true,
      "input": ["text"],
      "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0},
      "contextWindow": 204800,
      "maxTokens": 131072
    },
    {
      "id": "platinum-dragon",
      "name": "白金龙 - Platinum Dragon (1000B)",
      "reasoning": true,
      "input": ["text", "image"],
      "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0},
      "contextWindow": 262144,
      "maxTokens": 32768
    },
    {
      "id": "purplegold-dragon",
      "name": "紫金龙 - Purple Gold Dragon (1.6T)",
      "reasoning": true,
      "input": ["text"],
      "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0},
      "contextWindow": 262144,
      "maxTokens": 32768
    }
  ]
}

3. 设置默认模型(可选)

"agents""defaults""model" 中设置:

设置默认模型
"model": {
  "primary": "dragonai/platinum-dragon",
  "fallbacks": ["dragonai/red-dragon"]
}

4. 使用模型

模型 调用方式
白龙 白龙 dragonai/white-dragon
绿龙 绿龙 dragonai/green-dragon
红龙 红龙 dragonai/red-dragon
金龙 金龙 dragonai/gold-dragon
白金龙 白金龙 dragonai/platinum-dragon
紫金龙 紫金龙 dragonai/purplegold-dragon

注意:修改配置后需重启 OpenClaw 使配置生效。

错误码说明

状态码 说明
401 API Key 无效或未配置
403 没有权限使用该模型(龙等级不足)
429 请求频率超限,请等待后重试
500 服务器内部错误
502 上游 API 连接失败
504 请求队列超时

📱 关注 "驭龙台开源大模型" 公众号,获取更多资讯和使用方法