Topics

DocsDeveloper reference

SDKs and tools

The Kling packages for developers in Iceland. @klingis/sdk for your server, @klingis/embed for the browser and @klingis/mcp for AI agents.

Kling has three 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/mcp MCP server for AI agents, also hosted at https://api.kling.is/mcp

@klingis/sdk

bash
npm install @klingis/sdk
typescript
import { 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

bash
npm install @klingis/embed

Or <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: create checkouts, payment links, products and customers, and read payments, subscriptions and reports. Kling hosts it at https://api.kling.is/mcp, authenticated with a Kling API key as a bearer token; the package runs the same server on your own machine. In the dashboard, the Connect AI assistants card on the API Keys & Docs page has a ready link for Claude and ChatGPT.

View as markdown