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

# Imagen 4

> 使用 Imagen4 模型生成图片（异步）

使用 [Google DeepMind](https://deepmind.google) 的 Imagen 4 模型生成高质量图片。

**模型特点：**

* **2K 高分辨率** - 支持生成高达 2K 分辨率的精细图像
* **逼真纹理细节** - 出色的织物、水滴、动物毛发等材质渲染
* **精准文字排版** - 显著改进的文字和排版生成能力
* **SynthID 水印** - 内置隐形数字水印，可识别 AI 生成内容


## OpenAPI

````yaml /cn/openapi.yaml POST /generate/k/imagen4
openapi: 3.0.0
info:
  contact:
    email: support@sinancode.com
    name: API Support
    url: https://sinancode.com/support
  description: AI 模型任务调度平台 API
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  termsOfService: https://sinancode.com/terms-of-service
  title: TikTomato API
  version: '1.0'
servers:
  - url: https://api.sinancode.com/v1
    description: Production server
security: []
paths:
  /generate/k/imagen4:
    post:
      tags:
        - public
      summary: Imagen4 图片生成
      description: 使用 Imagen4 模型生成图片（异步）
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ka.CreateImagen4TaskRequest'
        description: 任务参数
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.CreateTaskResponse'
        '400':
          description: 参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '500':
          description: 服务器错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
      security:
        - AccessToken: []
components:
  schemas:
    ka.CreateImagen4TaskRequest:
      properties:
        aspect_ratio:
          default: '1:1'
          description: 宽高比（可选，默认 1:1）
          enum:
            - '1:1'
            - '16:9'
            - '9:16'
            - '3:4'
            - '4:3'
          example: '1:1'
          type: string
        negative_prompt:
          description: 反向提示词（可选）
          example: blurry, low quality
          type: string
        num_images:
          default: 1
          description: 生成图片数量（可选，1-4张，默认1）
          example: 1
          maximum: 4
          minimum: 1
          type: integer
        prompt:
          description: 提示词（必填，最大5000字符）
          example: a futuristic cityscape at sunset
          maxLength: 5000
          minLength: 1
          type: string
        seed:
          description: 随机种子（可选，整数类型）
          example: 0
          type: integer
      required:
        - prompt
      type: object
    dto.CreateTaskResponse:
      properties:
        task_id:
          description: Task ID
          example: 01234567-89ab-cdef-0123-456789abcdef
          type: string
      required:
        - task_id
      type: object
    apierror.ErrorResponse:
      properties:
        error_code:
          description: Machine-readable error code (e.g. TASK.INVALID_PARAMS)
          type: string
        message:
          description: User-friendly error message
          type: string
      type: object
  securitySchemes:
    AccessToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 请使用您的 API Token 进行认证

````