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

# gpt-image-1

> 使用 GPT Image 1 模型从文本提示生成图像。



## OpenAPI

````yaml zh/api-reference/model-api/openai/openapi/gpt-image-1/openapi.yaml POST /v1/images/generations
openapi: 3.1.0
info:
  title: GPT Image 1
  description: 通过 AnyFast API 使用 GPT Image 1 生成图像
  version: 1.0.0
servers:
  - url: https://www.anyfast.ai
security:
  - bearerAuth: []
paths:
  /v1/images/generations:
    post:
      summary: 生成图像
      description: 使用 GPT Image 1 模型从文本提示生成图像。
      operationId: createGptImage1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  enum:
                    - gpt-image-1
                  description: 模型 ID
                  example: gpt-image-1
                prompt:
                  type: string
                  description: 图像描述文本
                  example: 一只穿着太空服漂浮在银河中的可爱猫咪
                'n':
                  type: integer
                  minimum: 1
                  maximum: 4
                  default: 1
                  description: 生成图片数量
                  example: 1
                size:
                  type: string
                  enum:
                    - 1024x1024
                    - 1536x1024
                    - 1024x1536
                    - auto
                  default: auto
                  description: 输出图片尺寸
                  example: 1024x1024
                quality:
                  type: string
                  enum:
                    - low
                    - medium
                    - high
                  default: medium
                  description: 图片质量
                  example: high
                output_format:
                  type: string
                  enum:
                    - png
                    - webp
                    - jpeg
                  default: png
                  description: 输出图片格式
                  example: png
                background:
                  type: string
                  enum:
                    - transparent
                    - opaque
                  default: opaque
                  description: 背景设置，`transparent` 为透明背景，`opaque` 为不透明背景
                  example: opaque
                moderation:
                  type: string
                  enum:
                    - auto
                    - low
                  default: auto
                  description: 内容审核级别
                  example: auto
                output_compression:
                  type: integer
                  minimum: 0
                  maximum: 100
                  description: jpeg 和 webp 格式的压缩级别（0-100%）
                  example: 80
      responses:
        '200':
          description: 图像生成成功。
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    description: 生成的图片数组
                    items:
                      type: object
                      properties:
                        b64_json:
                          type: string
                          description: Base64 编码的图片数据
                        revised_prompt:
                          type: string
                          description: 模型修改后的提示词
        '400':
          description: 请求错误。参数无效。
        '401':
          description: 未授权。API 密钥无效或缺失。
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````