Skip to main content
Early access. The TypeScript SDK is an unsupported work in progress and may change or be removed without notice. It is provided for evaluation only - do not use it in production.
The @kosli/sdk package provides a type-safe TypeScript client for the Kosli API. It supports Node.js, Bun, Deno, and all modern browsers.

Installation

Install using your preferred package manager:
The package is published as an ES Module (ESM) only. CommonJS projects must use dynamic import:

Quick start

Authentication

Set your API key when constructing the client. This applies it to all requests:
Some operations accept the API key at the call site instead. Use this when you need per-request credentials:
See personal API keys and service accounts for how to create API keys.

Server selection

By default the SDK targets the EU region. Pass server: "us" to use the US region:
To point at a custom URL (e.g. a proxy or local instance), use serverURL instead:

Available resources

The client exposes the following resource groups:

Standalone functions

All methods are also available as individually importable functions, which allows bundlers to tree-shake unused code:

Supported runtimes

The SDK requires ECMAScript 2020 or later and the Web Fetch API. Supported environments:
  • Browsers: Chrome, Safari, Edge, Firefox (evergreen)
  • Node.js: active and maintenance LTS releases (v18, v20+)
  • Bun: v1 and above
  • Deno: v1.39+
For TypeScript projects, add "lib": ["es2020", "dom", "dom.iterable"] to your tsconfig.json to get full type support for async iterables, streams, and fetch-related APIs.

Debugging

Pass a logger to emit debug output for all requests and responses:
Alternatively, set the environment variable KOSLI_DEBUG=true.
Debug logging prints headers including your API key in plain text. Use it only during local development.

Package

The SDK is published on npm as @kosli/sdk.
Last modified on June 23, 2026