Documentation Index
Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Kling 2.1 is a tiered Kuaishou video model for image-to-video generation and master-quality text-to-video generation. Use this page when you are ready to call the API after trying the model in the APIXO playground.| Capability | Value |
|---|---|
| Model ID | kling-2-1 |
| Modes | standard-image-to-video, pro-image-to-video, master-text-to-video, master-image-to-video |
| Prompt length | 1-5000 characters |
| Duration | 5 or 10 seconds |
| Reference images | None for master-text-to-video; exactly 1 for standard-image-to-video and master-image-to-video; 1-2 for pro-image-to-video |
| Aspect ratios | 16:9, 9:16, 1:1 for master-text-to-video only |
| Output format | MP4 URLs in resultJson.resultUrls |
Endpoint and authentication
Base URL:| Method | Endpoint | Purpose |
|---|---|---|
POST | /generateTask/kling-2-1 | Submit a generation task |
GET | /statusTask/kling-2-1?taskId={taskId} | Poll task status and retrieve results |
Copy-paste async quickstart
This minimal request submits a standard image-to-video task and returns ataskId.
taskId; you need it to poll for the final result.
Poll for result
resultJson after state becomes success:
Request body
Standard image-to-video
Pro image-to-video
Master text-to-video
Master image-to-video
Parameters
Result delivery mode. Use
async for polling with statusTask, or callback for webhook delivery.Required when
request_type is callback. Must be a public HTTPS URL that can receive the final task payload. See Webhooks.Kling 2.1 input parameters.
Response format
Submit task response
POST /generateTask/kling-2-1 returns a task ID when the task is accepted:
API status code.
200 means the task was accepted.Human-readable status message.
Unique task identifier used with the status endpoint.
Status response fields
Unique task identifier.
Current task state:
pending, processing, success, or failed.JSON string containing the generated video URLs. Present when
state is success.Machine-readable failure code. Present when
state is failed.Human-readable failure message. Present when
state is failed.Task creation timestamp in Unix milliseconds.
Task completion timestamp in Unix milliseconds. Present after completion.
Processing duration in milliseconds. Present after successful completion and often present after failure.
Webhook callback mode
Use callback mode when your backend should receive the final result automatically instead of polling.Billing
Kling 2.1 is billed per generated video. The selectedmode determines the tier, and duration determines the unit price.
| Mode | Tier | 5 seconds | 10 seconds |
|---|---|---|---|
standard-image-to-video | Standard | $0.20 / video | $0.40 / video |
pro-image-to-video | Pro | $0.35 / video | $0.70 / video |
master-text-to-video | Master | $1.00 / video | $2.00 / video |
master-image-to-video | Master | $1.00 / video | $2.00 / video |
Latency and polling
Actual latency may vary by prompt complexity, selected tier, input image size, route, and current queue load.| Duration | Typical generation time | Recommended first poll | Poll interval |
|---|---|---|---|
5 seconds | 60s-90s | 60s after task creation | 5s-10s |
10 seconds | 90s-120s | 60s after task creation | 5s-10s |
429, slow down requests and retry with backoff. For account-level details, see System APIs.
Errors and troubleshooting
HTTP errors
| Code | Meaning | What to do |
|---|---|---|
400 | Invalid request body, missing required field, unsupported mode, or rejected input | Fix the request before retrying |
401 | Missing or invalid API key | Check the Authorization header |
402 | Insufficient balance or quota | Add balance or switch account/key |
403 | Key or route cannot access the model | Check permissions and routing settings |
429 | Rate limit or concurrency limit reached | Retry with exponential backoff |
500 | Server error | Retry with backoff |
502 | Upstream service error | Retry with backoff |
504 | Upstream timeout | Retry or use callback mode for long-running jobs |
Task failure codes
ExactfailCode values can vary because upstream errors are normalized before they are returned.
| Fail code | Meaning | What to do |
|---|---|---|
Missing required parameter | A required field such as input, mode, prompt, duration, image_urls, or callback_url is missing | Add the missing field |
Invalid parameter type | A field has the wrong JSON type | Check prompt, duration, image_urls, aspect_ratio, negative_prompt, and cfg_scale |
Invalid parameter value | A field has an unsupported value | Check mode, duration, aspect_ratio, and cfg_scale |
Param length exceeded | Prompt, negative prompt, or image count exceeds the backend limit | Shorten text or reduce image count |
ImageNotAccess | An input image URL could not be fetched | Use a public, direct HTTP(S) image URL |
SensitiveContent, PromptInvalid, ProhibitedContentDetected, NSFW | Prompt, input image, or output failed safety checks | Change the prompt or image |
RateLimited | Upstream rate limit was reached | Retry with backoff |
Timeout | Upstream service timed out | Retry, reduce input complexity, or use callback mode |
Unknown error | Upstream service returned an unmapped error | Retry with backoff or contact support with the taskId |
Common request issues
| Symptom | Likely cause | Fix |
|---|---|---|
mode is rejected | The mode is missing or not one of the four supported values | Use standard-image-to-video, pro-image-to-video, master-text-to-video, or master-image-to-video |
Text-to-video rejects image_urls | master-text-to-video does not allow reference images | Remove image_urls |
| Image-to-video rejects the request | Required image is missing or too many images were sent | Send exactly 1 image for standard/master image modes, or 1-2 images for pro mode |
aspect_ratio appears ignored | The field only applies to master-text-to-video | Use master-text-to-video when aspect ratio control is required |
| Image URL fails before generation | The backend validates public URL reachability | Use a direct, reachable HTTP(S) URL and avoid private or localhost links |