1. 准备 API Key
在控制台创建或选择一个 API Key。请求时把 Key 放到Authorization 请求头:
2. 查询可用模型
先调用模型列表,避免手写不存在或当前 Key 不可用的模型名。id 就是后续请求使用的模型名。
3. 发送第一条文本请求
choices[0].message.content 读取文本。
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
用一个最小请求确认 API Key、模型名和返回结构。
Authorization 请求头:
Authorization: Bearer <YOUR_API_KEY>
curl https://kaienapi.com/v1/models \
-H "Authorization: Bearer <YOUR_API_KEY>"
id 就是后续请求使用的模型名。
curl https://kaienapi.com/v1/chat/completions \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"messages": [
{"role": "user", "content": "把这条工单总结成一句话"}
]
}'
choices[0].message.content 读取文本。
curl https://kaienapi.com/v1/images/generations \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "生成一张白底极简耳机产品海报",
"size": "1024x1024",
"quality": "low",
"format": "jpeg",
"n": 1
}'
curl "https://kaienapi.com/v1/dashboard/billing/usage?start_date=2026-05-01&end_date=2026-05-06" \
-H "Authorization: Bearer <YOUR_API_KEY>"