SDK exports
Use this page to choose the supported client surface before you start. Both SDKs are asynchronous, authenticate with a workspace API key, and call https://api.klu.ai/v1. For installation and key setup, see API and SDK basics.
TypeScript
Install @kluai/core, then import the default or named Klu class. The package also exports the public model and error types listed below.
import Klu, { type PersistedApp } from '@kluai/core'
const klu = new Klu('YOUR_API_KEY')
const app: PersistedApp = await klu.apps.get('APP_GUID')
console.log(app.name)
Client properties
| Property | Client | Main supported operations |
|---|---|---|
klu.actions | Actions | CRUD, run, stream, async run, deploy, versions, data, Skills, and Context links |
klu.apps | Apps | CRUD, pagination through paginator, app Actions, and app Data helpers |
klu.contexts | Contexts | CRUD, document upload and management, embed, search, and prompt |
klu.data | Data | CRUD for generation records |
klu.dataset | Dataset | Create, get, delete, list by App, read Data, and an older add-Data helper |
klu.experiments | Experiments | CRUD plus prompt helpers targeting an unregistered route |
klu.feedback | Feedback | CRUD and multi-field log |
klu.finetune | FinetuneClient | Get, update, delete, and status; also defines an older process helper |
klu.models | Models | Create/get/delete models; older provider helpers; get the default model |
klu.sessions | Sessions | Create/get/delete/list and paginate session Data |
klu.workspaces | Workspaces | Workspace methods targeting the older singular /workspace/ path |
The TypeScript Klu object does not expose top-level Evals, Skills, Workflows, Files, Documents, or Context Sources clients. Use the REST routes in the corresponding API reference when no client property is listed. Document and file helpers are available through klu.contexts.
Package exports
The package exports Klu as both a named and default export. It also exports types from these modules:
- Actions: errors, Action models, versions, and prompt response types.
- Apps: errors and App models.
- Common: shared errors and model utilities.
- Contexts: errors, Context models, documents, file input, and prompt responses.
- Data: Data models. Data-specific error types are not exported from the package root.
- Experiments: errors and Experiment models.
- Feedback: Feedback models. Feedback-specific error types are not exported from the package root.
- Finetune: errors, model, and status response types.
- Models: errors, Models, Providers, and provider-with-models types.
- Sessions: Session models. Session-specific error types are not exported from the package root.
- Workspaces: errors and Workspace models.
Dataset client classes and types are reachable through klu.dataset at runtime but are not re-exported from the package root. Avoid deep package imports because they are outside the public root export surface.
Python
Install klu, import Klu, and await client methods inside an async function.
import asyncio
from klu import Klu
async def main() -> None:
klu = Klu("YOUR_API_KEY")
app = await klu.apps.get("APP_GUID")
records = await klu.apps.get_data(app.guid)
print(records)
asyncio.run(main())
Client attributes
| Attribute | Client | Main supported operations |
|---|---|---|
klu.actions | ActionsClient | CRUD, run, stream, async run, deploy, versions, Data, Skills, and Context links |
klu.apps | AppsClient | CRUD, list/pagination, app Actions, and app Data |
klu.context | ContextClient | CRUD, documents, file upload, embed, search, and prompt |
klu.data | DataClient | Create, get, update, and delete Data |
klu.dataset | DatasetClient | Create/get/delete, list by App, read Data, and an older add-Data helper |
klu.evals | EvalClient | CRUD and list Eval types/runs; also defines older unregistered run routes |
klu.experiments | ExperimentClient | CRUD plus prompt helpers targeting an unregistered route |
klu.feedback | FeedbackClient | CRUD, list/pagination, and multi-field logging |
klu.finetune | FinetuneClient | Get/update/delete and status; also defines an older process helper |
klu.models | ModelsClient | Model CRUD/list and older Provider helpers |
klu.sessions | SessionClient | Create/get/delete and list/pagination |
klu.skills | SkillsClient | Get, delete, and list |
klu.workflows | WorkflowClient | Trigger and per-run results, plus methods for older unregistered routes |
klu.workspace | WorkspaceClient | Workspace methods targeting the older singular /workspace/ path |
Python client methods use snake_case, while request and response models may retain API field names such as ext_user_id or created_at. Import Klu from the package root for the stable entry point. Module-level client and model imports are available, but they couple your code to the SDK layout.
Unsupported SDK operations
An API route can exist even when an SDK client rejects or omits the operation. Current examples include Python sessions.update, skills.create, skills.update, and Workflow CRUD; TypeScript sessions.update, models.update, and dataset.update; and fine-tune creation through both high-level SDK clients. These methods raise an SDK not-supported/not-implemented error or are removed from the narrowed client type. Call the documented REST endpoint when you need that operation.
Some SDK methods target older paths that are absent from the current public router: Provider helpers, Workspace clients, Experiment prompts, fine-tune processing, Dataset add-Data, Python Eval run/single-run reads, and Python Workflow list/all-runs. Python Workflow trigger input also differs from the registered array contract. The App Data helpers expect an array while the route now returns a pagination envelope. Prefer the REST pages in this section for those operations until the SDK paths and response converters are updated.
SDK pagination helpers return model arrays rather than the REST { data, total_count, has_next_page } envelope. Use REST when you need the count and page-state fields exactly as returned by the API.
Errors
Both SDKs translate common missing-resource responses into resource-specific errors and wrap other HTTP failures in a general Klu API error. Keep network and API calls inside try/except or try/catch, and inspect the HTTP status and response detail for validation, authorization, quota, or upstream-provider failures.