聊天补全

OpenAI 兼容的聊天补全接口。

接口

POST /api/v1/chat/completions

请求

{
  "model": "openai/gpt-5",
  "messages": [
    { "role": "user", "content": "写一首关于 API 的俳句。" }
  ]
}

curl

curl https://your-domain.com/api/v1/chat/completions \
  -H "Authorization: Bearer $YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5",
    "messages": [
      { "role": "user", "content": "写一首关于 API 的俳句。" }
    ]
  }'

说明

  • 只能使用 /api/v1/models 返回的模型。
  • 只有当上游请求成功时才会扣减积分。
  • 如果 API Key scope 或速率限制不通过,请求会在调用上游前被拒绝。