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

# Grok 图像生成

> 根据文本提示词生成图片，可选传入参考图片实现图生图/编辑。
返回 taskId，使用 /xai/tasks 查询结果



## OpenAPI

````yaml POST /xai/images
openapi: 3.0.0
info:
  title: Xai AI
  description: API documentation for Xai AI
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.mountsea.ai
    description: API Gateway
security: []
tags:
  - name: xai
    description: ''
paths:
  /xai/images:
    post:
      tags:
        - XAI - 图片
      summary: 生成图片
      description: |-
        根据文本提示词生成图片，可选传入参考图片实现图生图/编辑。
        返回 taskId，使用 /xai/tasks 查询结果
      operationId: XaiImageController_generateImage
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateImageDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskIdDto'
      security:
        - bearerAuth: []
components:
  schemas:
    GenerateImageDto:
      type: object
      properties:
        prompt:
          type: string
          maxLength: 5000
          description: 图片描述提示词（最大 5000 字符）
          example: a cute cat sitting on a windowsill
        model:
          type: string
          enum:
            - grok-imagine-image
          description: 图片模型
          example: grok-imagine-image
        aspectRatio:
          enum:
            - '2:3'
            - '3:2'
            - '1:1'
            - '9:16'
            - '16:9'
          type: string
          description: 图片宽高比
        images:
          maxItems: 5
          description: 参考图片 URL（图生图 / 编辑图片，最多 5 张, 提供后图片尺寸跟随参考图片）
          type: array
          items:
            type: string
      required:
        - prompt
        - model
    TaskIdDto:
      type: object
      properties:
        taskId:
          type: string
          description: 任务 ID，用于后续查询结果
      required:
        - taskId
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````