Sora API Examples
Deprecation Notice
The Sora 2 series models are being deprecated and will be taken offline soon. Please migrate to other video generation models (e.g., Veo, Seedance) as soon as possible. Once retired, this model will no longer be available and API requests will return errors.
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
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' \from openai import OpenAI
client = openai.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)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();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
curl -X GET "https://api.agentsflare.com/openai/v1/videos/video_****************" \
-H "Authorization: Bearer $API_KEY"from openai import OpenAI
client = openai.OpenAI(
api_key="AGENTSFLARE_API_KEY",
base_url="https://api.agentsflare.com/openai/v1",
)
response = client.videos.retrieve(
video_id="video_********************",
)
print(response)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);
});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
{
"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"
}Request Parameters
For detailed parameters, see Sora video generation
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
}'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-2Deprecatedsora-2-proDeprecated
💡 Tip
The model field in the request example can be replaced with any model name above.