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

# 火山图片生成（官方兼容）

> 用于调用 Seedream 图片生成模型。
请求体采用官方字段语义，支持同步返回；当模型支持时，也可以通过 `stream=true` 获取流式结果。

[查看 Seedream 使用说明](/guides/volcengine-seedream)




## OpenAPI

````yaml /openapi/gateway-v1.openapi.yaml post /volcengine/v3/images/generations
openapi: 3.1.0
info:
  title: WengaoCloud AI Gateway API
  version: 0.1.0
  description: WengaoCloud AI 聚合平台公开 API 契约草案，覆盖 OpenAI 兼容接口、Anthropic 原生接口和平台扩展接口。
servers:
  - url: https://xxx.wengaocloud.com
    description: 问高云 API 网关根域名。OpenAI SDK 的 base_url 使用 https://xxx.wengaocloud.com/v1。
  - url: https://{tenant}.wengaocloud.com
    description: 控制台展示的租户或 OEM API 网关根域名。
    variables:
      tenant:
        default: xxx
security:
  - bearerAuth: []
tags:
  - name: models
    x-group: 模型
  - name: openai-compatible
    x-group: OpenAI 兼容接口
  - name: anthropic-native
    x-group: Anthropic 原生接口
  - name: images-v3
    x-group: 图片（V3 同步）
  - name: volcengine-images
    x-group: 图片（火山直连）
  - name: images
    x-group: 图片（V1 兼容）
  - name: async-images
    x-group: 图片异步任务
  - name: aliwan-images
    x-group: 图片（百炼万相）
  - name: videos
    x-group: 视频
paths:
  /volcengine/v3/images/generations:
    post:
      tags:
        - volcengine-images
      summary: 火山图片生成（官方兼容）
      description: |
        用于调用 Seedream 图片生成模型。
        请求体采用官方字段语义，支持同步返回；当模型支持时，也可以通过 `stream=true` 获取流式结果。

        [查看 Seedream 使用说明](/guides/volcengine-seedream)
      operationId: createVolcengineImageGenerationV3
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VolcengineImageGenerationRequest'
            examples:
              sync:
                summary: 同步文生图
                value:
                  model: doubao-seedream-5-0-lite-260128
                  prompt: 一朵七色花，通透花瓣，纯色背景，质感细腻
                  size: 1024x1024
                  response_format: url
                  output_format: png
                  watermark: false
              withReferenceImages:
                summary: 参考图生成
                value:
                  model: doubao-seedream-5-0-pro-260628
                  prompt: 融合两张参考图的构图与服装风格，保留电影感布光
                  image:
                    - https://example.com/reference-a.png
                    - https://example.com/reference-b.png
                  size: 2048x2048
                  response_format: url
                  optimize_prompt_options:
                    mode: standard
              stream:
                summary: 流式组图
                value:
                  model: doubao-seedream-5-0-lite-260128
                  prompt: 同一位动漫女孩，连续两张表情变化，画风一致
                  stream: true
                  response_format: b64_json
                  sequential_image_generation: auto
                  sequential_image_generation_options:
                    max_images: 2
      responses:
        '200':
          description: |
            同步模式返回 JSON 结果；当请求 `stream=true` 且模型支持流式时，返回 `text/event-stream`。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VolcengineImageGenerationResponse'
              examples:
                success:
                  value:
                    created: 1779860032
                    data:
                      - url: https://cdn.wengaocloud.com/images/ai/example.png
                        size: 1024x1024
                    usage:
                      input_tokens: 320
                      output_tokens: 512
                      total_tokens: 832
            text/event-stream:
              schema:
                type: string
                description: '标准 SSE 文本流。每个 `data:` 行对应一条火山图片事件，最后以 `data: [DONE]` 结束。'
              examples:
                partialAndCompleted:
                  value: >-
                    data:
                    {"type":"image_generation.partial_succeeded","image_index":0,"b64_json":"...","size":"1024x1024"}


                    data:
                    {"type":"image_generation.completed","data":[{"b64_json":"...","size":"1024x1024"}]}


                    data: [DONE]
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientQuota'
        '403':
          $ref: '#/components/responses/Forbidden'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    VolcengineImageGenerationRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          description: 要调用的模型名称。
          example: doubao-seedream-5-0-lite-260128
        prompt:
          type: string
          description: 火山官方提示词字段，必填。
        image:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
          description: 参考图 URL 或 Base64 数据。输入图与输出图分开计费。
        size:
          type: string
          description: 目标输出尺寸，例如 `1024x1024`、`2048x2048`。
          example: 1024x1024
        seed:
          type: integer
          description: 随机种子。
        guidance_scale:
          type: number
          description: 提示词引导强度。
        response_format:
          type: string
          enum:
            - url
            - b64_json
          description: 返回图片内容的格式。
        output_format:
          type: string
          enum:
            - jpeg
            - png
            - webp
          description: 输出图片格式。
        watermark:
          type: boolean
          description: 是否要求带水印输出。
        sequential_image_generation:
          type: string
          description: 顺序组图模式，当前常见值为 `auto`。
          example: auto
        sequential_image_generation_options:
          type: object
          properties:
            max_images:
              type: integer
              minimum: 1
              description: 顺序组图最大张数。
          additionalProperties: true
        stream:
          type: boolean
          description: 是否请求 SSE。模型未开通流式会返回 `400`。
        tools:
          type: array
          description: 工具数组，是否支持取决于具体模型。
          items:
            type: object
            additionalProperties: true
        optimize_prompt_options:
          type: object
          description: 火山官方提示词优化配置。
          properties:
            mode:
              type: string
              example: standard
          additionalProperties: true
      additionalProperties: true
      description: >
        该接口保持火山官方字段语义，不接受 OpenAI 风格的 `n`。

        如果需要组图，请使用 `sequential_image_generation` 和
        `sequential_image_generation_options.max_images`。
    VolcengineImageGenerationResponse:
      type: object
      properties:
        created:
          type: integer
          description: 响应创建时间，Unix 秒。
        data:
          type: array
          items:
            $ref: '#/components/schemas/VolcengineImageResult'
        usage:
          type: object
          additionalProperties: true
          description: 平台透传的上游 usage 字段。
      additionalProperties: true
    VolcengineImageResult:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: 结果图 URL。`response_format=url` 时常见。
        b64_json:
          type: string
          description: Base64 图片数据。`response_format=b64_json` 时常见。
        size:
          type: string
          description: 上游返回的实际图片尺寸，用于最终逐张结算。
          example: 1024x1024
        revised_prompt:
          type: string
          description: 平台透传的最终提示词。
      additionalProperties: true
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              example: invalid_request_error
            code:
              type: string
              example: model_endpoint_mismatch
            message:
              type: string
              example: 该模型不支持当前 endpoint。
  responses:
    BadRequest:
      description: 请求参数无效。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: API Key 缺失或无效。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InsufficientQuota:
      description: 余额或额度不足。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: 模型不可见、API Key 无权限或档位不可用。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ServiceUnavailable:
      description: 当前模型和 endpoint 暂不可用。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      x-default: sk-your-api-key

````