# @kluai/core

> ## Description

Latest version **0.1.19** (published 2025-04-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install @kluai/core
pnpm add @kluai/core
yarn add @kluai/core
bun add @kluai/core
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.19 |
| Published | 2025-04-24 |
| First published | 2023-08-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 8 |
| Unpacked size | 278.3 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | stefanklu |

## Links

- npm: https://www.npmjs.com/package/@kluai/core
- npm.io page: https://npm.io/package/@kluai/core

## Dependencies (8)

- [fs](https://npm.io/package/fs.md) ^0.0.1-security
- [uuid](https://npm.io/package/uuid.md) ^9.0.0
- [axios](https://npm.io/package/axios.md) ^1.4.0
- [react](https://npm.io/package/react.md) ^18.2.0
- [openai](https://npm.io/package/openai.md) ^4.28.0
- [form-data](https://npm.io/package/form-data.md) ^4.0.0
- [eventsource](https://npm.io/package/eventsource.md) ^2.0.2
- [@microsoft/fetch-event-source](https://npm.io/package/@microsoft/fetch-event-source.md) ^2.0.1

## Recent versions

- 0.1.19 (latest) — 2025-04-24
- 0.1.18 — 2025-03-18
- 0.1.17 — 2025-02-17
- 0.1.16 — 2025-02-05
- 0.1.15 — 2025-02-01
- 0.1.14 — 2025-01-08
- 0.1.13 — 2024-11-25
- 0.1.12 — 2024-11-04
- 0.1.11 — 2024-10-08
- 0.1.10 — 2024-09-12
- 0.1.9 — 2024-08-25
- 0.1.8 — 2024-06-17
- 0.1.7 — 2024-04-29
- 0.1.67 — 2024-04-24
- 0.0.66 — 2024-04-22
- … 50 more at https://npm.io/package/@kluai/core/versions

## README

# Klu.ai Typescript SDK

## Description

Klu.ai SDK for building AI-powerered apps

- [Documentation](https://docs.klu.ai)
- [GitHub](https://github.com/klu-ai/klu-typescript-sdk)
- [Npm](https://www.npmjs.com/package/@kluai/core)

The Klu.ai Typescript SDK is a library that provides access to the Klu API, allowing developers to interact with their Klu workspace, including: Apps, Actions, Context, Data, and Models.

## Requirements

The Klu.ai Typescript SDK can be installed in any JS / TS environment. The only requirements is to have npm.

## Installation

To install the Klu.ai Typescript SDK, simply run:

```
pnpm i @kluai/core
```

## Getting Started

First obtain an API key from your [Klu workspace](https://app.klu.ai/api/deep-link/settings/developers). Using your API key, create a `klu` object:

```typescript
import Klu from '@kluai/core';

const klu = new Klu('YOUR_API_KEY');
```

### Models

With the `klu` object, you can access the Models available in your Klu workspace:

```typescript
import Klu from '@kluai/core';

const klu = new Klu('YOUR_API_KEY');
const models = await klu.models.getAllModels();
```

### Get Apps

To list all Apps in your workspace, use:

```typescript
import Klu from '@kluai/core';

const klu = new Klu('YOUR_API_KEY');
const apps = await klu.apps.paginator.list();
```

### Action with Variables

Action prompts support dynamic variables injected at run time.

```typescript
import Klu from '@kluai/core';

const klu = new Klu('API_KEY');

async function promptAction() {
  const result = klu.actions.prompt(actionId, {
    topic: 'Machine Learning.',
    task: 'Correct any grammar or spelling mistakes.',
  });
  console.log(result);
}

promptAction();
```

### Streaming

Streaming is commonly used to improve the user experience. A unique streaming url generates as part of the Action response and the Klu SDK manages the SSR session.

```typescript
import Klu from '@kluai/core';

const klu = new Klu('YOUR_API_KEY');

const dataStream = await klu.actions.stream('actionGuid', 'prompt input');
for await (const token of dataStream) {
  tokens.push(token || '');
}
```

### Get Action Data

Get a list of Data generations for an Action, you can use:

```typescript
import Klu from '@kluai/core';

const klu = new Klu('YOUR_API_KEY');
const data = await klu.actions.getData('actionGUID');
```

## Documentation

For more detailed information on how to use the Klu.ai Typescript SDK, please refer to the [SDK documentation](https://docs.klu.ai/resources/api-basics).

## License

Free Software: MIT License

The Klu SDK is open source software released under the MIT License. This permissive license allows you to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Klu SDK, subject to a few simple conditions:

- Copyright notice - You must include the copyright notice in all copies or substantial portions of the software.
- License notice - You must include the license notice in all copies or substantial portions of the software.
- Warranty disclaimer - The software is provided "as is" without warranty of any kind. The authors and copyright holders are not liable for any claim, damages or other liability.
- Liability limitation - In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise.

---
_Source: https://npm.io/package/@kluai/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
