Kling Gateway Overview
Gateway Base URL:
https://maasunion.comUnified prefix: All endpoints are mounted underhttps://maasunion.com/kling/Official reference: Kling Open Platform Documentation
Design Principles
The Kling channel uses native pass-through: the client JSON request body is forwarded as-is to the official Kling upstream, and the response JSON structure is identical to the official one. The gateway only handles authentication, channel routing, task ID mapping, and billing.
| Item | Description |
|---|---|
| Native pass-through | The client JSON request body is forwarded as-is to the upstream; the response structure is identical to the official Kling one |
| Unified prefix | All endpoints are mounted under https://maasunion.com/kling/, followed by normalized sub-paths |
| Channel split | Split into 6 channel types by API capability; administrators need to configure a separate channel for each API type |
| Task ID mapping | After creating a task, the data.task_id (data.id for Turbo) in the response is replaced with the gateway public ID |
| Authentication separation | The client uses a gateway token; the upstream uses a Kling API Key (configured in the admin backend) |
Gateway Base URL Structure
https://maasunion.com/kling/v1/{product_line}/{resource}/...| Product line | Path prefix | Corresponding channel |
|---|---|---|
standard | /kling/v1/standard/videos/ | Kling Video (50) |
standard | /kling/v1/standard/images/ | Kling Image (64) |
turbo | /kling/v1/turbo/ | Kling Turbo (62) |
omni | /kling/v1/omni/videos | Kling Omni Video (63) |
omni | /kling/v1/omni/images | Kling Omni Image (65) |
extended | /kling/v1/extended/ | Kling Extended (66) |
Authentication
Client (caller)
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer {your_api_token}, the API token issued by the gateway |
Content-Type | Required for POST | application/json |
The client does not need to and should not pass the Kling upstream API Key.
Upstream (admin backend channel configuration)
| Configuration item | Description |
|---|---|
| Secret key | The API Key obtained from the Kling console (a single string) |
| Forwarding method | The gateway requests the upstream with Authorization: Bearer {apikey} |
| Relay mode | If the key starts with sk-, it is treated as a New API internal relay, and the upstream URL automatically appends the /kling prefix |
The
AccessKey|SecretKeyformat is no longer supported, and JWT is no longer auto-generated.
Channel Types and Path Mapping
Each API capability corresponds to an independent channel type. The gateway automatically matches the required channel type based on the request path and dispatches only to channels of the corresponding type.
| Channel type | ID | Admin backend name | Default Base URL | Applicable API |
|---|---|---|---|---|
| Kling Video | 50 | Kling Video | https://api.klingai.com | Standard text-to-video / image-to-video |
| Kling Turbo | 62 | Kling Turbo | https://api-beijing.klingai.com | 3.0 Turbo new API |
| Kling Omni Video | 63 | Kling Omni Video | https://api-beijing.klingai.com | Omni video |
| Kling Image | 64 | Kling Image | https://api-beijing.klingai.com | Standard image generation/editing |
| Kling Omni Image | 65 | Kling Omni Image | https://api-beijing.klingai.com | Omni image |
| Kling Extended | 66 | Kling Extended | https://api-beijing.klingai.com | Motion control, digital human, audio and other extended APIs |
Gateway Path ↔ Official Upstream Mapping
| Gateway path | Official upstream path | Channel ID |
|---|---|---|
POST /kling/v1/standard/videos/text2video | POST /v1/videos/text2video | 50 |
GET /kling/v1/standard/videos/text2video/{task_id} | GET /v1/videos/text2video/{id} | 50 |
POST /kling/v1/standard/videos/image2video | POST /v1/videos/image2video | 50 |
GET /kling/v1/standard/videos/image2video/{task_id} | GET /v1/videos/image2video/{id} | 50 |
POST /kling/v1/turbo/videos/text-to-video/{model} | POST /text-to-video/{model} | 62 |
POST /kling/v1/turbo/videos/image-to-video/{model} | POST /image-to-video/{model} | 62 |
POST /kling/v1/turbo/tasks | POST /tasks | 62 |
GET /kling/v1/turbo/tasks/{task_id} | GET /tasks?external_task_ids={id} | 62 |
POST /kling/v1/omni/videos | POST /v1/videos/omni-video | 63 |
GET /kling/v1/omni/videos/{task_id} | GET /v1/videos/omni-video/{id} | 63 |
POST /kling/v1/standard/images/generations | POST /v1/images/generations | 64 |
GET /kling/v1/standard/images/generations/{task_id} | GET /v1/images/generations/{id} | 64 |
POST /kling/v1/standard/images/multi-image2image | POST /v1/images/multi-image2image | 64 |
GET /kling/v1/standard/images/multi-image2image/{task_id} | GET /v1/images/multi-image2image/{id} | 64 |
POST /kling/v1/standard/images/image2image | Compatibility alias (see note below) | 64 |
POST /kling/v1/standard/images/editing | POST /v1/images/editing | 64 |
POST /kling/v1/omni/images | POST /v1/images/omni-image | 65 |
GET /kling/v1/omni/images/{task_id} | GET /v1/images/omni-image/{id} | 65 |
POST /kling/v1/extended/videos/motion-control | POST /v1/videos/motion-control | 66 |
POST /kling/v1/extended/videos/avatar/image2video | POST /v1/videos/avatar/image2video | 66 |
POST /kling/v1/extended/videos/identify-face | POST /v1/videos/identify-face | 66 |
POST /kling/v1/extended/videos/advanced-lip-sync | POST /v1/videos/advanced-lip-sync | 66 |
POST /kling/v1/extended/videos/image-recognize | POST /v1/videos/image-recognize | 66 |
POST /kling/v1/extended/audio/text-to-audio | POST /v1/audio/text-to-audio | 66 |
POST /kling/v1/extended/audio/video-to-audio | POST /v1/audio/video-to-audio | 66 |
POST /kling/v1/extended/images/kolors-virtual-try-on | POST /v1/images/kolors-virtual-try-on | 66 |
POST /kling/v1/extended/general/ai-multi-shot | POST /v1/general/ai-multi-shot | 66 |
image2image compatibility note:
/v1/images/image2imagedoes not exist in the official Kling API. The gateway provides/kling/v1/standard/images/image2imageas a compatibility alias: a single reference image goes togenerations(request body withimagefield), and multiple reference images go tomulti-image2image.
Common Conventions
Task ID Mapping
| API type | Create response field | Query path parameter |
|---|---|---|
| Standard v1 (Video / Omni / Image / Extended) | data.task_id | {task_id} |
| Turbo new API | data.id | {task_id} (gateway internal mapping) |
The gateway replaces the task ID returned by the upstream with a public ID; use the public ID when querying, and the gateway maps it back to the upstream ID automatically.
Sync vs Async
| Type | Endpoint | Description |
|---|---|---|
| Async task | Most POST create + GET query | Returns a task ID, requires polling |
| Sync response | POST /kling/v1/extended/videos/identify-face | Returns face recognition results directly |
| Sync response | POST /kling/v1/extended/videos/image-recognize | Returns image recognition results directly |
Recommended Polling Strategy
- After creating a task, obtain the
task_id(idfor Turbo) - Poll with GET every 2–5 seconds until the status is succeed or failed
- After success, get the result URL from
data.task_result(v1) ordata.outputs(Turbo)
Task Status Enumerations
| API format | Status values |
|---|---|
| New API (3.0 Turbo) | submitted → processing → succeeded / failed |
| v1 API (all others) | submitted → processing → succeed / failed |
Note: the success status for the new API is
succeeded, and for the v1 API it issucceed.
Two API Format Differences Comparison
| Dimension | New API (3.0 Turbo) | v1 API (all other models) |
|---|---|---|
| Gateway endpoint | /kling/v1/turbo/videos/text-to-video/{model} | /kling/v1/standard/videos/text2video etc. |
| Official endpoint | /{text|image}-to-video/kling-3.0-turbo | /v1/videos/text2video etc., distinguished by model_name |
| Request body | contents + settings + options | model_name + flat parameters |
| Create response | data.id + data.status | data.task_id + data.task_status |
| Query endpoint | GET /kling/v1/turbo/tasks/{task_id} | GET /kling/v1/.../.../{task_id} |
| Result field | outputs[].type + outputs[].url | task_result.videos[].url / task_result.images[].url |
| Watermark | options.watermark_info.enabled | Watermark parameter not supported (some query responses return watermark_url) |
| Callback | options.callback_url | callback_url (top-level) |
| Success status | succeeded | succeed |
The generated result URL is valid for 30 days; please persist it in time.
Image Material Specifications
- Format:
.jpg/.jpeg/.png - v1 endpoints: file ≤ 10MB, width/height ≥ 300px, aspect ratio 1:2.5 ~ 2.5:1
- New API: file ≤ 50MB, width/height ≥ 300px, aspect ratio 1:2.5 ~ 2.5:1
- Supports URL or Base64 (without the
data:image/xxx;base64,prefix; the gateway strips this prefix automatically)
Quick Start
1. Create a channel in the admin backend
Based on the API type you want to call, select the corresponding channel type, and fill in the Kling API Key and Base URL.
2. Bind models and groups
Configure the model names (e.g. kling-v2-6, kling-video-o1) in the channel, and bind them to user groups.
3. Create a task
curl --request POST \
--url "https://maasunion.com/kling/v1/standard/videos/text2video" \
--header "Authorization: Bearer {your_api_token}" \
--header "Content-Type: application/json" \
--data '{
"model_name": "kling-v2-6",
"prompt": "一只猫在草地上奔跑",
"duration": "5",
"aspect_ratio": "16:9"
}'4. Poll for the task result
curl --request GET \
--url "https://maasunion.com/kling/v1/standard/videos/text2video/{task_id}" \
--header "Authorization: Bearer {your_api_token}"Billing
- The gateway bills based on the models and group multipliers bound to the channel
- The
final_unit_deduction(credit consumption) returned by Kling is used as a settlement reference when the task completes - Image and video APIs go through different billing paths (the gateway distinguishes
MediaKindinternally by request path) - Different API types, models, and
mode(std/pro/4k) are billed differently; refer to the official Kling pricing - The
model_namein the request must match the model configured in the channel, otherwise routing or billing anomalies may occur
Error Handling
HTTP Status Codes
| Status code | Description |
|---|---|
| 200 | The request reached the upstream; the specific success/failure depends on the code field |
| 401 | Gateway token is invalid or missing |
| 403 | No permission to access the model/group |
| 429 | Rate limit triggered |
| 500 | Gateway or upstream internal error |
Business Error Codes
When the response code != 0, it indicates a business failure; message / task_status_msg contains the specific reason. Common cases:
| Scenario | Suggested handling |
|---|---|
| Model not configured | Check the channel model binding and group visibility |
| Channel type mismatch | Confirm the correct path is used (see the path mapping above) |
| Upstream API Key invalid | Check whether the admin backend key is a valid Kling API Key |
| Parameter validation failed | Check the request body against the official Kling documentation |
Admin Backend Configuration
Using Kling Omni Video as an example, the steps for other types are the same; only the channel type and model name differ.
- Go to Channel Management → New Channel
- For Channel type, select the corresponding type (e.g. Kling Omni Video)
- For API Base URL, fill in the Kling API address:
- Standard video (50):
https://api.klingai.com - Other types (62–66):
https://api-beijing.klingai.com
- Standard video (50):
- For Secret key, fill in the Kling API Key
- For Models, fill in the model names supported by the channel, and bind them to user groups
- After saving, ensure the models are visible to the caller in the tokens/groups
If you need to use multiple Kling capabilities at the same time, you must create channels of the corresponding types separately:
Kling Video (50) → /kling/v1/standard/videos/*
Kling Turbo (62) → /kling/v1/turbo/*
Kling Omni Video (63) → /kling/v1/omni/videos
Kling Image (64) → /kling/v1/standard/images/*
Kling Omni Image (65) → /kling/v1/omni/images
Kling Extended (66) → /kling/v1/extended/*Related Documentation
Video models
- Standard Video (Text/Image to Video)
- Kling Turbo (3.0 Turbo New API)
- Omni Video
- Motion Control
- Digital Human
- Audio Generation
- Lip Sync (Two-Step)
- Image Recognition (Sync)
Image models
Official resources
How is this guide?