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

# Submit a KIE-compatible GPT Image 2 text-to-image task



## OpenAPI

````yaml /openapi/gateway-openapi.json post /kie/api/v1/jobs/createTask
openapi: 3.1.0
info:
  title: YIR Async AI Gateway
  version: 1.0.0-stage3a2
  description: >-
    Source-compatible asynchronous image generation routes certified by YIR.
    Authenticate every request with a YIR API key. Provider credentials are
    managed by YIR and must never be sent by clients.
servers:
  - url: https://gateway.yir.ai
    description: YIR production Gateway
security:
  - BearerAuth: []
tags:
  - name: KIE GPT Image 2
  - name: APIMart GPT Image 2
paths:
  /kie/api/v1/jobs/createTask:
    post:
      tags:
        - KIE GPT Image 2
      summary: Submit a KIE-compatible GPT Image 2 text-to-image task
      operationId: submitKIEGPTImage2TextToImage
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Optional caller-generated key. Reusing a key with a different
            request is rejected.
          schema:
            type: string
            maxLength: 255
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KIECreateTaskRequest'
            example:
              model: gpt-image-2-text-to-image
              input:
                prompt: A quiet observatory above a sea of clouds
                resolution: 1K
                aspect_ratio: '16:9'
      responses:
        '200':
          description: Task accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KIESubmitResponse'
        default:
          $ref: '#/components/responses/KIEError'
      security:
        - BearerAuth: []
components:
  schemas:
    KIECreateTaskRequest:
      type: object
      additionalProperties: false
      required:
        - model
        - input
      properties:
        model:
          type: string
          const: gpt-image-2-text-to-image
        input:
          type: object
          additionalProperties: false
          required:
            - prompt
            - resolution
            - aspect_ratio
          properties:
            prompt:
              $ref: '#/components/schemas/Prompt'
            resolution:
              $ref: '#/components/schemas/ImageResolutionKIE'
            aspect_ratio:
              $ref: '#/components/schemas/ImageAspectRatio'
      description: >-
        The JSON body must be no larger than 256 KiB. Unknown fields are
        rejected.
    KIESubmitResponse:
      type: object
      additionalProperties: false
      required:
        - code
        - msg
        - data
      properties:
        code:
          type: integer
          const: 200
        msg:
          type: string
          const: success
        data:
          type: object
          additionalProperties: false
          required:
            - taskId
          properties:
            taskId:
              $ref: '#/components/schemas/PositiveTaskID'
    Prompt:
      type: string
      minLength: 1
      maxLength: 20000
      pattern: \S
      description: Non-blank Unicode text prompt
    ImageResolutionKIE:
      type: string
      enum:
        - 1K
        - 2K
        - 4K
    ImageAspectRatio:
      type: string
      enum:
        - auto
        - '1:1'
        - '3:2'
        - '2:3'
        - '4:3'
        - '3:4'
        - '5:4'
        - '4:5'
        - '16:9'
        - '9:16'
        - '2:1'
        - '1:2'
        - '3:1'
        - '1:3'
        - '21:9'
        - '9:21'
      description: >-
        Some KIE resolution/aspect-ratio combinations are unsupported: auto
        requires 1K; 1:1 rejects 4K; 5:4, 4:5, 3:1, 1:3 and 9:21 require 1K.
    PositiveTaskID:
      type: string
      pattern: ^[1-9][0-9]*$
      description: Positive decimal YIR task ID
    KIEErrorResponse:
      type: object
      additionalProperties: false
      required:
        - code
        - msg
        - data
      properties:
        code:
          type: integer
          description: HTTP status code
        msg:
          type: string
          description: Safe public error message
        data:
          type: 'null'
  responses:
    KIEError:
      description: KIE-compatible safe error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/KIEErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: YIR_API_KEY
      description: >-
        Use Authorization: Bearer <YIR_API_KEY>. Upstream provider keys are not
        accepted.

````