# Sora2 Text to Video

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/v1/task:
    post:
      summary: Sora2 Text to Video
      deprecated: false
      description: >-
        **⚠️ Deprecation notice — Sora 2 will be discontinued on September 24,
        2026.** OpenAI is removing the Sora 2 models and its Videos API on that
        date and has not announced a replacement, so this endpoint will stop
        working then. For alternatives, see our Veo 3.1, Kling and Wan 2.6 video
        endpoints.


        This is provided as Sora2 Text to Video API.  available models: 

        - sora2-video


        Pricing


        | Model | Price |

        | --- | --- |

        | sora2-video | $0.08/s |


        Note

        - be aware of the endpoint api/v1/task

        - only 720p is available currently
      operationId: sora2/text-to-video
      tags:
        - Endpoints/Sora2
      parameters:
        - name: X-API-Key
          in: header
          description: Your API KEY used for request authorization
          required: true
          example: ''
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  description: the model name, should be 'sora2'
                  enum:
                    - sora2
                  x-apidog-enum:
                    - value: sora2
                      name: ''
                      description: ''
                task_type:
                  type: string
                  description: the task_type
                  enum:
                    - sora2-video
                  x-apidog-enum:
                    - value: sora2-video
                      name: ''
                      description: ''
                input:
                  type: object
                  properties:
                    prompt:
                      type: string
                      description: The text prompt describing the video to generate
                    image_url:
                      type: string
                      description: The url of image used as first frame of generated video
                    aspect_ratio:
                      type: string
                      description: The aspect ratio of the generated video
                      enum:
                        - '16:9'
                        - '9:16'
                      x-apidog-enum:
                        - value: '16:9'
                          name: ''
                          description: ''
                        - value: '9:16'
                          name: ''
                          description: ''
                      default: '16:9'
                    duration:
                      type: integer
                      description: The duration of the generated video in seconds
                      enum:
                        - 4
                        - 8
                        - 12
                      x-apidog-enum:
                        - value: 4
                          name: ''
                          description: ''
                        - value: 8
                          name: ''
                          description: ''
                        - value: 12
                          name: ''
                          description: ''
                      default: 4
                    resolution:
                      type: string
                      description: The resolution of the generated video
                      enum:
                        - 720p
                      x-apidog-enum:
                        - value: 720p
                          name: ''
                          description: ''
                      default: 720p
                  x-apidog-orders:
                    - prompt
                    - image_url
                    - aspect_ratio
                    - duration
                    - resolution
                  required:
                    - prompt
                  description: |
                    the input param of the flux task
                  x-apidog-ignore-properties: []
                config:
                  type: object
                  properties:
                    webhook_config:
                      type: object
                      properties:
                        endpoint:
                          type: string
                        secret:
                          type: string
                      description: >-
                        Webhook provides timely task notifications. Check [PiAPI
                        webhook](/docs/unified-webhook) for detail.
                      x-apidog-orders:
                        - endpoint
                        - secret
                      x-apidog-ignore-properties: []
                    service_mode:
                      type: string
                      description: >
                        This allows users to choose whether this specific task
                        will get processed under PAYG or HYA mode. If
                        unspecified, then this task will get processed under
                        whatever mode (PAYG or HYA)
                         the user chose on the workspace setting of your account.
                        - `public` means this task will be processed under PAYG
                        mode.

                        - `private` means this task will be processed under HYA
                        mode.
                      enum:
                        - public
                        - private
                  x-apidog-orders:
                    - webhook_config
                    - service_mode
                  x-apidog-ignore-properties: []
              x-apidog-refs:
                01J8PNX50491VGB1V6ZTHX081W:
                  $ref: '#/components/schemas/config'
              x-apidog-orders:
                - model
                - task_type
                - input
                - 01J8PNX50491VGB1V6ZTHX081W
              required:
                - model
                - task_type
                - input
              x-apidog-ignore-properties:
                - config
            example:
              model: sora2
              task_type: sora2-video
              input:
                prompt: >-
                  A casual street interview on a busy New York City sidewalk in
                  the afternoon. The interviewer holds a plain, unbranded
                  microphone and asks: Have you seen OpenAI's new Sora2 model It
                  is a super good model. Person replies: Yeah I saw it, it's
                  already available on PiAPI. It's crazy good.
                aspect_ratio: '16:9'
                duration: 4
              config:
                webhook_config:
                  endpoint: https://webhook.site/74ff2ef5-7120-493c-a0ff-123e2554e754
                  secret: ''
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  data:
                    type: object
                    properties:
                      task_id:
                        type: string
                      model:
                        type: string
                      task_type:
                        type: string
                      status:
                        type: string
                        enum:
                          - Completed
                          - Processing
                          - Pending
                          - Failed
                          - Staged
                        x-apidog-enum:
                          - value: Completed
                            name: ''
                            description: ''
                          - value: Processing
                            name: ''
                            description: >-
                              Means that your jobs is currently being processed.
                              Number of "processing" jobs counts as part of the
                              "concurrent jobs"
                          - value: Pending
                            name: ''
                            description: >-
                              Means that we recognizes the jobs you sent should
                              be processed by MJ/Luma/Suno/Kling/etc but right
                              now none of the  account is available to receive
                              further jobs. During peak loads there can be
                              longer wait time to get your jobs from "pending"
                              to "processing". If reducing waiting time is your
                              primary concern, then a combination of
                              Pay-as-you-go and Host-your-own-account option
                              might suit you better.Number of "pending" jobs
                              counts as part of the "concurrent jobs"
                          - value: Failed
                            name: ''
                            description: Task failed. Check the error message for detail.
                          - value: Staged
                            name: ''
                            description: >-
                              A stage only in Midjourney task . Means that you
                              have exceeded the number of your "concurrent jobs"
                              limit and your jobs are being queuedNumber of
                              "staged" jobs does not count as part of the
                              "concurrent jobs". Also, please note the maximum
                              number of jobs in the "staged" queue is 50. So if
                              your operational needs exceed the 50 jobs limit,
                              then please create your own queuing system logic. 
                        description: >-
                          Hover on the "Completed" option and you coult see the
                          explaintion of all status:
                          completed/processing/pending/failed/staged
                      input:
                        type: object
                        properties: {}
                        x-apidog-orders: []
                        x-apidog-ignore-properties: []
                      output:
                        type: object
                        properties:
                          image_url:
                            type: string
                            description: if the result contains only one image
                          image_urls:
                            type: array
                            items:
                              type: string
                            description: if the result contains multiple images
                        x-apidog-orders:
                          - image_url
                          - image_urls
                        x-apidog-ignore-properties: []
                      meta:
                        type: object
                        properties:
                          created_at:
                            type: string
                            description: >-
                              The time when the task was submitted to us (staged
                              and/or pending)
                          started_at:
                            type: string
                            description: >-
                              The time when the task started processing. the
                              time from created_at to time of started_at is time
                              the job spent in the "staged“ stage and/or
                              the"pending" stage if there were any.
                          ended_at:
                            type: string
                            description: The time when the task finished processing.
                          usage:
                            type: object
                            properties:
                              type:
                                type: string
                              frozen:
                                type: number
                              consume:
                                type: number
                            x-apidog-orders:
                              - type
                              - frozen
                              - consume
                            required:
                              - type
                              - frozen
                              - consume
                            x-apidog-ignore-properties: []
                          is_using_private_pool:
                            type: boolean
                        x-apidog-orders:
                          - created_at
                          - started_at
                          - ended_at
                          - usage
                          - is_using_private_pool
                        required:
                          - usage
                          - is_using_private_pool
                        x-apidog-ignore-properties: []
                      detail:
                        type: 'null'
                      logs:
                        type: array
                        items:
                          type: object
                          properties: {}
                          x-apidog-orders: []
                          x-apidog-ignore-properties: []
                      error:
                        type: object
                        properties:
                          code:
                            type: integer
                          message:
                            type: string
                        x-apidog-orders:
                          - code
                          - message
                        x-apidog-ignore-properties: []
                    x-apidog-orders:
                      - task_id
                      - model
                      - task_type
                      - status
                      - input
                      - output
                      - meta
                      - detail
                      - logs
                      - error
                    required:
                      - task_id
                      - model
                      - task_type
                      - status
                      - input
                      - output
                      - meta
                      - detail
                      - logs
                      - error
                    x-apidog-ignore-properties: []
                  message:
                    type: string
                    description: >-
                      If you get non-null error message, here are some steps you
                      chould follow:

                      - Check our [common error
                      message](https://climbing-adapter-afb.notion.site/Common-Error-Messages-6d108f5a8f644238b05ca50d47bbb0f4)

                      - Retry for several times

                      - If you have retried for more than 3 times and still not
                      work, file a ticket on Discord and our support will be
                      with you soon.
                x-apidog-refs: {}
                x-apidog-orders:
                  - code
                  - data
                  - message
                required:
                  - code
                  - data
                  - message
                x-apidog-ignore-properties: []
              example:
                code: 200
                data:
                  task_id: 4eba5893-2a39-4218-b5aa-bb9f3c4a26b2
                  model: sora2
                  task_type: sora2-video
                  status: pending
                  config:
                    service_mode: ''
                    webhook_config:
                      endpoint: >-
                        https://webhook.site/74ff2ef5-7120-493c-a0ff-123e2554e754
                      secret: ''
                  input:
                    prompt: >-
                      A casual street interview on a busy New York City sidewalk
                      in the afternoon. The interviewer holds a plain, unbranded
                      microphone and asks: Have you seen OpenAI's new Sora2
                      model It is a super good model. Person replies: Yeah I saw
                      it, it's already available on PiAPI. It's crazy good.
                    aspect_ratio: '16:9'
                    duration: 4
                  output: null
                  meta:
                    created_at: '2025-10-29T02:33:03.28237536Z'
                    started_at: '0001-01-01T00:00:00Z'
                    ended_at: '0001-01-01T00:00:00Z'
                    usage:
                      type: llm
                      frozen: 0
                      consume: 3200000
                    is_using_private_pool: false
                  detail: null
                  logs: []
                  error:
                    code: 0
                    raw_message: ''
                    message: ''
                    detail: null
                message: success
          headers: {}
          x-apidog-name: Success
      security: []
      x-apidog-folder: Endpoints/Sora2
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/675356/apis/api-23467938-run
components:
  schemas:
    config:
      type: object
      properties:
        config:
          type: object
          properties:
            webhook_config:
              type: object
              properties:
                endpoint:
                  type: string
                secret:
                  type: string
              description: >-
                Webhook provides timely task notifications. Check [PiAPI
                webhook](/docs/unified-webhook) for detail.
              x-apidog-orders:
                - endpoint
                - secret
              x-apidog-ignore-properties: []
            service_mode:
              type: string
              description: >
                This allows users to choose whether this specific task will get
                processed under PAYG or HYA mode. If unspecified, then this task
                will get processed under whatever mode (PAYG or HYA)
                 the user chose on the workspace setting of your account.
                - `public` means this task will be processed under PAYG mode.

                - `private` means this task will be processed under HYA mode.
              enum:
                - public
                - private
          x-apidog-orders:
            - webhook_config
            - service_mode
          x-apidog-ignore-properties: []
      x-apidog-orders:
        - config
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes: {}
servers:
  - url: https://api.piapi.ai
    description: Develop Env
security: []

```
