DocsDeveloper reference
SDKs and tools
The Kling packages for developers in Iceland. @klingis/sdk for your server, @klingis/embed for the browser, @klingis/cli to set up a project in one command and @klingis/mcp for AI agents.
Kling has four npm packages. All of them work with test keys straight away.
| Package | What it is |
|---|---|
@klingis/sdk |
Typed server SDK for the Kling API, generated from the OpenAPI spec |
@klingis/embed |
The payment window: checkout as an overlay on your site |
@klingis/cli |
Connects a project to Kling in one command |
@klingis/mcp |
MCP server for AI agents |
@klingis/cli
npx @klingis/cli initinit signs you in (or creates an account), detects your framework (Next.js, Remix, Astro, Express, Hono, Elysia or plain HTML), asks what you are building, can register a webhook, writes KLING_SECRET_KEY, KLING_API_URL and KLING_WEBHOOK_SECRET to .env.local (and adds it to .gitignore), and writes KLING_INTEGRATION.md, a prompt for your AI editor.
Other commands: kling status, kling login, kling login --api-key <key> (for CI), kling logout, kling env [live|test] and kling listen --forward <url>. With npx, write npx @klingis/cli status and so on.
@klingis/sdk
npm install @klingis/sdkimport { configure, postV1CheckoutSessions } from "@klingis/sdk";
configure({
baseUrl: "https://api.kling.is",
headers: { Authorization: `Bearer ${process.env.KLING_SECRET_KEY}` },
});
const res = await postV1CheckoutSessions({
amount: 5000, // 5.000 kr.
currency: "ISK",
success_url: "https://example.is/thanks",
});
if (res.status === 200) console.log(res.data.id, res.data.url);Function names follow the method and path: POST /v1/checkout/sessions is postV1CheckoutSessions, GET /v1/customers/{id} is getV1CustomersById. Each returns { data, status, headers }. The SDK uses the global fetch and runs in Bun and in bundled server code (Next.js, Remix, SvelteKit, Vite). In plain Node ESM without a bundler, call the REST API with fetch instead.
@klingis/embed
npm install @klingis/embedOr <script src="https://api.kling.is/v1/kling.js"></script>. See Payment window.
@klingis/mcp
Lets AI agents such as Claude, ChatGPT and Cursor work with your Kling account. See MCP server.