@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:Server selection
By default the SDK targets the EU region. Passserver: "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+
"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:KOSLI_DEBUG=true.
Package
The SDK is published on npm as@kosli/sdk.