Saltar al contenido principal

Endpoints

MétodoEndpointDescripción
POST/api/v1/generateTask/kling-2-5-turbo-proCrear tarea de generación
GET/api/v1/statusTask/kling-2-5-turbo-proConsultar estado de la tarea

Autenticación

Todas las solicitudes requieren una clave API en el header:
Authorization: Bearer YOUR_API_KEY

Cuerpo de la solicitud

{
  "request_type": "async",
  "callback_url": "https://...",
  "provider": "auto",
  "input": {
    "mode": "text-to-video",
    "prompt": "...",
    "duration": 10,
    "aspect_ratio": "16:9",
    "image_urls": ["..."],
    "negative_prompt": "...",
    "cfg_scale": 0.6
  }
}

Parámetros

request_type
string
predeterminado:"async"
async (polling) or callback (webhook)
callback_url
string
Callback URL, required when request_type=callback (conditional)
provider
string
predeterminado:"auto"
Routing strategy: auto, value, or official
input
object
requerido
Model input parameters
Mode Options:
  • text-to-video — Generate video from text
  • image-to-video — Generate video from image (supports 1-2 images for end frame control)

Example

Text-to-Video
curl -X POST "https://api.apixo.ai/api/v1/generateTask/kling-2-5-turbo-pro" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-video",
      "prompt": "a cinematic drone shot over snowy mountains at sunrise",
      "duration": 10,
      "aspect_ratio": "16:9",
      "negative_prompt": "low quality, jitter",
      "cfg_scale": 0.6
    }
  }'
Image-to-Video (with End Frame Control)
curl -X POST "https://api.apixo.ai/api/v1/generateTask/kling-2-5-turbo-pro" \
  -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": "image-to-video",
      "prompt": "smooth camera transition from first to last frame",
      "duration": 5,
      "image_urls": [
        "https://example.com/head.jpg",
        "https://example.com/tail.jpg"
      ],
      "cfg_scale": 0.4
    }
  }'

Respuesta

POST /api/v1/generateTask/kling-2-5-turbo-pro

Devuelve taskId en éxito para consultas de estado posteriores. Éxito:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
Error:
{
  "code": 400,
  "message": "Insufficient credits",
  "data": null
}

GET /api/v1/statusTask/kling-2-5-turbo-pro

Consulta el estado de ejecución y resultados de la tarea vía taskId.
curl -X GET "https://api.apixo.ai/api/v1/statusTask/kling-2-5-turbo-pro?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
Éxito:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/video.mp4\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
Fallido:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines"
  }
}

Campos de respuesta de estado

taskId
string
Identificador único de la tarea.
state
string
Estado actual: pending, processing, success, or failed.
resultJson
string
JSON string containing resultUrls array. Only present on success. Parse with JSON.parse().
failCode
string
Error code. Only present when state is failed. See Códigos de error.
failMsg
string
Human-readable error message. Only present when state is failed.
createTime
integer
Task creation timestamp (Unix milliseconds).
completeTime
integer
Task completion timestamp (Unix milliseconds).
costTime
integer
Processing duration in milliseconds.

Códigos de error

CódigoDescripción
400Parámetros inválidos o error de solicitud
401Clave API inválida o faltante
429Límite de tasa excedido
Fail CodeDescripción
CONTENT_VIOLATIONContent violates safety guidelines
INVALID_IMAGE_URLCannot access provided image URL

Límites de tasa

LímiteValor
Requests10000 / minute
Concurrent tasks1000
Superar los límites devuelve error 429. Espera y reintenta.

Consejos

  • Generation time:
    • 5-second video: ~30-45 seconds
    • 10-second video: ~45-60 seconds
    • Submit task, wait 30 seconds, then poll every 5 seconds
  • Turbo advantage: Faster generation and better value compared to standard version, ideal for batch generation.
  • Callback mode: Recommend using callback mode to avoid frequent polling.
  • Video expiration: Result URLs are valid for 15 days. Download promptly.
  • Content moderation: Prompts must comply with content safety guidelines.
  • End frame control: image-to-video mode supports 2 images:
    • 1st image: Video start frame
    • 2nd image: Video end frame
    • Enables precise start/end control, ideal for transition animations
  • Negative prompt: Use negative_prompt to avoid blur, jitter, and other unwanted effects.
  • CFG Scale:
    • 0.3-0.5: More creative freedom
    • 0.6-0.8: Moderate adherence to prompt
    • 0.9-1.0: Strict adherence, may lose flexibility
  • 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.

Relacionado