跳转到主要内容
POST
/
v1
/
chat
/
completions
对话补全
curl --request POST \
  --url https://www.anyfast.ai/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "grok-4-1-fast-non-reasoning",
  "messages": [
    {
      "role": "user",
      "content": "你好!"
    }
  ],
  "max_tokens": 2,
  "temperature": 1,
  "top_p": 0.5,
  "stream": false
}
'
{
  "id": "<string>",
  "object": "chat.completion",
  "created": 123,
  "model": "grok-4-1-fast-non-reasoning",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "assistant",
        "content": "<string>"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}

授权

Authorization
string
header
必填

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

请求体

application/json
model
enum<string>
必填

模型 ID

可用选项:
grok-4-1-fast-non-reasoning
示例:

"grok-4-1-fast-non-reasoning"

messages
object[]
必填

对话消息列表。

Minimum array length: 1
示例:
[{ "role": "user", "content": "你好!" }]
max_tokens
integer

生成的最大 token 数。

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

采样温度。

必填范围: 0 <= x <= 2
top_p
number

核采样参数。

必填范围: 0 <= x <= 1
stream
boolean
默认值:false

是否通过 SSE 流式返回。

响应

对话补全创建成功

id
string
object
string
示例:

"chat.completion"

created
integer
model
string
示例:

"grok-4-1-fast-non-reasoning"

choices
object[]
usage
object