Endpoints
Method Endpoint Description POST /api/v1/generateTask/kling-2-1Создание задачи генерации GET /api/v1/statusTask/kling-2-1Запрос статуса задачи
Authentication
Все запросы требуют API Key в заголовке:
Authorization: Bearer YOUR_API_KEY
Request Body
{
"request_type" : "async" ,
"callback_url" : "https://..." ,
"provider" : "auto" ,
"input" : {
"mode" : "standard-image-to-video" ,
"prompt" : "..." ,
"duration" : 5 ,
"image_urls" : [ "..." ],
"aspect_ratio" : "16:9" ,
"negative_prompt" : "..." ,
"cfg_scale" : 0.5
}
}
Parameters
request_type
string
по умолчанию: "async"
async (polling) или callback (webhook)
Callback URL, обязателен при request_type=callback (условно)
provider
string
по умолчанию: "auto"
Стратегия маршрутизации: auto, value или official
Параметры входа модели mode
string
по умолчанию: "standard-image-to-video"
обязательно
Generation mode (see options below)
Text description, 1-5000 characters
duration
integer
по умолчанию: "5"
обязательно
Video duration in seconds: 5 or 10
Reference images, 1-2 depending on mode (conditional)
aspect_ratio
string
по умолчанию: "16:9"
16:9, 9:16, or 1:1 (required for master-text-to-video) (conditional)
Negative prompt, max 500 characters
Guidance scale, 0-1, step 0.1
Mode Options:
standard-image-to-video — Standard tier image-to-video, requires 1 image
pro-image-to-video — Pro tier image-to-video, supports 1-2 images (end frame)
master-text-to-video — Master tier text-to-video
master-image-to-video — Master tier image-to-video, requires 1 image
Example
Standard Image-to-Video
curl -X POST "https://api.apixo.ai/api/v1/generateTask/kling-2-1" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_type": "async",
"provider": "value",
"input": {
"mode": "standard-image-to-video",
"prompt": "animate this still life scene with subtle camera movement",
"duration": 5,
"image_urls": ["https://example.com/std_ref.jpg"],
"negative_prompt": "blur, low quality",
"cfg_scale": 0.6
}
}'
Pro Image-to-Video (with End Frame)
curl -X POST "https://api.apixo.ai/api/v1/generateTask/kling-2-1" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_type": "callback",
"callback_url": "https://your-server.com/callback",
"provider": "official",
"input": {
"mode": "pro-image-to-video",
"prompt": "city skyline timelapse from day to night",
"duration": 10,
"image_urls": [
"https://example.com/pro_start.jpg",
"https://example.com/pro_end.jpg"
],
"cfg_scale": 0.4
}
}'
Master Text-to-Video
curl -X POST "https://api.apixo.ai/api/v1/generateTask/kling-2-1" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_type": "async",
"input": {
"mode": "master-text-to-video",
"prompt": "a futuristic drone flying through neon-lit streets at night",
"duration": 5,
"aspect_ratio": "9:16",
"negative_prompt": "grainy, noisy, static",
"cfg_scale": 0.3
}
}'
Response
POST /api/v1/generateTask/kling-2-1
При успехе возвращает taskId для последующих запросов статуса.
Success:
{
"code" : 200 ,
"message" : "success" ,
"data" : {
"taskId" : "task_12345678"
}
}
Error:
{
"code" : 400 ,
"message" : "Insufficient credits" ,
"data" : null
}
GET /api/v1/statusTask/kling-2-1
Запрос статуса выполнения задачи и результатов по taskId.
curl -X GET "https://api.apixo.ai/api/v1/statusTask/kling-2-1?taskId=task_12345678" \
-H "Authorization: Bearer YOUR_API_KEY"
Success:
{
"code" : 200 ,
"message" : "success" ,
"data" : {
"taskId" : "task_12345678" ,
"state" : "success" ,
"resultJson" : "{ \" resultUrls \" :[ \" https://r2.apixo.ai/video.mp4 \" ]}" ,
"createTime" : 1767965610929 ,
"completeTime" : 1767965652317 ,
"costTime" : 41388
}
}
Failed:
{
"code" : 200 ,
"message" : "success" ,
"data" : {
"taskId" : "task_12345678" ,
"state" : "failed" ,
"failCode" : "CONTENT_VIOLATION" ,
"failMsg" : "Content does not meet safety guidelines"
}
}
Status Response Fields
Уникальный идентификатор задачи.
Текущее состояние задачи: pending, processing, success или failed.
JSON-строка с массивом resultUrls. Присутствует только при success. Парсите через JSON.parse().
Код ошибки. Присутствует только при state=failed. См. Error Codes .
Читаемое сообщение об ошибке. Присутствует только при state=failed.
Timestamp создания задачи (Unix миллисекунды).
Timestamp завершения задачи (Unix миллисекунды).
Длительность обработки в миллисекундах.
Error Codes
Code Description 400 Неверные параметры или ошибка запроса 401 Недействительный или отсутствующий API Key 429 Превышен лимит запросов
Fail Code Description CONTENT_VIOLATIONКонтент нарушает правила безопасности INVALID_IMAGE_URLНе удаётся получить доступ к URL изображения
Rate Limits
Limit Value Requests 10000 / minute Concurrent tasks 1000
При превышении возвращается ошибка 429. Подождите и повторите.
Tips
Generation time :
5-second video: ~60-90 seconds
10-second video: ~90-120 seconds
Submit task, wait 60 seconds, then poll every 5 seconds
Callback mode : Video generation takes time, strongly recommend using callback mode.
Video expiration : Result URLs are valid for 15 days. Download promptly.
Content moderation : Prompts must comply with content safety guidelines.
Tier selection :
standard: Best value, for batch generation
pro: Supports start/end frame control, for precise creation
master: Highest quality, for professional production
End frame feature : pro mode supports 2 images — first as start frame, second as end frame.
Negative prompt : Use negative_prompt to avoid unwanted elements.
CFG Scale :
Higher values: Follows prompt more strictly, may lose creativity
Lower values: More creative, may deviate from prompt
Recommended: 0.3-0.7
Image formats : image_urls supports JPG, PNG, WebP, max 10MB per image.
Video generation takes longer than images — use callback mode for production workloads. Result URLs expire after 15 days; download important outputs promptly.