Skip to main content
POST
/
v1
/
chat
/
completions
对话补全
curl --request POST \
  --url https://api.qclawrouter.com/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-4o",
  "messages": [
    {
      "role": "system",
      "content": "<string>"
    }
  ],
  "stream": false,
  "temperature": 1,
  "max_tokens": 123,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0,
  "stop": "<string>"
}
'
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1234567890,
  "model": "gpt-4o",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "你好!有什么我能帮助你的吗?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 20,
    "completion_tokens": 15,
    "total_tokens": 35
  }
}

Authorizations

Authorization
string
header
required

使用您的 API Key 作为 Bearer Token。在控制台创建令牌获取。

Body

application/json
model
string
required

模型名称

Example:

"gpt-4o"

messages
object[]
required

消息列表

stream
boolean
default:false

是否流式输出(SSE)

temperature
number
default:1

温度参数,控制随机性(0-2)

Required range: 0 <= x <= 2
max_tokens
integer

最大输出 token 数

top_p
number
default:1

核采样参数(0-1)

Required range: 0 <= x <= 1
frequency_penalty
number
default:0

频率惩罚(-2 到 2)

presence_penalty
number
default:0

存在惩罚(-2 到 2)

stop

停止序列

Response

成功

id
string
Example:

"chatcmpl-abc123"

object
string
Example:

"chat.completion"

created
integer
Example:

1234567890

model
string
Example:

"gpt-4o"

choices
object[]
usage
object