API 文档
完全兼容OpenAI的API接口规范
基础端点
POST https://platform.aitools.cfd/api/v1/chat/completions请求参数
model (string)
要使用的模型ID,目前支持7个模型:openai/gpt-oss-20b、google/gemma-4-31b、zhipu/glm-4-flash、zhipu/glm-4v-flash、zhipu/glm-4.1v-thinking-flash、zhipu/glm-4.6v-flash、zhipu/glm-4.7-flash
messages (array)
对话消息列表,包含role和content字段
速率限制
每个IP每小时最多生成1个API密钥,生成后当前浏览器会在一小时内复用本地密钥; 每个API密钥每3秒最多请求1次。超出限制时返回429 Too Many Requests,请按照Retry-After响应头等待后重试。
响应示例
{
"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密钥 |
| 400 | 不支持的模型名称 |
| 429 | 请求过于频繁 |
| 500 | 服务器内部错误 |
调用示例
cURL
curl -X POST -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model": "zhipu/glm-4.7-flash", "messages": [{
"role": "user",
"content": "你是谁?"
}]}' https://platform.aitools.cfd/api/v1/chat/completions