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

# 中转图像生成（OpenAI 规范）

> 接口说明：兼容 OpenAI /images/generations 规范的图像生成中转接口；OpenAI SDK 默认携带 Authorization: Bearer 头。



## OpenAPI

````yaml /openapi/zh/aitoearn.openapi.json post /api/ai/images/generations
openapi: 3.0.1
info:
  title: AiToEarn 开放平台 API
  description: AiToEarn 开放平台 API，支持在中国站与国际站之间切换调试。业务是否成功以响应体 code === 0 为准。
  version: 1.0.0
  contact: {}
servers:
  - url: https://aitoearn.cn
    description: 中国站
  - url: https://aitoearn.ai
    description: 国际站
security: []
tags:
  - name: AI 服务
  - name: AI 服务/视频生成
  - name: AI 服务/图像生成
  - name: AI 服务/模型中转
  - name: 渠道管理
  - name: 渠道管理/账号
  - name: 渠道管理/内容发布
  - name: 渠道管理/平台
  - name: 渠道管理/互动
  - name: 渠道管理/作品
  - name: 渠道管理/账号分组
  - name: 渠道管理/授权
  - name: 资源管理
paths:
  /api/ai/images/generations:
    post:
      tags:
        - AI 服务/模型中转
      summary: 中转图像生成（OpenAI 规范）
      description: >-
        接口说明：兼容 OpenAI /images/generations 规范的图像生成中转接口；OpenAI SDK 默认携带
        Authorization: Bearer 头。
      operationId: RelayController_imagesGenerations
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RelayImageGenerationDto'
            examples: {}
        required: true
      responses:
        '200':
          description: 第三方协议原生响应或 SSE 数据。不使用 AiToEarn 通用响应包裹。
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                description: 第三方协议原生响应，不使用 AiToEarn 通用响应包裹。
              examples:
                success:
                  summary: 第三方协议原生成功响应
                  value:
                    id: RelayController_imagesGenerations_example
                    object: response
            text/event-stream:
              schema:
                type: string
                description: SSE 流式响应。
      deprecated: false
      security:
        - apikey-header-Authorization: []
components:
  schemas:
    RelayImageGenerationDto:
      type: object
      properties:
        prompt:
          type: string
          description: 提示词
        model:
          type: string
          description: 模型 ID
        'n':
          type: integer
          minimum: 1
          maximum: 9007199254740991
          description: 生成数量
        quality:
          type: string
          description: 质量档位
        response_format:
          type: string
          enum:
            - url
            - b64_json
          description: 返回格式
        size:
          type: string
          description: 图片尺寸大小
        style:
          type: string
          description: 风格参数
        user:
          type: string
          description: 用户标识符
        source:
          type: string
          enum:
            - ai_image
            - ai_draft_generation
            - plugin
          description: 来源
      required:
        - prompt
        - model
      additionalProperties: true
  securitySchemes:
    apikey-header-Authorization:
      type: apiKey
      in: header
      name: Authorization
      description: OpenAI 兼容接口使用，示例：Bearer <token>。

````