Build AI-powered video, music, dubbing, and content applications. Generate videos, create songs, dub content, and more — all via simple REST endpoints.
Sign up at apps.aienvoy.dev and purchase tokens for API usage.
Log into your account, then create an API key via the mobile app or by calling the API key management endpoint with your JWT token.
Include your key in the X-API-Key header with every request.
Every request requires an API key in the X-API-Key header:
X-API-Key: ak_your_64_character_hex_key_here
Key format: ak_{64_hex_chars}
import requests
API_KEY = "ak_your_key_here"
BASE = "https://api.aienvoy.com/api/v1"
headers = {"X-API-Key": API_KEY}
# Check token balance
resp = requests.get(f"{BASE}/account/balance", headers=headers)
balance = resp.json()
print(f"Tokens: {balance['data']['token_balance']}")
const API_KEY = "ak_your_key_here";
const BASE = "https://api.aienvoy.com/api/v1";
const resp = await fetch(`${BASE}/account/balance`, {
headers: { "X-API-Key": API_KEY }
});
const { data } = await resp.json();
console.log(`Tokens: ${data.token_balance}`);
curl https://api.aienvoy.com/api/v1/account/balance \
-H "X-API-Key: ak_your_key_here"
$apiKey = "ak_your_key_here";
$ch = curl_init("https://api.aienvoy.com/api/v1/account/balance");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: $apiKey"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = json_decode(curl_exec($ch), true);
echo "Tokens: " . $response['data']['token_balance'];
import requests, time
# Start video generation
resp = requests.post(f"{BASE}/content/text-to-video", headers=headers, json={
"model_slug": "grok-imagine-text-to-video",
"prompt": "A cinematic sunset over the ocean",
"features_selected": {
"duration": 6,
"resolution": "480p",
"aspect_ratio": "9:16"
}
})
task = resp.json()
task_id = task["data"]["task_id"]
# Poll until complete
while True:
status = requests.get(
f"{BASE}/content/status/TEXT-TO-VIDEO/{task_id}", headers=headers
).json()
print(f"Status: {status['data']['status']}")
if status["data"]["status"] in ("completed", "failed"):
break
time.sleep(10)
print(f"Video URL: {status['data']['video_url']}")
// Start video generation
const genResp = await fetch(`${BASE}/content/text-to-video`, {
method: "POST",
headers: { "X-API-Key": API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
model_slug: "kling-v2",
prompt: "A cinematic sunset over the ocean",
features_selected: { aspect_ratio: "16:9", resolution: "1080p", duration: 5 }
})
});
const { data: task } = await genResp.json();
// Poll until complete
let status;
do {
await new Promise(r => setTimeout(r, 10000));
const pollResp = await fetch(`${BASE}/content/status/TEXT-TO-VIDEO/${task.task_id}`, {
headers: { "X-API-Key": API_KEY }
});
status = (await pollResp.json()).data;
console.log(`Status: ${status.status}`);
} while (!["completed", "failed"].includes(status.status));
console.log(`Video URL: ${status.video_url}`);
# Generate video
curl -X POST https://api.aienvoy.com/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": "A cinematic sunset over the ocean", "features_selected": {"aspect_ratio": "16:9", "resolution": "1080p", "duration": 5}}'
# Poll status (replace TASK_ID)
curl https://api.aienvoy.com/api/v1/content/status/TEXT-TO-VIDEO/TASK_ID \
-H "X-API-Key: ak_your_key_here"
$ch = curl_init("https://api.aienvoy.com/api/v1/content/text-to-video");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["X-API-Key: $apiKey", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"model_slug" => "kling-v2",
"prompt" => "A cinematic sunset over the ocean",
"features_selected" => ["aspect_ratio" => "16:9", "resolution" => "1080p", "duration" => 5]
]),
CURLOPT_RETURNTRANSFER => true
]);
$result = json_decode(curl_exec($ch), true);
import requests, time
# Start video generation
resp = requests.post(f"{BASE}/content/text-to-video", headers=headers, json={
"model_slug": "grok-imagine-image-to-video",
"prompt": "A cinematic sunset over the ocean",
"features_selected": {
"duration": 10,
"resolution": "480p",
"aspect_ratio": "9:16"
}
})
task = resp.json()
task_id = task["data"]["task_id"]
# Poll until complete
while True:
status = requests.get(
f"{BASE}/content/status/TEXT-TO-VIDEO/{task_id}", headers=headers
).json()
print(f"Status: {status['data']['status']}")
if status["data"]["status"] in ("completed", "failed"):
break
time.sleep(10)
print(f"Video URL: {status['data']['video_url']}")
// Start video generation
const genResp = await fetch(`${BASE}/content/text-to-video`, {
method: "POST",
headers: { "X-API-Key": API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
model_slug: "kling-v2",
prompt: "A cinematic sunset over the ocean",
features_selected: { aspect_ratio: "16:9", resolution: "1080p", duration: 5 }
})
});
const { data: task } = await genResp.json();
// Poll until complete
let status;
do {
await new Promise(r => setTimeout(r, 10000));
const pollResp = await fetch(`${BASE}/content/status/IMAGE-TO-VIDEO/${task.task_id}`, {
headers: { "X-API-Key": API_KEY }
});
status = (await pollResp.json()).data;
console.log(`Status: ${status.status}`);
} while (!["completed", "failed"].includes(status.status));
console.log(`Video URL: ${status.video_url}`);
# Generate video
curl -X POST https://api.aienvoy.com/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": "A cinematic sunset over the ocean", "features_selected": {"aspect_ratio": "16:9", "resolution": "1080p", "duration": 5}}'
# Poll status (replace TASK_ID)
curl https://api.aienvoy.com/api/v1/content/status/TEXT-TO-VIDEO/TASK_ID \
-H "X-API-Key: ak_your_key_here"
$ch = curl_init("https://api.aienvoy.com/api/v1/content/text-to-video");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["X-API-Key: $apiKey", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"model_slug" => "kling-v2",
"prompt" => "A cinematic sunset over the ocean",
"features_selected" => ["aspect_ratio" => "16:9", "resolution" => "1080p", "duration" => 5]
]),
CURLOPT_RETURNTRANSFER => true
]);
$result = json_decode(curl_exec($ch), true);
# Generate an AI song
resp = requests.post(f"{BASE}/music", headers=headers, json={
"title": "Summer Vibes",
"lyrics": "Under the sun, we dance all day, feeling the warmth in every way...",
"style": "pop",
"vocal_gender": "female"
})
song = resp.json()
print(f"Song task: {song['data']['task_id']}")
const musicResp = await fetch(`${BASE}/music`, {
method: "POST",
headers: { "X-API-Key": API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
title: "Summer Vibes",
lyrics: "Under the sun, we dance all day, feeling the warmth in every way...",
style: "pop",
vocal_gender: "female"
})
});
const song = await musicResp.json();
curl -X POST https://api.aienvoy.com/api/v1/music \
-H "X-API-Key: ak_your_key_here" \
-H "Content-Type: application/json" \
-d '{"title": "Summer Vibes", "lyrics": "Under the sun, we dance all day...", "style": "pop", "vocal_gender": "female"}'
$ch = curl_init("https://api.aienvoy.com/api/v1/music");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["X-API-Key: $apiKey", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"title" => "Summer Vibes",
"lyrics" => "Under the sun, we dance all day...",
"style" => "pop",
"vocal_gender" => "female"
]),
CURLOPT_RETURNTRANSFER => true
]);
$song = json_decode(curl_exec($ch), true);
Generate AI videos, check status, list your creations, and explore shared content.
Create AI songs with custom prompts, genres, and styles. Stream or download.
Dub videos or audio into 29+ languages with AI-powered voice cloning.
Fully automated video pipeline: script → voiceover → scenes → music → final video.
Convert text prompts to videos, check pricing, explore AI models.
Create custom AI character profiles, upload images, train LoRA models.
Extract the best moments from long videos using AI analysis.
Create conversations with AI personas for content generation.
| Limit Type | Default | Header |
|---|---|---|
| Per minute | 60 requests | X-RateLimit-Limit |
| Per day | 10,000 requests | X-RateLimit-Daily-Limit |
| Remaining (minute) | — | X-RateLimit-Remaining |
| Remaining (day) | — | X-RateLimit-Daily-Remaining |
| Reset time | — | X-RateLimit-Reset |
All errors return a consistent format:
{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded. Try again in 45 seconds.",
"status": 429
}
}
| Code | Status | Description |
|---|---|---|
VALIDATION_ERROR | 400 | Invalid request parameters |
UNAUTHORIZED | 401 | Missing or invalid API key |
FORBIDDEN | 403 | Insufficient permissions / scope |
NOT_FOUND | 404 | Resource not found |
RATE_LIMIT_EXCEEDED | 429 | Too many requests |
INTERNAL_ERROR | 500 | Server error (report to support) |
Explore the full interactive API reference with live code examples.
Open API Reference →