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

# Midjourney 文生图

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

使用 [Midjourney](https://midjourney.com) V7 模型从文本生成艺术风格图片。

**模型特点：**

* **独特美学风格** - 业界领先的艺术表现力，风格辨识度高
* **精准提示理解** - V7 版本大幅提升文本指令遵循能力
* **细节完美呈现** - 人体、手部、物体等细节处理更加自然
* **丰富纹理质感** - 图像纹理更加丰富，细节更加连贯


## OpenAPI

````yaml /cn/openapi.yaml POST /generate/k/mj-txt2img
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/mj-txt2img:
    post:
      tags:
        - public
      summary: Midjourney 文生图
      description: 使用 Midjourney AI 模型从文本生成图片（异步）
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ka.CreateMidjourneyTxt2ImgTaskRequest'
        description: Task parameters
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.CreateTaskResponse'
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '402':
          description: Insufficient credits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
      security:
        - AccessToken: []
components:
  schemas:
    ka.CreateMidjourneyTxt2ImgTaskRequest:
      properties:
        aspectRatio:
          description: 宽高比（可选）- 输出宽高比
          enum:
            - '1:2'
            - '9:16'
            - '2:3'
            - '3:4'
            - '5:6'
            - '6:5'
            - '4:3'
            - '3:2'
            - '1:1'
            - '16:9'
            - '2:1'
          example: '16:9'
          type: string
        enableTranslation:
          default: false
          description: 启用翻译（可选，默认 false）- 启用自动翻译
          example: false
          type: boolean
        prompt:
          description: 提示词（必填，最大2000字符）- 生成的文本描述
          example: Help me generate a sci-fi themed fighter jet in a beautiful sky
          maxLength: 2000
          minLength: 1
          type: string
        speed:
          description: 速度（可选）- API 生成速度
          enum:
            - relaxed
            - fast
            - turbo
          example: relaxed
          type: string
        stylization:
          description: 风格化（可选，范围 0-1000）- 艺术风格强度
          example: 1
          maximum: 1000
          minimum: 0
          type: integer
        variety:
          description: 多样性（可选，范围 0-100，步长5）- 内容多样性
          example: 10
          maximum: 100
          minimum: 0
          type: integer
        version:
          description: 版本（可选）- Midjourney 模型版本
          enum:
            - '7'
            - '6.1'
            - '6'
            - '5.2'
            - '5.1'
            - niji6
          example: '7'
          type: string
        waterMark:
          description: 水印（可选）- 水印标识
          example: my_watermark
          type: string
        weirdness:
          description: 怪异度（可选，范围 0-3000）- 创意独特性
          example: 1
          maximum: 3000
          minimum: 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 进行认证

````