v1.0 — Now Available

AiEnvoy Developer API

Build AI-powered video, music, dubbing, and content applications. Generate videos, create songs, dub content, and more — all via simple REST endpoints.

Quick Start

  1. Create an account

    Sign up at apps.aienvoy.dev and purchase tokens for API usage.

  2. Generate an API key

    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.

  3. Make your first API call

    Include your key in the X-API-Key header with every request.

Authentication

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}

Code Samples

Check your balance

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'];

Text to Video Generation Api

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);

Image to Video Generation Api

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 AI Music

# 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);

API Endpoints Overview

GET POST

Videos

Generate AI videos, check status, list your creations, and explore shared content.

GET POST

Music

Create AI songs with custom prompts, genres, and styles. Stream or download.

GET POST

Dubbing

Dub videos or audio into 29+ languages with AI-powered voice cloning.

GET POST

Autopilot

Fully automated video pipeline: script → voiceover → scenes → music → final video.

GET POST

Content / Text-to-Video

Convert text prompts to videos, check pricing, explore AI models.

GET POST

Characters

Create custom AI character profiles, upload images, train LoRA models.

GET POST

Video Clips

Extract the best moments from long videos using AI analysis.

GET POST

Chat / AI Assistant

Create conversations with AI personas for content generation.

Rate Limits

Limit TypeDefaultHeader
Per minute60 requestsX-RateLimit-Limit
Per day10,000 requestsX-RateLimit-Daily-Limit
Remaining (minute)—X-RateLimit-Remaining
Remaining (day)—X-RateLimit-Daily-Remaining
Reset time—X-RateLimit-Reset

Error Handling

All errors return a consistent format:

{
  "success": false,
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded. Try again in 45 seconds.",
    "status": 429
  }
}
CodeStatusDescription
VALIDATION_ERROR400Invalid request parameters
UNAUTHORIZED401Missing or invalid API key
FORBIDDEN403Insufficient permissions / scope
NOT_FOUND404Resource not found
RATE_LIMIT_EXCEEDED429Too many requests
INTERNAL_ERROR500Server error (report to support)

Ready to build?

Explore the full interactive API reference with live code examples.

Open API Reference →