跳转到主要内容
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": "qwen2-vl-72b-instruct",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/image.jpg"
          }
        },
        {
          "type": "text",
          "text": "请描述这张图片。"
        }
      ]
    }
  ],
  "max_tokens": 8192,
  "temperature": 1,
  "stream": false
}
'
{
  "id": "<string>",
  "object": "chat.completion",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "<string>",
        "content": "<string>"
      },
      "finish_reason": "<string>"
    }
  ],
  "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

可用选项:
qwen2-vl-72b-instruct
示例:

"qwen2-vl-72b-instruct"

messages
object[]
必填

对话消息列表,支持文本和图片内容。

Minimum array length: 1
示例:
[
  {
    "role": "user",
    "content": [
      {
        "type": "image_url",
        "image_url": { "url": "https://example.com/image.jpg" }
      },
      { "type": "text", "text": "请描述这张图片。" }
    ]
  }
]
max_tokens
integer
默认值:8192

最大生成 Token 数量。

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

采样温度,越高输出越随机。

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

为 true 时通过 SSE 流式返回增量内容。

响应

成功生成响应

id
string
object
string
示例:

"chat.completion"

created
integer

Unix 时间戳

model
string
choices
object[]
usage
object