cURL
single-turn
curl --request POST \ --url https://api.foxapi.cc/v1/chat/completions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "model": "gpt-4o", "messages": [ { "role": "user", "content": "用一句话解释什么是量子计算" } ] } '
{ "id": "chatcmpl-abc123", "object": "chat.completion", "created": 1757165031, "model": "<string>", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 10, "completion_tokens": 50, "total_tokens": 60 } }
使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
模型名称,如 gpt-4o、deepseek-chat、claude-sonnet-4-20250514 等
"gpt-4o"
对话消息列表
Show child attributes
是否流式返回响应
采样温度 (0-2)
0 <= x <= 2
最大生成token数
核采样参数 (0-1)
0 <= x <= 1
对话补全响应
唯一补全ID
"chatcmpl-abc123"
对象类型
chat.completion
创建时间戳
1757165031
使用的模型
用量统计