klingai-known-pitfalls

Featured

Avoid common mistakes when using Kling AI API. Use when troubleshooting or learning best practices. Trigger with phrases like 'klingai pitfalls', 'kling ai mistakes', 'klingai gotchas', 'klingai best practices'.

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Kling AI Known Pitfalls ## Overview Documented mistakes, gotchas, and anti-patterns from real Kling AI integrations. Each pitfall includes the symptom, root cause, and tested fix. ## Pitfall 1: Duration as Integer **Symptom:** `400 Bad Request` on valid-looking requests. ```python # WRONG -- duration as integer {"duration": 5} # CORRECT -- duration as string {"duration": "5"} ``` The API requires `duration` as a string `"5"` or `"10"`, not an integer. ## Pitfall 2: JWT Without Explicit Headers **Symptom:** `401 Unauthorized` even with correct AK/SK. ```python # WRONG -- missing headers parameter token = jwt.encode(payload, sk, algorithm="HS256") # CORRECT -- explicit JWT headers token = jwt.encode(payload, sk, algorithm="HS256", headers={"alg": "HS256", "typ": "JWT"}) ``` Some JWT libraries don't include `typ: "JWT"` by default. Kling requires it. ## Pitfall 3: Token Generated Once at Import Time **Symptom:** Works for 30 minutes, then all requests fail with `401`. ```python # WRONG -- token generated once TOKEN = generate_token() # at module import headers = {"Authorization": f"Bearer {TOKEN}"} # CORRECT -- generate fresh token per request (or auto-refresh) def get_headers(): return {"Authorization": f"Bearer {generate_token()}"} ``` JWT tokens expire after 30 minutes. Always implement auto-refresh. ## Pitfall 4: Polling Without Timeout **Symptom:** Script hangs forever on a failed task. ```python # WRONG -- infinite loop while T...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

klingai-common-errors

Diagnose and fix common Kling AI API errors. Use when troubleshooting failed video generation or API issues. Trigger with phrases like 'kling ai error', 'klingai not working', 'fix klingai', 'klingai failed'.

2,266 Updated today
jeremylongshore
AI & Automation Featured

klingai-install-auth

Set up Kling AI API authentication with JWT tokens. Use when starting a new Kling AI integration or troubleshooting auth issues. Trigger with phrases like 'kling ai setup', 'klingai api key', 'kling ai authentication', 'configure klingai'.

2,266 Updated today
jeremylongshore
AI & Automation Featured

klingai-sdk-patterns

Production SDK patterns for Kling AI: client wrapper, retry logic, async polling, and error handling. Use when building robust integrations. Trigger with phrases like 'klingai sdk', 'kling ai client', 'klingai patterns', 'kling ai wrapper'.

2,266 Updated today
jeremylongshore
AI & Automation Featured

klingai-prod-checklist

Production readiness checklist for Kling AI integrations. Use before going live or during deployment review. Trigger with phrases like 'klingai production ready', 'kling ai go live', 'klingai checklist', 'deploy klingai'.

2,266 Updated today
jeremylongshore
AI & Automation Featured

klingai-rate-limits

Handle Kling AI API rate limits with backoff and queuing strategies. Use when hitting 429 errors or planning high-volume workflows. Trigger with phrases like 'klingai rate limit', 'kling ai 429', 'klingai throttle', 'kling api limits'.

2,266 Updated today
jeremylongshore