BIMHU AI GatewayDocumentation

Chat Completions

Chat Completions 接口根据消息列表生成模型回复。它使用 OpenAI 兼容的请求结构,支持普通响应和通过 stream: true 发起的流式响应。

Endpoint
/v1/chat/completions
Method
POST
Authentication
Bearer API Key
Request Content-Type
application/json
Supported model
deepseek-v4-flash

普通请求示例

curl
curl https://api.bimhu.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-bimhu-example-key" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [{"role": "user", "content": "你好"}]
  }'

响应示例

json
{
  "choices": [{
    "index": 0,
    "message": {"role": "assistant", "content": "你好!"},
    "finish_reason": "stop"
  }]
}

Stream 流式请求

在请求体中添加 "stream": true。服务端会以数据块持续返回内容,客户端应按 SDK 或 SSE 处理方式逐块读取。

curl
curl https://api.bimhu.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-bimhu-example-key" \
  -d '{"model":"deepseek-v4-flash","stream":true,"messages":[{"role":"user","content":"你好"}]}'

错误情况

常见情况包括 API Key 无效、余额或额度不足、模型不可用、JSON 格式错误,以及网络或上游服务暂时不可用。详见错误处理。

Last updated / 最后更新: