> ## 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.

# 图片生成（异步按张计费）

> 创建按张计费的图片异步生成任务。任务创建后由平台异步处理生成和结果转存，再通过查询接口返回结果图 URL。



## OpenAPI

````yaml /openapi/gateway-v1.openapi.yaml post /v2/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:
  /v2/images/generations:
    post:
      tags:
        - async-images
      summary: 图片生成（异步按张计费）
      description: 创建按张计费的图片异步生成任务。任务创建后由平台异步处理生成和结果转存，再通过查询接口返回结果图 URL。
      operationId: createAsyncImageGeneration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageGenerationAsyncRequest'
            examples:
              basic:
                value:
                  model: gpt-image-2-async
                  prompt: 一张电影感的未来城市天际线，傍晚，广角镜头
                  size: '16:9'
              withReferenceImage:
                value:
                  model: gpt-image-2-async
                  prompt: 基于参考图生成同风格产品海报
                  size: '1:1'
                  urls:
                    - https://example.com/reference.png
              nanoBanana:
                value:
                  model: nanobanana2-image
                  prompt: A cinematic city skyline at sunset
                  size: '16:9'
                  resolution: 2K
                  urls:
                    - https://example.com/reference.png
      responses:
        '202':
          description: 任务已创建并进入队列。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageGenerationAsyncCreateResponse'
              examples:
                queued:
                  value:
                    id: imgtask_5a16c0f5d2b64b40a86f7f5b21f42a61
                    object: image.generation.task
                    model: gpt-image-2-async
                    status: queued
                    created_at: 1779860000
        '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:
    ImageGenerationAsyncRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          description: 支持图片异步 endpoint 的模型 ID，例如 `gpt-image-2-async`。
          example: gpt-image-2-async
        prompt:
          type: string
          description: 图片生成提示词。
          example: 一张电影感的未来城市天际线，傍晚，广角镜头
        size:
          type: string
          description: 输出比例或尺寸口径，以模型能力为准。常用比例类值例如 `1:1`、`16:9`。
          example: '16:9'
        resolution:
          type: string
          description: NanoBanana 系列分辨率字段，可选 `1K`、`2K`、`4K`；不按分辨率拆分价格。
          enum:
            - 1K
            - 2K
            - 4K
          example: 2K
        urls:
          type: array
          description: 参考图 URL 列表。当前默认最多 8 张。
          items:
            type: string
            format: uri
      additionalProperties: true
      not:
        required:
          - 'n'
      description: 当前异步图片接口不支持 `n` 字段；如需多张图片，请创建多个任务。
    ImageGenerationAsyncCreateResponse:
      type: object
      required:
        - id
        - object
        - model
        - status
        - created_at
      properties:
        id:
          type: string
          example: imgtask_5a16c0f5d2b64b40a86f7f5b21f42a61
        object:
          type: string
          enum:
            - image.generation.task
        model:
          type: string
          example: gpt-image-2-async
        status:
          type: string
          enum:
            - queued
        created_at:
          type: integer
          description: Unix 时间戳，秒。
    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

````