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

# Sora 2 Video Generation

> OpenAI Sora 2 Video Generation API - Supports text-to-video and image-to-video with audio-video sync

## Overview

Sora 2 is OpenAI's revolutionary video generation model released on October 1, 2025, achieving the industry's first audio-video synchronized generation, significantly improved physical realism, and support for coherent narrative videos up to 15 seconds long.

<Info>
  **APIYI was first to integrate official Sora 2 API**, no invitation code needed, pricing from only \$0.15/call, supporting both text-to-video and image-to-video modes.
</Info>

## Core Features

<CardGroup cols={2}>
  <Card title="Audio-Video Sync" icon="audio-waveform">
    First-ever audio-video synchronized generation
  </Card>

  <Card title="Physical Realism" icon="box">
    Significantly improved physical realism
  </Card>

  <Card title="Long Video Support" icon="clock">
    Supports up to 16 seconds of coherent narrative
  </Card>

  <Card title="Watermark-free Output" icon="sparkles">
    Generated videos have no watermark (official site has watermarks)
  </Card>
</CardGroup>

## Model Pricing

| Model Name                  | Description              | Resolution               | Price       | Stability             |
| --------------------------- | ------------------------ | ------------------------ | ----------- | --------------------- |
| `sora_video2`               | Default portrait version | 720 × 1280               | \$0.12/call | High                  |
| `sora_video2-landscape`     | Landscape version        | 1280 × 720               | \$0.12/call | High                  |
| `sora_video2-15s`           | Portrait 15s video       | 720 × 1280               | \$0.12/call | High                  |
| `sora_video2-landscape-15s` | Landscape 15s video      | 1280 × 720               | \$0.12/call | High                  |
| `sora-2-pro`                | Pro account version      | 1024 × 1792, 1792 × 1024 | \$0.8/call  | Now working properly! |

<Note>
  * Async call recommended - various errors won't incur charges;
  * Synchronous call supports streaming output to view progress;
  * Video storage valid for 1 day, download promptly;
  * Sora 2 standard versions actually output 704 px (not 720 px), this is the official behavior;
</Note>

## Calling Methods

### Endpoint Address

```
https://api.apiyi.com/v1/chat/completions
```

### Text-to-Video

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.apiyi.com/v1/chat/completions" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "sora_video2",
      "stream": true,
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "type": "text",
              "text": "@sama singing by West Lake: Happy Birthday"
            }
          ]
        }
      ]
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_API_KEY",
      base_url="https://api.apiyi.com/v1"
  )

  response = client.chat.completions.create(
      model="sora_video2",
      stream=True,
      messages=[
          {
              "role": "user",
              "content": [
                  {
                      "type": "text",
                      "text": "@sama singing by West Lake: Happy Birthday"
                  }
              ]
          }
      ]
  )

  for chunk in response:
      if chunk.choices[0].delta.content:
          print(chunk.choices[0].delta.content, end='')
  ```
</CodeGroup>

### Image-to-Video

Supports uploading 1 reference image to generate video. Supports both URL and Base64 upload methods.

<CodeGroup>
  ```bash cURL (URL) theme={null}
  curl -X POST "https://api.apiyi.com/v1/chat/completions" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "sora_video2",
      "stream": true,
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "type": "text",
              "text": "Bring this scene to life with vivid details"
            },
            {
              "type": "image_url",
              "image_url": {
                "url": "https://example.com/image.jpg"
              }
            }
          ]
        }
      ]
    }'
  ```

  ```python Python (Base64) theme={null}
  import base64
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_API_KEY",
      base_url="https://api.apiyi.com/v1"
  )

  # Read and encode image
  with open("image.jpg", "rb") as f:
      image_data = base64.b64encode(f.read()).decode('utf-8')
      image_url = f"data:image/jpeg;base64,{image_data}"

  response = client.chat.completions.create(
      model="sora_video2",
      stream=True,
      messages=[
          {
              "role": "user",
              "content": [
                  {
                      "type": "text",
                      "text": "Bring this scene to life with vivid details"
                  },
                  {
                      "type": "image_url",
                      "image_url": {
                          "url": image_url
                      }
                  }
              ]
          }
      ]
  )

  for chunk in response:
      if chunk.choices[0].delta.content:
          print(chunk.choices[0].delta.content, end='')
  ```
</CodeGroup>

## Response Format

### Streaming Output

When `stream: true`, API returns SSE format progress updates:

```
data: {"choices":[{"delta":{"content":"> ⌛️ Task queued, please wait patiently...\n\n"}}]}

data: {"choices":[{"delta":{"content":"> 🏃 Progress: 36.0%\n\n"}}]}

data: {"choices":[{"delta":{"content":"> 🏃 Progress: 44.7%\n\n"}}]}

data: {"choices":[{"delta":{"content":"> ✅ Video generated successfully, [click here](https://example.com/video.mp4) to view video~~~\n\n"}}]}

data: [DONE]
```

### Generation Time

* Queue waiting: Depends on peak hours
* Video generation: About 2-3 minutes (10-second video)
* Total time: Usually 2.5-4 minutes

<Warning>
  Set request timeout to at least 5 minutes to avoid premature disconnection.
</Warning>

## Use Cases

### 1. AI Chat Clients

Use in OpenAI API-compatible clients like Cherry Studio, ChatBox:

1. Configure APIYI Base URL and API Key
2. Select `sora_video2` model
3. Enable video generation feature
4. Input prompt or upload image to generate video

For detailed configuration: [Cherry Studio Configuration Guide](/en/scenarios/chat/cherry-studio)

### 2. Code Integration

Directly integrate Sora 2 API into your application:

* Supports standard OpenAI SDK
* Compatible with `/v1/chat/completions` endpoint
* Full streaming output support
* Detailed progress feedback

## FAQ

<AccordionGroup>
  <Accordion title="How to control portrait/landscape orientation?">
    By selecting different model names:

    * `sora_video2` or `sora_video2-portrait`: Portrait (704×1280)
    * `sora_video2-landscape`: Landscape (1280×704)
  </Accordion>

  <Accordion title="Are generated videos watermarked?">
    Videos generated via APIYI have no watermark, while videos from the official sora.com site have Sora watermarks.
  </Accordion>

  <Accordion title="Will I be charged if content violates policies?">
    If prompts or images violate content policies (such as real faces, copyrighted materials), the request returns an error but is still charged because the server has processed the request and OpenAI returned error content (without producing a video). Recommended to adjust content: including prompts or replace reference images. Suggest testing content boundaries on Sora.com official site first, then run large batches via API after confirming content is acceptable. Also welcome to communicate with our staff.
  </Accordion>

  <Accordion title="What if video generation fails?">
    If you receive a "We're under heavy load" error, it means official servers are overloaded. Simply retry, and no charge will be incurred in this case.
  </Accordion>

  <Accordion title="How long are videos stored?">
    Videos are stored on CDN for 1 day. Please download to local storage immediately after generation.
  </Accordion>
</AccordionGroup>

## Advanced Features

### HD Video Generation

Use Pro version model:

```json theme={null}
{
  "model": "sora-2-pro",
  "messages": [...]
}
```

* Resolution: 1024 × 1792
* Supports 15-second output
* Price: \$1.0/call（暂停）

## Technical Support

For questions, visit:

* 📖 [Use Cases Documentation](/en/scenarios)
* 💬 [FAQ](/en/faq/model-selection-guide)
* 🔧 [API Manual](/en/api-manual)
