返回首页

API 文档

完全兼容OpenAI的API接口规范

基础端点

POST https://platform.aitools.cfd/api/v1/chat/completions

请求参数

model (string)

要使用的模型ID,目前支持:deepseek/deepseek-r1、deepseek/deepseek-v3、deepseek/deepseek-v3-0324、deepseek/deepseek-r1-32b、deepseek/deepseek-r1-70b、qwen/qwq-32b、qwen/qwen2.5-7b、zhipu/glm-4-9b、zhipu/glm-4-flash、zhipu/glm-4v-flash

messages (array)

对话消息列表,包含role和content字段

响应示例

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Hello! How can I help you today?"
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 12,
    "total_tokens": 21
  }
}

错误代码

状态码说明
401无效的API密钥
402不支持的模型名称
429请求过于频繁
500服务器内部错误

调用示例

cURL

curl -X POST   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"model": "deepseek/deepseek-v3-0324", "messages": [{
      "role": "user",
      "content": "你是谁?"
    }]}'   https://platform.aitools.cfd/api/v1/chat/completions