kling-official
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseKling Official Direct API
Kling官方直接API
Use this skill for OpenMontage tools with . This is not the fal.ai Kling gateway. Official Kling uses , optional , and .
provider="kling_official"KLING_API_KEYKLING_API_BASE_URLAuthorization: Bearer <KLING_API_KEY>本技能适用于设置的OpenMontage工具。这并非fal.ai Kling网关。官方Kling使用、可选的,以及认证方式。
provider="kling_official"KLING_API_KEYKLING_API_BASE_URLAuthorization: Bearer <KLING_API_KEY>Provider Split
提供者区分
- uses fal.ai,
kling_video, fal.ai queue URLs, andFAL_KEY.provider="kling" - uses Kling official API,
kling_official_video, official task protocols, andKLING_API_KEY.provider="kling_official" - uses the same official auth and task protocol for image generation.
kling_official_image - uses the official audio TTS endpoint and stays in the existing
kling_ttscapability.tts - and
kling_avataruse official avatar/lip-sync endpoints and stay in the existingkling_lip_synccapability. They do not replace localavatarortalking_head.lip_sync
Never silently switch between these paths. If the selected provider is unavailable, surface the blocker and ask before substituting.
- 使用fal.ai、
kling_video、fal.ai队列URL,且设置FAL_KEY。provider="kling" - 使用Kling官方API、
kling_official_video、官方任务协议,且设置KLING_API_KEY。provider="kling_official" - 使用相同的官方认证和任务协议进行图像生成。
kling_official_image - 使用官方音频TTS端点,归属于现有的
kling_tts能力范畴。tts - 和
kling_avatar使用官方虚拟形象/唇形同步端点,归属于现有的kling_lip_sync能力范畴。它们不会替代本地的avatar或talking_head功能。lip_sync
切勿在这些路径间静默切换。若所选提供者不可用,需明确告知阻碍,并在替换前征得用户同意。
Auth And Endpoint
认证与端点
Default base URL:
text
https://api-singapore.klingai.comUsers may override it with , for example for a regional endpoint. All requests send JSON and:
KLING_API_BASE_URLtext
Authorization: Bearer <KLING_API_KEY>默认基础URL:
text
https://api-singapore.klingai.com用户可通过覆盖默认值,例如使用区域端点。所有请求均发送JSON数据,并附带:
KLING_API_BASE_URLtext
Authorization: Bearer <KLING_API_KEY>Task Protocols
任务协议
Classic APIs:
- Create ID path:
data.task_id - Statuses: ,
submitted,processing,succeedfailed - Result paths: ,
data.task_result.videos[],data.task_result.images[]data.task_result.audios[]
Turbo APIs:
- Create ID path:
data.id - Poll path:
GET /tasks?task_ids=<id> - Statuses: ,
submitted,processing,succeededfailed - Result path:
data[0].outputs[]
Keep the parsers separate. Do not write a fuzzy parser that guesses between and or between and .
task_ididsucceedsucceeded经典API:
- 创建ID路径:
data.task_id - 状态:、
submitted、processing、succeedfailed - 结果路径:、
data.task_result.videos[]、data.task_result.images[]data.task_result.audios[]
Turbo API:
- 创建ID路径:
data.id - 轮询路径:
GET /tasks?task_ids=<id> - 状态:、
submitted、processing、succeededfailed - 结果路径:
data[0].outputs[]
请保持解析器独立。请勿编写模糊解析器来猜测与,或与之间的差异。
task_ididsucceedsucceededOmni References
Omni参考
Video Omni and Image Omni stay inside the existing provider tools through .
Do not create selector-level Omni operations.
api_family="omni"Video Omni accepts official reference structures:
- with
image_list[]and optionalimage_urlsuch astypeorfirst_frame.end_frame - with
video_list[], officialvideo_urlvalues such asrefer_typeorfeature, and optionalbase.keep_original_sound - with official
element_list[]values.element_id - Structured ; do not split natural language into shots automatically.
multi_prompt[]
Local image references may be normalized through . Local video paths must not be silently uploaded through fal.ai; ask for or require a reachable URL.
tools/_kling/media.pyImage Omni accepts with official values. Prompt placeholders such as must map stably to the provided image order. If the prompt already contains placeholders, validate that the referenced images exist and do not insert duplicates.
image_list[]image<<<image_1>>>Video Omni和Image Omni通过保留在现有提供者工具内。请勿创建选择器级别的Omni操作。
api_family="omni"Video Omni接受官方参考结构:
- ,包含
image_list[]以及可选的image_url(如type或first_frame)。end_frame - ,包含
video_list[]、官方video_url值(如refer_type或feature),以及可选的base。keep_original_sound - ,包含官方
element_list[]值。element_id - 结构化的;请勿自动将自然语言拆分为镜头。
multi_prompt[]
本地图像参考可通过进行标准化。本地视频路径不得通过fal.ai静默上传;需要求用户提供可访问的URL。
tools/_kling/media.pyImage Omni接受包含官方值的。提示占位符(如)必须稳定映射到提供的图像顺序。若提示已包含占位符,需验证引用的图像是否存在,且不得插入重复内容。
imageimage_list[]<<<image_1>>>Capability Boundaries
能力边界
TTS, avatar, and lip sync are provider additions to existing OpenMontage capabilities. Audio effects and video effects are official Kling endpoints, but they are not registered as default OpenMontage tools until a pipeline has a stable capability slot for them.
- Do not add or
sound_effectscapabilities from inside a provider implementation.video_effects - Do not let video effects enter the ordinary selector path.
video_generation - Do not disguise short sound effects as long background music unless a pipeline explicitly consumes that shape and the tool's /
best_forsays so.not_good_for
TTS、虚拟形象和唇形同步是对现有OpenMontage能力的提供者扩展。音频特效和视频特效是官方Kling端点,但在流水线拥有稳定能力插槽前,它们不会注册为默认OpenMontage工具。
- 请勿在提供者实现内添加或
sound_effects能力。video_effects - 请勿让视频特效进入常规选择器路径。
video_generation - 除非流水线明确支持该形式且工具的/
best_for有相关说明,否则请勿将短音效伪装成长背景音乐。not_good_for
Video Parameters
视频参数
Use for OpenMontage semantics:
operationtext_to_videoimage_to_videoreference_to_video
Use for official protocol choice:
api_familyclassicturboomni
Important constraints:
- Official video provider input schema must not expose top-level ; use
image_urlorreference_image_url.reference_image_path - Classic image-to-video accepts or a local path converted to raw base64 in official field
reference_image_url.image - Turbo image-to-video requires a URL first frame. Do not upload local files through fal.ai as a fallback.
- Send only where the current schema supports it: Classic text-to-video, Turbo text-to-video, and Video Omni.
aspect_ratio - Default paid path should avoid , native sound, or batch behavior unless explicitly selected.
4k
使用来适配OpenMontage语义:
operationtext_to_videoimage_to_videoreference_to_video
使用来选择官方协议:
api_familyclassicturboomni
重要约束:
- 官方视频提供者输入模式不得暴露顶层;请使用
image_url或reference_image_url。reference_image_path - 经典图生视频接受或转换为原始base64的本地路径(对应官方字段
reference_image_url)。image - Turbo图生视频要求提供第一帧的URL。请勿通过fal.ai上传本地文件作为 fallback。
- 仅在当前模式支持的场景下发送:经典文生视频、Turbo文生视频和Video Omni。
aspect_ratio - 默认付费路径应避免、原生音效或批量行为,除非用户明确选择。
4k
Image Parameters
图像参数
Use for and for .
api_family="generation"/v1/images/generationsapi_family="omni"/v1/images/omni-imageGeneration/edit path:
- is required and should stay under the official 2500 character limit.
prompt - passes through as official
image_url.image - is converted to raw base64 and sent as official
image_path.image - can be
image_referenceorsubject.face
Omni path:
- Put references in using official
image_list[]values.image - Use prompt placeholders such as only when the prompt needs to bind a specific reference image.
<<<image_1>>>
使用对应,使用对应。
api_family="generation"/v1/images/generationsapi_family="omni"/v1/images/omni-image生成/编辑路径:
- 为必填项,且长度应控制在官方限制的2500字符以内。
prompt - 直接作为官方
image_url字段传递。image - 转换为原始base64后作为官方
image_path字段发送。image - 可选值为
image_reference或subject。face
Omni路径:
- 将参考内容放入包含官方值的
image中。image_list[] - 仅当提示需要绑定特定参考图像时,才使用这类提示占位符。
<<<image_1>>>
TTS Parameters
TTS参数
kling_ttstextvoice_id- , currently
voice_languageorzhen voice_speed
Require an explicit unless an official account-specific default has been verified. Do not hard-code a made-up voice. Download every returned audio item, set to the first local file, and include , , , , and non-zero .
voice_iddata.output_pathvoice_idvoice_languagevoice_speedtask_idcost_usdkling_ttstextvoice_id- ,当前支持
voice_language或zhen voice_speed
除非已验证存在官方账户特定的默认值,否则必须要求用户明确提供。请勿硬编码虚构的语音。下载所有返回的音频项,将设置为第一个本地文件,并包含、、、和非零的。
voice_iddata.output_pathvoice_idvoice_languagevoice_speedtask_idcost_usdAvatar Parameters
虚拟形象参数
kling_avatar/v1/videos/avatar/image2video- avatar image via URL or local path converted to raw base64
- or
audio_idsound_file - optional
prompt - , such as
modeorstdpro
Keep it separate from local . Pipelines that want Kling avatar output must list and choose it explicitly.
talking_headkling_avatar/v1/videos/avatar/image2video- 通过URL或转换为原始base64的本地路径提供的虚拟形象图像
- 或
audio_idsound_file - 可选的
prompt - ,如
mode或stdpro
请将其与本地功能区分开。需要Kling虚拟形象输出的流水线必须明确列出并选择该功能。
talking_headLip Sync Parameters
唇形同步参数
kling_lip_sync- with
POST /v1/videos/identify-faceorvideo_id; read faces fromvideo_urldata.face_data[] - with
POST /v1/videos/advanced-lip-syncand onesession_iditem containingface_choose[],face_idoraudio_id, and the sound start/end/insert timessound_file
Local video paths must not be silently uploaded through fal.ai or any other provider. If multiple faces are returned and the user did not pass or , stop and return the face list for confirmation unless was explicitly set. If auto-selecting, record the selection reason and selected face in the result/artifact.
face_idface_chooseauto_select_face=Truekling_lip_sync- 向发送请求,携带
POST /v1/videos/identify-face或video_id;从video_url中读取人脸信息data.face_data[] - 向发送请求,携带
POST /v1/videos/advanced-lip-sync和一个session_id项,其中包含face_choose[]、face_id或audio_id,以及音效的开始/结束/插入时间sound_file
本地视频路径不得通过fal.ai或其他提供者静默上传。若返回多个人脸且用户未传递或,需停止操作并返回人脸列表供用户确认,除非明确设置了。若启用自动选择,需在结果/工件中记录选择原因和选中的人脸。
face_idface_chooseauto_select_face=TrueAudio Effects And Video Effects
音频特效与视频特效
Official Kling audio effects (, ) and video effects () are intentionally not default OpenMontage selector tools. Record the non-mapping reason in docs/tests instead of registering tools that current pipelines might misuse.
/v1/audio/text-to-audio/v1/audio/video-to-audio/v1/videos/effects官方Kling音频特效(、)和视频特效()并非默认OpenMontage选择器工具。请在文档/测试中记录未映射的原因,而非注册当前流水线可能误用的工具。
/v1/audio/text-to-audio/v1/audio/video-to-audio/v1/videos/effectsElements Helper
元素助手
Elements are an internal Kling Official helper, not a new OpenMontage tool capability.
Use to normalize , optionally query read-only element endpoints, and record element metadata when queried. Do not create or delete elements from the default provider path.
tools/_kling/elements.pyelement_list[].element_id元素是Kling官方内部助手,并非新的OpenMontage工具能力。请使用来标准化,可选择性查询只读元素端点,并在查询时记录元素元数据。请勿在默认提供者路径中创建或删除元素。
tools/_kling/elements.pyelement_list[].element_idAccount Usage Helper
账户使用助手
Account Usage is diagnostic only. Use for low-frequency checks, with local cache and throttle protection. Do not call it before every generation and do not put it in selectors or production pipeline stages.
tools/_kling/account.py/account/costsFor or , surface that the account or resource pack is exhausted and include an account-usage diagnostic hint.
11011102账户使用情况仅用于诊断。请使用进行低频率的检查,并提供本地缓存和限流保护。请勿在每次生成前调用该接口,也请勿将其放入选择器或生产流水线阶段。
tools/_kling/account.py/account/costs若遇到或错误,需告知用户账户或资源包已耗尽,并提供账户使用情况的诊断提示。
11011102Callback Notes
回调说明
Providers may accept , but polling remains the default execution mode.
callback_url- Classic and Omni paths pass at the top level.
callback_url - Turbo paths pass it as .
options.callback_url - Successful results should record ,
callback_requested=true, thepolling_used=true, andcallback_url.task_id - Validate callback URLs before sending; only absolute or
httpURLs should pass.https
提供者可接受,但轮询仍是默认执行模式。
callback_url- 经典和Omni路径在顶层传递。
callback_url - Turbo路径通过传递。
options.callback_url - 成功结果应记录、
callback_requested=true、polling_used=true和callback_url。task_id - 发送前需验证回调URL;仅允许绝对或
httpURL通过。https
Error Handling
错误处理
Surface official , , and whenever available.
codemessagerequest_idDo not retry:
- Auth failures: -
10001004 - Balance/resource-pack exhaustion: ,
11011102 - Permission/model access:
1103 - Parameter errors: ,
12001201 - Safety policy:
1301
Limited retry is acceptable for:
- request too fast
1302 - concurrency/resource-pack slot limit
1303 - ,
5000,5001server/maintenance/backlog errors5002
For , explain that the account hit a concurrency or resource-pack slot limit.
1303只要可用,就需展示官方、和。
codemessagerequest_id以下情况请勿重试:
- 认证失败:-
10001004 - 余额/资源包耗尽:、
11011102 - 权限/模型访问:
1103 - 参数错误:、
12001201 - 安全策略:
1301
以下情况可进行有限次数的重试:
- 请求过快
1302 - 并发/资源包插槽限制
1303 - 、
5000、5001服务器/维护/积压错误5002
若遇到错误,需向用户说明账户已达到并发或资源包插槽限制。
1303Cost Governance
成本管控
Official Kling is a paid remote API. Provider tools must return non-zero conservative estimates from and include on successful paid results. Treat estimates as low-confidence until account usage reconciliation is implemented.
High-cost Omni inputs such as multiple references, element IDs, , , and must increase or flag the cost estimate.
estimate_cost()cost_usdresult_type="series"mode="4k"sound="on"官方Kling是付费远程API。提供者工具必须从返回非零的保守估算值,并在成功的付费结果中包含。在实现账户使用对账前,估算值视为低可信度。高成本Omni输入(如多参考、元素ID、、、)必须提高或标记成本估算。
estimate_cost()cost_usdresult_type="series"mode="4k"sound="on"Prompt Notes
提示说明
For video, start from the universal OpenMontage video prompt skeleton: subject, subject motion, scene, spatial framing, and camera. Kling tends to respond well to clear temporal action order, camera movement verbs, and concise negative prompts. For reference workflows, state what should stay consistent from the reference and what should change.
对于视频生成,请从通用OpenMontage视频提示框架入手:主体、主体动作、场景、空间构图和镜头。Kling对清晰的时间动作顺序、镜头移动动词和简洁的负面提示响应较好。对于参考工作流,请说明参考内容中应保持一致的部分和需要更改的部分。