跳转到主要内容
POST
Chat Completion

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求体

application/json
model
enum<string>
必填

Model ID

可用选项:
claude-opus-4-8
示例:

"claude-opus-4-8"

messages
object[]
必填

A list of messages comprising the conversation so far.

Minimum array length: 1
示例:
max_tokens
integer
默认值:8192

The maximum number of tokens to generate.

必填范围: 1 <= x <= 8192
temperature
number
默认值:1

Sampling temperature. Higher values make output more random.

必填范围: 0 <= x <= 2
示例:

1

frequency_penalty
number
默认值:0

Penalizes repeated tokens based on their frequency in the text so far.

必填范围: -2 <= x <= 2
presence_penalty
number
默认值:0

Penalizes tokens that have already appeared in the text.

必填范围: -2 <= x <= 2
stream
boolean
默认值:false

If true, stream partial message deltas using SSE.

stop

Sequences where the model will stop generating further tokens.

响应

Completion generated successfully

id
string
必填
示例:

"chatcmpl-abc123"

object
string
必填
示例:

"chat.completion"

created
integer
必填

Unix timestamp

model
string
必填
示例:

"claude-opus-4-8"

choices
object[]
必填
usage
object