NEEDS AN EXTERNAL SERVICE
Kling Ai connects to an MCP server. It can need an account, an API key, or paid credits, and copying the prompt alone will not work. See the source repository for pricing and setup.
Kling AI for Claude Code
Use only the remote Global MCP configured by this plugin: https://kling.ai/mcp/plugin. .mcp.json is the connection source of truth. Do not switch regions, register a second Kling MCP, or start or depend on a local MCP server.
Request routing
- First determine the current deliverable: creative writing only, final generation settings awaiting approval, authorized submission, or an existing-task query. Creative writing ends with the requested prompt/plan. Final settings require live capability preparation; only an approved submission advances to generation.
- For image creation or editing, follow [kling-ai-generate-image](../kling-ai-generate-image/SKILL.md): text-to-image, image-to-image, posters, product photos, portraits, covers, and variants.
- For video prompts, storyboards, missing-image next steps, generation, model selection or motion transfer, follow [kling-ai-generate-video](../kling-ai-generate-video/SKILL.md). For generation preparation, discover relevant entry points including pure-text omni; prompt-only work and requesting a missing asset do not need account queries.
- Keep uploads, Elements, motion-library browsing, account operations, credit checks, and task status in this Skill. It also supplies the shared connection, billing, submission, and result rules for both generation Skills.
- Motion library: browse with
motion_library_list. Resolve the selected motion, then follow the video Skill for motion_control with a subject image and exactly one motion source. - Subject library / Elements: use
element_list, element_get, element_create, element_update, or element_delete for the requested operation. Resolve real IDs before reuse. - Account and credits: use
query_membership_and_credits; model capabilities come from who_am_i. - Existing tasks: use
query_tasks with a known generationId. A status or library request never creates a generation. - Sign-out or account switching: act only on an explicit user request, stay on the Global endpoint, and complete native Claude Code OAuth before further Kling calls.
Call only tools present in the live tool list. An attachment alone does not determine its role; clarify only when first frame, tail frame, identity/product reference, editable source, motion source, or style reference would materially change the request.
Read [asset workflows](references/asset-workflows.md) for Elements, the motion library, or uploads. Before generation, follow [capability discovery](references/capability-discovery.md), then [model parameters](references/model-parameters.md), [tool workflows](references/tool-workflows.md), and the [MCP contract](references/mcp-contract.md). Use [prompt examples](references/prompt-examples.md) for creative direction and [troubleshooting](references/troubleshooting.md) after a failure.
Connection and task identity
- Use OAuth through Claude Code's native MCP connection flow (
/mcp, then the plugin's kling-ai server). Never request an API key, token, cookie, authorization header, or credential file. Never log private account fields, upload tickets, or signed URLs. - Let Claude Code manage OAuth discovery, client registration, and credentials through its native MCP flow. This plugin does not configure a custom OAuth client name; do not invent registration overrides or block authorization because the host cannot set one. If the real OAuth flow fails, report the sanitized error and follow [troubleshooting](references/troubleshooting.md).
- Create one UUIDv7
taskTraceId for each unrelated new objective. Reuse it across discovery, upload, generation, and querying for that objective wherever the live tool accepts it. - Preserve exact returned IDs. Present
generationId as the task number; expose taskTraceId only when troubleshooting requires it.
Billing and single submission
- Image, video, and motion generation consume credits. Call
who_am_i during preparation and select only models returned in the current account's availableModels for the chosen tool, with their declared arguments, inputs, and combination limits. Follow capability discovery for cross-tool selection and refresh stale definitions before proceeding. Do not infer model access from a tool's existence, membership tier, or static examples. - Show the final workflow, model, prompt summary, duration/resolution, aspect ratio, output count, and reference roles. Honor existing explicit authorization for the same unsubmitted intent and unchanged final settings; otherwise obtain confirmation before submission. An upload, library operation, or credit check is not generation approval.
- Include any billing disclosure required by the live model/tool in those final settings. For omni reference that declares per-second billing with input video duration included, explain both facts before submission; output duration alone is not the total billed duration. Do not invent a rate or total credit estimate.
- Submit at most once per approved intent. Never automatically retry or silently change models after a failure, timeout, ambiguous response, or rendering problem.
- Do not save an Element automatically during ordinary generation. Element writes and deletion must follow the user's explicit request as described in [asset workflows](references/asset-workflows.md).
Generation and results
- Resolve reference roles, Elements, and motion sources; prepare local media before submission. Use the returned provider references exactly as the selected live schema requires.
- Confirm the final billable settings, then call the chosen generation tool once. A multi-shot plan remains one task unless the user approves separate tasks.
- Once
generationId is known, use only query_tasks for follow-up. If the submission response is lost before an ID is known, stop and report that creation/billing state is unknown. query_tasks requires that ID; it cannot list recent tasks, inspect credits, or recover a task by taskTraceId. An unchanged balance or an absent history entry cannot prove that creation or billing failed. A new submission needs fresh authorization even if the user later reports no visible task. - If Claude Code renders the generation MCP App, let that App own task refresh. Do not poll the same task from the model or add duplicate media, thumbnails, or download links.
- If no App renders, query at the provider-permitted interval until terminal, cancelled, or the turn cannot continue. Report the actual state and task number, with the tool's text fallback and at most one primary result link. Do not add Markdown image/video embeds or claim an unmounted App was displayed.
- For an explicit status request, query once and report the current state; do not start a long polling loop.
- Claim completion only after terminal success with usable primary media. If work-level status exists it must also be successful; a video cover alone is not a completed video.
Quality defaults
Apply only when the user has not specified another choice and the live model supports it:
- Prefer full-quality models. Use Turbo, fast, or low-cost modes when the user prioritizes drafts, speed, or credit savings.
- Images: prefer
2k for normal delivery and 4k for commercial or crop-heavy work; use 1k for drafts or speed. Never lower a higher live default. - Videos: prefer
1080p for normal delivery and supported 4k for commercial or post-production work; use 720p for drafts, cost, speed, or model limitations. - Generate one result unless more are requested. Use about 5 seconds for one action, about 10 seconds for two connected beats, and longer only when supported and needed. Motion-control duration comes from the selected source and live constraints.
- When the user did not specify a ratio, infer it from the destination, or preserve the first frame for image-to-video unless the tool requires one. When the user did specify a ratio, pass that supported value even with a first frame.
Failure behavior
- Unauthorized: use native Claude Code OAuth and continue only after authorization succeeds.
- Unsupported argument: refresh the live definitions, revise only unsupported settings, and obtain confirmation before a new generation.
- Insufficient credits or provider failure: report the provider message and preserve the task number; do not resubmit.
- Expired media URL: query the original
generationId for current outputs before reuse. A failed refresh is not permission to create a replacement task.