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

# Grok 文生图

> 使用 xAI Grok 模型从文本生成图片（异步）

使用 [xAI](https://x.ai) 的 Aurora 图像生成模型，从文本生成高质量图片。

**模型特点：**

* **照片级真实感** - 自回归混合专家架构，生成逼真的人物肖像和实体图像
* **精准指令遵循** - 准确理解并执行复杂的文本描述
* **文字与 Logo 渲染** - 出色的艺术文字和品牌标识生成能力
* **名人/实体识别** - 能准确生成真实世界人物和物体的图像


## OpenAPI

````yaml /cn/openapi.yaml POST /generate/k/grok-text-to-image
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/grok-text-to-image:
    post:
      tags:
        - public
      summary: Grok 文本转图片
      description: 使用 xAI Grok 模型从文本生成图片（异步）
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ka.CreateGrokTextToImageTaskRequest'
        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.CreateGrokTextToImageTaskRequest:
      properties:
        aspect_ratio:
          description: 宽高比（可选）
          enum:
            - '2:3'
            - '3:2'
            - '1:1'
          example: ''
          type: string
        prompt:
          description: 提示词（必填）
          example: A beautiful sunset over the ocean
          maxLength: 5000
          minLength: 1
          type: string
      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 进行认证

````