Agent skill · software engineering · jeremylongshore

klingai-install-auth

Set up Kling AI API authentication with JWT tokens. Use when starting

Why this skill is useful

Adds executable scripts for generating and managing JWT tokens specifically for Kling AI API authentication.

What it needs

Requires node, python installed locally. Requires klingai account access. About 3k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

Kling AI Install & Auth Overview Kling AI uses JWT (JSON Web Token) authentication. You generate a token from your Access Key (AK) and Secret Key (SK), then pass it as a Bearer token in every request. Tokens expire after 30 minutes. Base URL: https://api.klingai.com/v1 Prerequisites Kling AI account at klingai.com API access enabled (self-service, no waitlist) Python 3.8+ with PyJWT or Node.js 18+ Step 1 — Get Credentials 1. Sign in at app.klingai.com/global/dev 2. Navigate to API Keys in the developer console 3. Click Create API Key to generate an Access Key + Secret Key pair 4. Store both values securely — the Secret Key is shown only once Step 2 — Generate JWT Token Python Node.js Step 3 — Verify Authentication Token Management Pattern Error Handling Error Cause Fix ------- ------- ----- 401 Unauthorized Invalid/expired JWT Regenerate token, check AK/SK 403 Forbidden API access not enabled Enable API in developer console JWT decode error Wrong secret key Verify SK matches the AK pair Token expired >30 min since generation Implement auto-refresh (see above) Clock skew error Server time mismatch Use nbf: now - 5 for tolerance Security Checklist Never commit AK/SK to version control Use .env files with .gitignore exclusion Rotate keys quarterly via the developer console Use separate keys per environment (dev/staging/prod) Set exp to 1800s max (Kling enforces this ceiling) Instructions 1. Configure credentials only through approved secret references and separate sandbox/staging/production identities; never paste AK/SK values into source, prompts, logs, or receipts. 2. Verify least-privilege scope, token lifetime, clock behavior, policy/rights workflow, credit cap, and draft-only destination with a synthetic canary. 3. Halt use on an authentication, scope, policy, budget, or retention anomaly; revoke or rotate the affected credential and restore the approved configuration. 4. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/klingai-install-auth

View the source on GitHub

Browse the @skills marketplace