> ## 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.

# Sora 2 创建视频 [非官转] API

> 通过文字&图片生成视频

这是 **Sora 2 API** 的核心视频生成接口。

如果你想查看完整的接口目录、推荐接入流程和相关能力，请先阅读 [Sora 2 API 总览](/api/cn/sora)。


## OpenAPI

````yaml openapi/cn/sora.json POST /sora/generations
openapi: 3.1.0
info:
  title: Sora API DOCS
  version: 1.0.0
  description: TTAPI Sora API 接口服务，目前集成了市场上最为领先的视频大模型sora2。
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /sora/generations:
    post:
      description: 通过文字&图片生成视频
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerationsRequest'
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    GenerationsRequest:
      type: object
      description: >-
        **注意**：Flux生成图像接口同步返回的并不是任务的最终结果，任务的最终返回结果需要使用`hookUrl`参数接收异步通知，或者通过<a
        href="fetch" target="_self">Flux查询任务结果</a>接口进行查询。
      properties:
        model:
          type: string
          example: sora-2
          description: sora-2 普通模式  sora-2-pro 高清模式
          enum:
            - sora-2
            - sora-2-pro
        prompt:
          type: string
          description: 生成视频的描述词
        referImages:
          type: array
          items:
            type: string
          enum:
            - >-
              https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg
          description: >-
            垫图数组，**不可传递真实的带有头像的人物图像，或者任何存在的美国产品的Logo。OpanAI规定，会因为不过审导致任务失败。
            目前只会取第一个url** 
        orientation:
          type: string
          description: >-
            sora-2模式下，视频分辨率大体为   720 * 1280，横屏同理  sora-2-pro模式下，竖屏视频分辨率大体为 1024
            *1792，横屏同理
          enum:
            - portrait 竖屏
            - landscape 横屏
        duration:
          type: integer
          description: >-
            视频时长,**25s只在 sora-2-pro 模型下生效** <br/> 支持范围 10 15 25 <br/>
            sora-2模型下默认10s sora-2-pro模型下默认15s
        size:
          type: string
          description: 是否高清（只有sora-2-pro模式下支持，25s时长下只能选择标准清晰度）
          enum:
            - small：标准清晰度
            - large：HD清晰度
          default: small
        character_url:
          type: string
          description: 创建角色需要的视频链接 <br/> **注意视频中一定不能出现真实人物，否则失败**
        character_timestamps:
          type: string
          example: 1,3
          description: >-
            视频角色出现的秒数范围，格式{start},{end}, **注意** end-start 的范围
            1～3秒（结束时间减去开始时间范围为1到3秒）。 
        private:
          type: boolean
          default: 'true'
          description: '生成视频是否设置隐私，true - 隐私访问  false - 公开访问 '
        hookUrl:
          type: string
          description: >-
            回调通知地址，任务完成或失败将通过请地址进行通知，<a href="fetch"
            target="_self">通知数据结构</a>与fetch结构一致。如果未设置，则需要请求<a href="fetch"
            target="_self">fetch接口</a>进行查询
      required:
        - prompt
        - model
  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: jobId
            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 密钥。

````