> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyfast.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 对话补全

> 使用豆包模型创建对话补全。`content` 支持纯文本字符串或内容块数组（多模态）。

多模态内容类型：`text`、`image_url`、`video_url`。




## OpenAPI

````yaml zh/api-reference/endpoints/openapi/doubao/openapi.yaml POST /v1/chat/completions
openapi: 3.1.0
info:
  title: 豆包兼容接口
  description: 通过 Anyfast 使用火山方舟 Ark Chat API 兼容端点访问豆包模型
  version: 1.0.0
servers:
  - url: https://www.anyfast.ai
security:
  - bearerAuth: []
paths:
  /v1/chat/completions:
    post:
      summary: 对话补全
      description: |
        使用豆包模型创建对话补全。`content` 支持纯文本字符串或内容块数组（多模态）。

        多模态内容类型：`text`、`image_url`、`video_url`。
      operationId: createDoubaoCompletion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
              properties:
                model:
                  type: string
                  enum:
                    - doubao-seed-2.0-pro
                    - doubao-seed-2.0-code
                    - doubao-seed-2.0-lite
                    - doubao-seed-2.0-mini
                    - doubao-seed-1-8-251228
                    - doubao-seed-1-6-flash-250828
                    - doubao-seed-1-6-251015
                    - doubao-seed-1-6-lite-251015
                    - doubao-seed-1-6-vision-250815
                    - glm-4.7
                  description: 使用的模型。
                  example: doubao-seed-1-6-251015
                messages:
                  type: array
                  minItems: 1
                  description: >
                    对话消息列表，每条包含 `role` 和 `content`。


                    content 数组项类型：

                    - `text`：`{"type": "text", "text": "..."}`

                    - `image_url`：`{"type": "image_url", "image_url": {"url":
                    "https://..."}}`

                    - `video_url`：`{"type": "video_url", "video_url": {"url":
                    "https://...", "fps": 2}}`
                  items:
                    type: object
                    required:
                      - role
                      - content
                    properties:
                      role:
                        type: string
                        enum:
                          - system
                          - user
                          - assistant
                          - tool
                        description: 消息角色。
                        example: user
                      content:
                        type: array
                        description: 内容块数组。
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - text
                                - image_url
                                - video_url
                              description: 内容类型。
                              example: text
                            text:
                              type: string
                              description: 文本内容（`text`）。
                              example: 图片里有什么？
                            image_url:
                              type: object
                              description: 图片引用（`image_url`）。
                              properties:
                                url:
                                  type: string
                                  description: 图片 URL 或 Base64 Data URI。
                                  example: >-
                                    https://ark-project.tos-cn-beijing.volces.com/doc_image/ark_demo_img_1.png
                            video_url:
                              type: object
                              description: 视频引用（`video_url`）。
                              properties:
                                url:
                                  type: string
                                  description: 视频 URL 或 Base64 Data URI（mp4/mov，最大 50 MB）。
                                fps:
                                  type: number
                                  minimum: 0.2
                                  maximum: 5
                                  default: 1
                                  description: 每秒抽帧数，默认 `1`，范围 `0.2–5`。
                  example:
                    - role: user
                      content:
                        - type: image_url
                          image_url:
                            url: >-
                              https://ark-project.tos-cn-beijing.volces.com/doc_image/ark_demo_img_1.png
                        - type: text
                          text: 图片里有什么？
                max_tokens:
                  type: integer
                  minimum: 1
                  description: 生成的最大 token 数。
                  example: 1024
                temperature:
                  type: number
                  minimum: 0
                  maximum: 2
                  default: 1
                  description: 采样温度。
                top_p:
                  type: number
                  minimum: 0
                  maximum: 1
                  description: 核采样参数。
                stream:
                  type: boolean
                  default: false
                  description: 是否通过 SSE 流式返回。
                stop:
                  type: array
                  items:
                    type: string
                  description: 最多 4 个停止序列。
      responses:
        '200':
          description: 对话补全创建成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: chatcmpl-abc123
                  object:
                    type: string
                    example: chat.completion
                  created:
                    type: integer
                    example: 1774236644
                  model:
                    type: string
                    example: doubao-seed-1-6-251015
                  choices:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: integer
                        message:
                          type: object
                          properties:
                            role:
                              type: string
                              example: assistant
                            content:
                              type: string
                              example: 图片里有3个模型：Doubao-Seed-1.8、DeepSeek-V3.2、GLM-4.7。
                            reasoning_content:
                              type: string
                              description: 思维链推理内容。
                        finish_reason:
                          type: string
                          enum:
                            - stop
                            - length
                            - tool_calls
                  usage:
                    type: object
                    properties:
                      prompt_tokens:
                        type: integer
                        example: 1355
                      completion_tokens:
                        type: integer
                        example: 87
                      total_tokens:
                        type: integer
                        example: 1442
                      completion_tokens_details:
                        type: object
                        properties:
                          reasoning_tokens:
                            type: integer
                            example: 53
        '400':
          description: 请求参数有误
        '401':
          description: 未授权
        '429':
          description: 请求过多
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````