🎬 Text-to-Video API

Generate Videos from Text Prompts

Turn any text description into cinematic HD video with a single API call. Access Sora, Kling, and Veo models through one unified endpoint.

POST /api/v1/content/text-to-video
{
  "model_slug": "kling-v2",
  "prompt": "A golden sunset over the ocean, cinematic 4K",
  "features_selected": {
    "aspect_ratio": "16:9",
    "duration": "5s"
  }
}

// Response
{
  "success": true,
  "data": {
    "task_id": "task_abc123",
    "status": "processing",
    "estimated_time": 120
  }
}

How It Works

Three simple steps to generate AI videos programmatically.

1

Send a Prompt

POST your text description and choose an AI model. Specify aspect ratio, duration, and style.

2

Poll for Status

Use the task_id to check generation progress. Typical generation takes 60-180 seconds.

3

Download Video

Once complete, receive a direct download URL for your HD video file.

Code Samples

Python
import requests, time

API_KEY = "ak_your_key_here"
BASE = "https://mobileapi.aienvoy.dev/api/v1"
headers = {"X-API-Key": API_KEY}

# 1. Create video
resp = requests.post(f"{BASE}/content/text-to-video",
    headers=headers,
    json={
        "model_slug": "kling-v2",
        "prompt": "Aerial drone shot of a city at night"
    }
)
task_id = resp.json()["data"]["task_id"]

# 2. Poll until done
while True:
    status = requests.get(
        f"{BASE}/content/status/TEXT-TO-VIDEO/{task_id}",
        headers=headers
    ).json()
    if status["data"]["status"] == "completed":
        print(status["data"]["result_url"])
        break
    time.sleep(10)
JavaScript (Node.js)
const API_KEY = "ak_your_key_here";
const BASE = "https://mobileapi.aienvoy.dev/api/v1";
const headers = {
  "X-API-Key": API_KEY,
  "Content-Type": "application/json"
};

// 1. Create video
const res = await fetch(`${BASE}/content/text-to-video`, {
  method: "POST",
  headers,
  body: JSON.stringify({
    model_slug: "kling-v2",
    prompt: "Aerial drone shot of a city at night"
  })
});
const { data } = await res.json();

// 2. Poll until done
const poll = setInterval(async () => {
  const s = await fetch(
    `${BASE}/content/status/TEXT-TO-VIDEO/${data.task_id}`,
    { headers }
  ).then(r => r.json());
  if (s.data.status === "completed") {
    clearInterval(poll);
    console.log(s.data.result_url);
  }
}, 10000);
cURL
# Create text-to-video
curl -X POST \
  https://mobileapi.aienvoy.dev/api/v1/content/text-to-video \
  -H "X-API-Key: ak_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model_slug": "kling-v2",
    "prompt": "Aerial drone shot of a city at night"
  }'

# Check status
curl https://mobileapi.aienvoy.dev/api/v1/content/status/TEXT-TO-VIDEO/task_abc123 \
  -H "X-API-Key: ak_your_key_here"
PHP
$apiKey = "ak_your_key_here";
$base = "https://mobileapi.aienvoy.dev/api/v1";

$ch = curl_init("$base/content/text-to-video");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-API-Key: $apiKey",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "model_slug" => "kling-v2",
        "prompt" => "Aerial drone shot of a city at night"
    ])
]);
$response = json_decode(curl_exec($ch), true);
$taskId = $response["data"]["task_id"];
curl_close($ch);

Available AI Models

Choose the best model for your use case. Query available models via GET /api/v1/content/models/TEXT-TO-VIDEO.

Sora

OpenAI's flagship video model. Best for photorealistic scenes and complex motion.

Highest Quality

Kling

Fast, high-quality generation with excellent character consistency and cinematic styling.

Best Value

Veo

Google DeepMind's video model. Excels at natural scenes and smooth transitions.

Fast Generation

API Features

Multiple Aspect Ratios

16:9, 9:16, 1:1, 4:3 — optimized for any platform from TikTok to YouTube.

Variable Duration

Generate clips from 3 to 10+ seconds depending on the model selected.

Async Processing

Non-blocking API with task polling. Integrate into any workflow or queue system.

HD Output

Up to 1080p video output ready for production use and social media publishing.

Cost Estimation

Calculate token costs before generation with the pricing endpoint.

Content Moderation

Built-in safety filters ensure generated content meets platform guidelines.

Use Cases

📱

Social Media Apps

Let users generate video content within your platform

🛒

E-Commerce

Auto-generate product demo videos from descriptions

📰

News & Media

Create visual content for articles and reports at scale

🎓

EdTech

Generate educational videos from lesson plans

Start Generating Videos via API

Get your free API key and generate your first AI video in under 5 minutes.