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

# GPT-4o 生成图像

> 根据文本提示以及图片资源生成图片

<Note>
  注意：由于openai目前暂未以api形式提供该接口，所以该接口目前为逆向接口。稳定性可能存在波动，目前整体定价较为便宜，后续官方正式上线后，可能会同步调整接口字段以及定价。
</Note>


## OpenAPI

````yaml openapi/cn/openai.json POST /openai/4o-image/generations
openapi: 3.1.0
info:
  title: Open AI API DOCS
  version: 1.0.0
  description: TTAPI Open AI API 接口服务
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /openai/4o-image/generations:
    post:
      description: 根据文本提示以及图片资源生成图片
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FourgenerationsRequest'
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      deprecated: true
      security:
        - CustomApiKey: []
components:
  schemas:
    FourgenerationsRequest:
      type: object
      properties:
        prompt:
          type: string
          description: >-
            生成图片文字提示，因为目前为逆向模型，建议文案提示存在关键字：** “画一张xxx”, “生成一张”，'draw a xxx'， **
            具体语言不限制，openai本身就支持多语言模型，中文支持也非常友好。
        referImages:
          type: array
          description: 垫图数组
          enum:
            - >-
              https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg
            - >-
              https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg
        hookUrl:
          type: string
          description: >-
            回调通知地址，任务完成或失败将通过请地址进行通知，<a href="fetch"
            target="_self">通知数据结构</a>与fetch结构一致。如果未设置，则需要请求<a href="fetch"
            target="_self">fetch接口</a>进行查询
      required:
        - prompt
  responses:
    SuccessResponse:
      description: 请求成功
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: SUCCESS
              message:
                type: string
                example: success
              data:
                type: object
                example:
                  jobId: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            required:
              - status
              - message
              - data
    400Response:
      description: 参数错误
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: '"prompt" cannot be empty.'
              data:
                type: object
            required:
              - status
              - message
    401Response:
      description: 授权失败
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: Wrong TT-API-KEY or email is not activated.
            required:
              - status
              - message
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        请前往 <a href='https://dashboard.ttapi.io' target='_blank'>TTAPI 控制台</a>
        获取 API 密钥。

````