Skip to content

Sora API Examples ​

Retirement Notice

The Sora 2 series models were retired on September 24, 2026 and are no longer available. API requests to these models now return errors. Please migrate to other video generation models (e.g., Veo, Seedance).

Note: sora-2 and sora-2-pro have been retired. See the Supported Models page and the Retired Models table for details.

The Sora2 model is compatible with the OpenAI SDK, you can use the OpenAI SDK to access the Sora2 model.

Basic Configuration ​

Before starting to use the API, please ensure you have obtained an API Key. If not, please refer to Create API Key.

Basic Information ​

  • API Base URL: https://api.agentsflare.com/openai/v1
  • Authentication Method: Bearer Token
  • Content Type: application/json

Request Examples ​

Generate Video ​

bash
curl -X POST "https://api.agentsflare.com/openai/v1/videos" \
  -H "Authorization: Bearer $API_KEY" \
  -F 'prompt=A podium displaying a Porsche sports car, the car slowly rotating in the center.' 
  -F 'model=sora-2-pro' \
python
from openai import OpenAI

client = OpenAI(
    api_key="AGENTSFLARE_API_KEY",
    base_url="https://api.agentsflare.com/openai/v1",
)

response = client.videos.create(
    model="sora-2-pro",
    prompt="A podium displaying a Porsche sports car, the car slowly rotating in the center.",
)

print(response)
javascript
const OpenAI = require('openai');

const client = new OpenAI({
  apiKey: 'AGENTSFLARE_API_KEY',
  baseURL: 'https://api.agentsflare.com/openai/v1',
});

async function main() {
  const video = await client.videos.create({
    model: 'sora-2-pro',
    prompt: 'A podium displaying a Porsche sports car, the car slowly rotating in the center.',
  });
  console.log(video);
}

main();
go
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	openai "github.com/openai/openai-go"
)

func main() {
	client := openai.NewClient(
		openai.WithAPIKey(os.Getenv("AGENTSFLARE_API_KEY")), // or directly: openai.WithAPIKey("xxx")
		openai.WithBaseURL("https://api.agentsflare.com/openai/v1"),
	)

	resp, err := client.Videos.Create(context.Background(), openai.VideoCreateParams{
		Model:  openai.F("sora-2-pro"),
		Prompt: openai.F("A podium displaying a Porsche sports car, the car slowly rotating in the center."),
	})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("%+v\n", resp)
}

Response Example ​

{
  "id": "video_********************",
  "object": "video",
  "created_at": 1768375565,
  "status": "queued",
  "completed_at": null,
  "error": null,
  "expires_at": null,
  "model": "sora-2",
  "progress": 0,
  "prompt": "A podium displaying a Porsche sports car, the car slowly rotating in the center.",
  "remixed_from_video_id": null,
  "seconds": "4",
  "size": "720x1280"
}

Video Status Query ​

Request Examples ​

bash
curl -X GET "https://api.agentsflare.com/openai/v1/videos/video_****************" \
  -H "Authorization: Bearer $API_KEY"
python
from openai import OpenAI

client = OpenAI(
    api_key="AGENTSFLARE_API_KEY",
    base_url="https://api.agentsflare.com/openai/v1",
)

response = client.videos.retrieve(
    video_id="video_********************",
)

print(response)
javascript
import axios from 'axios';

const API_KEY = 'AGENTSFLARE_API_KEY';

const url = 'https://api.agentsflare.com/openai/v1/videos/video_********************';

const headers = {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
};

axios.get(url, { headers })
    .then(response => {
        console.log('Video status:', response.data.status);
    })
    .catch(error => {
        console.error('Error:', error.message);
    });
go
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	openai "github.com/openai/openai-go"
)

func main() {
	client := openai.NewClient(
		openai.WithAPIKey(os.Getenv("AGENTSFLARE_API_KEY")), // or directly: openai.WithAPIKey("xxx")
		openai.WithBaseURL("https://api.agentsflare.com/openai/v1"),
	)

	resp, err := client.Videos.Retrieve(context.Background(), openai.VideoRetrieveParams{
		VideoID: openai.F("video_********************"),
	})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("%+v\n", resp)
}

Response Example ​

json
{
  "id": "video_6967450db3908190beae276e09afbf2c0c650c14325307e6",
  "object": "video",
  "created_at": 1768375565,
  "status": "queued", // queued: video generation in queue, completed: video generation completed
  "completed_at": null,
  "error": null,
  "expires_at": null,
  "model": "sora-2",
  "progress": 0,
  "prompt": "A podium displaying a Porsche sports car, the car slowly rotating in the center.",
  "remixed_from_video_id": null,
  "seconds": "4",
  "size": "720x1280"
}

Alternative: OpenAI-Compatible /v1/videos/generations ​

In addition to the OpenAI SDK videos.create / videos.retrieve interface above, Agentsflare also supports the OpenAI-compatible /v1/videos/generations endpoint. This endpoint uses duration (seconds) instead of seconds in the request/response, and is useful for integrations that expect the videos.generate style.

For detailed parameters, see Sora video generation.

bash
curl https://api.agentsflare.com/v1/videos/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "sora",
    "prompt": "A dog running on the beach",
    "duration": 5
  }'
python
from openai import OpenAI

url = "https://api.agentsflare.com/v1"

client = OpenAI(
    base_url=url,
    api_key="YOUR_API_KEY"
)

video = client.videos.generate(
    model="sora",
    prompt="A dog running on the beach",
    duration=5
)

print(video.data[0].url)

Response Example ​

{
  "created": 1589478378,
  "data": [
    {
      "url": "https://..."
    }
  ]
}

Request Parameters ​

For detailed parameters, see Videos API

Supported Models ​

The following models are available through this interface (sorted by recommendation):

  • sora-2 Retired
  • sora-2-pro Retired

💡 Tip

The model field in the request example can be replaced with any model name above.

This documentation is licensed under CC BY-SA 4.0.