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

# Generate images

Choose a supported [image model](https://geekai.co/models?type=image). The API uses the [OpenAI Images format](https://platform.openai.com/docs/api-reference/images) and extends it with provider-specific options. To switch providers, change `model` and check which parameters the new model accepts. See the [image model guides](https://docs.geekai.co/en/docs/image/model.md) for examples.


## OpenAPI

````yaml openapi.yaml POST /images/generations
openapi: 3.1.0
info:
  title: 极客智坊 API文档
  description: 极客智坊 API 消息接口规范文档
  version: 1.0.0
servers:
  - url: https://geekai.co/api/v1
    description: 国内代理入口
  - url: https://geekai.dev/api/v1
    description: 海外代理入口
security:
  - bearerAuth: []
  - apiKeyAuth: []
paths:
  /images/generations:
    post:
      tags:
        - Image
      summary: 图片生成接口
      description: 基于文本提示生成AI图片的接口，支持多种图片生成模型和参数配置
      operationId: createImage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  description: 图片生成模型
                  example: gpt-image-1
                prompt:
                  type: string
                  description: 文本提示
                  example: 画一只可爱的小猫
                enhance_prompt:
                  type: boolean
                  description: 是否开启提示词增强
                  default: false
                negative_prompt:
                  type: string
                  description: 反向提示词，用来描述不希望在画面中看到的内容，可以对画面进行限制
                image:
                  oneOf:
                    - type: string
                      description: 单张图片URL/Base64编码数据，仅支持图生图模型支持该配置
                    - type: array
                      description: 多张图片URL/Base64编码数组列表，仅支持图生图模型支持该配置
                      items:
                        type: string
                strength:
                  type: number
                  description: 以图生图引用图片的影响强度，取值范围[0, 1]，默认0.5
                  default: 0.5
                size:
                  type: string
                  description: 图片尺寸，不同模型设置不同，详见模型尺寸表
                  default: 1024x1024
                aspect_ratio:
                  type: string
                  description: 图片宽高比，不同模型设置不同，详见模型尺寸表
                  default: '1:1'
                'n':
                  type: integer
                  description: 图片数量，默认为1
                  default: 1
                quality:
                  type: string
                  description: >-
                    图片质量，可灵AI支持 std、pro 两个配置，OpenAI/智谱清言支持 standard、hd 两个配置，GPT
                    Image支持 auto/low/medium/high 四个配置项
                  default: medium
                style_preset:
                  type: string
                  description: 风格预设，目前仅 stable image 支持该配置
                  example: 3d-model
                response_format:
                  type: string
                  description: 图片响应格式，支持 url/b64_json 两种格式，默认为url
                  enum:
                    - url
                    - b64_json
                  default: url
                output_format:
                  type: string
                  description: 图片输出格式，支持 png/jpg/webp/gif/svg 五种格式，默认为png
                  enum:
                    - png
                    - jpg
                    - webp
                    - gif
                    - svg
                  default: png
                mask:
                  type: string
                  description: 图片遮罩，支持图片URL/Base64编码数据
                markup:
                  type: string
                  description: 图片标记，支持图片URL/Base64编码数据
                watermark:
                  type: boolean
                  description: 是否添加AI生成水印，默认为false，仅部分模型支持
                  default: false
                background:
                  type: string
                  description: >-
                    背景透明度，目前仅 gpt-image/seedream-5.0 系列支持该配置，qwen-image-2.1
                    请通过提示词设置
                  enum:
                    - transparent
                    - opaque
                    - auto
                  default: auto
                extra_body:
                  type: object
                  description: 额外参数配置项，以适配不同画图模型的多样化配置
                  properties:
                    sequential_image_generation:
                      type: string
                      description: 控制是否关闭组图功能，仅 doubao-seedream-4.0 支持该参数，默认disabled
                      enum:
                        - auto
                        - disabled
                      default: disabled
                    sequential_image_generation_options:
                      type: object
                      description: >-
                        组图功能的配置，仅当 sequential_image_generation 为 auto 时生效。仅
                        doubao-seedream-4.0 支持该参数。
                      properties:
                        max_images:
                          type: integer
                          description: 组图张数，取值范围1-15，默认15
                          default: 15
                    layer_decomposition:
                      type: boolean
                      description: >-
                        控制是否开启图层拆分功能，仅
                        doubao-seedream-5.0-pro/doubao-seedream-5.5 支持该参数，默认
                        false
                      default: false
                    layer_decomposition_options:
                      type: object
                      description: >-
                        图层拆分功能的配置，仅当 layer_decomposition 为 true 时生效。仅
                        doubao-seedream-5.5 支持该参数。
                      properties:
                        max_images:
                          type: integer
                          description: 最大输出图层数，取值范围1-99，默认30
                          default: 30
                        text_recognition:
                          type: boolean
                          description: 是否开启OCR功能，仅 doubao-seedream-5.5 支持该参数，默认 false
                          default: false
                    prompt_extend_mode:
                      type: string
                      description: 提示词扩写模式，仅 qwen-image-2.1/3.0 系列支持该参数，默认 direct
                      enum:
                        - direct
                        - agent
                      default: direct
                    enable_thinking:
                      type: boolean
                      description: 是否开启思考模式，仅 qwen-image-2.1/3.0/wan2.7 系列支持该参数，默认 false
                      default: false
                    frame_count:
                      type: integer
                      description: 动画帧数，仅 gif 输出格式支持该参数，取值范围2-16，默认9
                      default: 9
                    frame_duration_ms:
                      type: integer
                      description: 动画每帧的持续时间，单位毫秒，仅 gif 输出格式支持该参数，默认200
                      default: 200
                    svg:
                      type: object
                      description: SVG 配置，仅 svg 输出格式支持该参数，具体配置项根据实际需求定义
                      properties:
                        model:
                          type: string
                          description: SVG 模型配置，仅 svg 输出格式支持该参数
                        reasoning:
                          type: object
                          description: SVG 推理配置，仅 svg 输出格式支持该参数
                          properties:
                            effort:
                              type: string
                              description: SVG 推理努力程度，仅 svg 输出格式支持该参数，和对话思考模式类似，控制推理的深度
                              enum:
                                - none
                                - minimal
                                - low
                                - medium
                                - high
                                - xhigh
                                - max
                async:
                  type: boolean
                  description: 是否异步生成，默认false，即同步等待图片生成成功后返回生成结果，如果异步需要通过调用图片获取接口获取生成结果
                  default: false
                retries:
                  type: integer
                  description: 自动重试次数，默认0，表示失败不重试
                  default: 0
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                required:
                  - created
                  - data
                properties:
                  task_id:
                    type: string
                    description: 图片生成任务ID
                    format: uuid
                  task_status:
                    type: string
                    description: 任务状态
                    enum:
                      - pending
                      - running
                      - succeed
                      - failed
                    example: running
                  created:
                    type: integer
                    description: 创建时间戳
                    format: unix-timestamp
                  data:
                    type: array
                    description: 生成的图片列表(仅在task_status=succeed时返回)
                    items:
                      type: object
                      required:
                        - url
                      properties:
                        url:
                          type: string
                          description: 图片URL
                          format: uri
                        b64_json:
                          type: string
                          description: 图片Base64编码数据
                          format: base64
                        revised_prompt:
                          type: string
                          description: 优化后的提示文本
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '413':
          description: 提示文本过长
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          $ref: '#/components/responses/StandardError'
components:
  responses:
    ValidationError:
      description: 参数验证错误
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: validation_error
              message:
                type: string
                example: 参数验证失败
              details:
                type: object
                additionalProperties:
                  type: string
                example:
                  field: 错误描述
    Unauthorized:
      description: 未授权
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: unauthorized
              message:
                type: string
                example: Invalid API key or token
    StandardError:
      description: 标准错误响应
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: 错误代码
          example: invalid_request
        message:
          type: string
          description: 错误信息描述
          example: 请求参数不合法
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: API认证token
    apiKeyAuth:
      type: apiKey
      in: header
      name: GeekAI-API-Key
      description: API密钥认证

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.