MaasUnionMaasUnion
API Reference
AI Model APIVideoKling Video

Kling Gateway Overview

Gateway Base URL: https://maasunion.com Unified prefix: All endpoints are mounted under https://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.

ItemDescription
Native pass-throughThe client JSON request body is forwarded as-is to the upstream; the response structure is identical to the official Kling one
Unified prefixAll endpoints are mounted under https://maasunion.com/kling/, followed by normalized sub-paths
Channel splitSplit into 6 channel types by API capability; administrators need to configure a separate channel for each API type
Task ID mappingAfter creating a task, the data.task_id (data.id for Turbo) in the response is replaced with the gateway public ID
Authentication separationThe 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 linePath prefixCorresponding 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/videosKling Omni Video (63)
omni/kling/v1/omni/imagesKling Omni Image (65)
extended/kling/v1/extended/Kling Extended (66)

Authentication

Client (caller)

HeaderRequiredDescription
AuthorizationYesBearer {your_api_token}, the API token issued by the gateway
Content-TypeRequired for POSTapplication/json

The client does not need to and should not pass the Kling upstream API Key.

Upstream (admin backend channel configuration)

Configuration itemDescription
Secret keyThe API Key obtained from the Kling console (a single string)
Forwarding methodThe gateway requests the upstream with Authorization: Bearer {apikey}
Relay modeIf 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|SecretKey format 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 typeIDAdmin backend nameDefault Base URLApplicable API
Kling Video50Kling Videohttps://api.klingai.comStandard text-to-video / image-to-video
Kling Turbo62Kling Turbohttps://api-beijing.klingai.com3.0 Turbo new API
Kling Omni Video63Kling Omni Videohttps://api-beijing.klingai.comOmni video
Kling Image64Kling Imagehttps://api-beijing.klingai.comStandard image generation/editing
Kling Omni Image65Kling Omni Imagehttps://api-beijing.klingai.comOmni image
Kling Extended66Kling Extendedhttps://api-beijing.klingai.comMotion control, digital human, audio and other extended APIs

Gateway Path ↔ Official Upstream Mapping

Gateway pathOfficial upstream pathChannel ID
POST /kling/v1/standard/videos/text2videoPOST /v1/videos/text2video50
GET /kling/v1/standard/videos/text2video/{task_id}GET /v1/videos/text2video/{id}50
POST /kling/v1/standard/videos/image2videoPOST /v1/videos/image2video50
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/tasksPOST /tasks62
GET /kling/v1/turbo/tasks/{task_id}GET /tasks?external_task_ids={id}62
POST /kling/v1/omni/videosPOST /v1/videos/omni-video63
GET /kling/v1/omni/videos/{task_id}GET /v1/videos/omni-video/{id}63
POST /kling/v1/standard/images/generationsPOST /v1/images/generations64
GET /kling/v1/standard/images/generations/{task_id}GET /v1/images/generations/{id}64
POST /kling/v1/standard/images/multi-image2imagePOST /v1/images/multi-image2image64
GET /kling/v1/standard/images/multi-image2image/{task_id}GET /v1/images/multi-image2image/{id}64
POST /kling/v1/standard/images/image2imageCompatibility alias (see note below)64
POST /kling/v1/standard/images/editingPOST /v1/images/editing64
POST /kling/v1/omni/imagesPOST /v1/images/omni-image65
GET /kling/v1/omni/images/{task_id}GET /v1/images/omni-image/{id}65
POST /kling/v1/extended/videos/motion-controlPOST /v1/videos/motion-control66
POST /kling/v1/extended/videos/avatar/image2videoPOST /v1/videos/avatar/image2video66
POST /kling/v1/extended/videos/identify-facePOST /v1/videos/identify-face66
POST /kling/v1/extended/videos/advanced-lip-syncPOST /v1/videos/advanced-lip-sync66
POST /kling/v1/extended/videos/image-recognizePOST /v1/videos/image-recognize66
POST /kling/v1/extended/audio/text-to-audioPOST /v1/audio/text-to-audio66
POST /kling/v1/extended/audio/video-to-audioPOST /v1/audio/video-to-audio66
POST /kling/v1/extended/images/kolors-virtual-try-onPOST /v1/images/kolors-virtual-try-on66
POST /kling/v1/extended/general/ai-multi-shotPOST /v1/general/ai-multi-shot66

image2image compatibility note: /v1/images/image2image does not exist in the official Kling API. The gateway provides /kling/v1/standard/images/image2image as a compatibility alias: a single reference image goes to generations (request body with image field), and multiple reference images go to multi-image2image.


Common Conventions

Task ID Mapping

API typeCreate response fieldQuery path parameter
Standard v1 (Video / Omni / Image / Extended)data.task_id{task_id}
Turbo new APIdata.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

TypeEndpointDescription
Async taskMost POST create + GET queryReturns a task ID, requires polling
Sync responsePOST /kling/v1/extended/videos/identify-faceReturns face recognition results directly
Sync responsePOST /kling/v1/extended/videos/image-recognizeReturns image recognition results directly
  1. After creating a task, obtain the task_id (id for Turbo)
  2. Poll with GET every 2–5 seconds until the status is succeed or failed
  3. After success, get the result URL from data.task_result (v1) or data.outputs (Turbo)

Task Status Enumerations

API formatStatus values
New API (3.0 Turbo)submittedprocessingsucceeded / failed
v1 API (all others)submittedprocessingsucceed / failed

Note: the success status for the new API is succeeded, and for the v1 API it is succeed.

Two API Format Differences Comparison

DimensionNew 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 bodycontents + settings + optionsmodel_name + flat parameters
Create responsedata.id + data.statusdata.task_id + data.task_status
Query endpointGET /kling/v1/turbo/tasks/{task_id}GET /kling/v1/.../.../{task_id}
Result fieldoutputs[].type + outputs[].urltask_result.videos[].url / task_result.images[].url
Watermarkoptions.watermark_info.enabledWatermark parameter not supported (some query responses return watermark_url)
Callbackoptions.callback_urlcallback_url (top-level)
Success statussucceededsucceed

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 MediaKind internally by request path)
  • Different API types, models, and mode (std/pro/4k) are billed differently; refer to the official Kling pricing
  • The model_name in the request must match the model configured in the channel, otherwise routing or billing anomalies may occur

Error Handling

HTTP Status Codes

Status codeDescription
200The request reached the upstream; the specific success/failure depends on the code field
401Gateway token is invalid or missing
403No permission to access the model/group
429Rate limit triggered
500Gateway 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:

ScenarioSuggested handling
Model not configuredCheck the channel model binding and group visibility
Channel type mismatchConfirm the correct path is used (see the path mapping above)
Upstream API Key invalidCheck whether the admin backend key is a valid Kling API Key
Parameter validation failedCheck 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.

  1. Go to Channel ManagementNew Channel
  2. For Channel type, select the corresponding type (e.g. Kling Omni Video)
  3. 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
  4. For Secret key, fill in the Kling API Key
  5. For Models, fill in the model names supported by the channel, and bind them to user groups
  6. 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/*

Video models

Image models

Official resources

How is this guide?