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

PropertyClientMain supported operations
klu.actionsActionsCRUD, run, stream, async run, deploy, versions, data, Skills, and Context links
klu.appsAppsCRUD, pagination through paginator, app Actions, and app Data helpers
klu.contextsContextsCRUD, document upload and management, embed, search, and prompt
klu.dataDataCRUD for generation records
klu.datasetDatasetCreate, get, delete, list by App, read Data, and an older add-Data helper
klu.experimentsExperimentsCRUD plus prompt helpers targeting an unregistered route
klu.feedbackFeedbackCRUD and multi-field log
klu.finetuneFinetuneClientGet, update, delete, and status; also defines an older process helper
klu.modelsModelsCreate/get/delete models; older provider helpers; get the default model
klu.sessionsSessionsCreate/get/delete/list and paginate session Data
klu.workspacesWorkspacesWorkspace 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

AttributeClientMain supported operations
klu.actionsActionsClientCRUD, run, stream, async run, deploy, versions, Data, Skills, and Context links
klu.appsAppsClientCRUD, list/pagination, app Actions, and app Data
klu.contextContextClientCRUD, documents, file upload, embed, search, and prompt
klu.dataDataClientCreate, get, update, and delete Data
klu.datasetDatasetClientCreate/get/delete, list by App, read Data, and an older add-Data helper
klu.evalsEvalClientCRUD and list Eval types/runs; also defines older unregistered run routes
klu.experimentsExperimentClientCRUD plus prompt helpers targeting an unregistered route
klu.feedbackFeedbackClientCRUD, list/pagination, and multi-field logging
klu.finetuneFinetuneClientGet/update/delete and status; also defines an older process helper
klu.modelsModelsClientModel CRUD/list and older Provider helpers
klu.sessionsSessionClientCreate/get/delete and list/pagination
klu.skillsSkillsClientGet, delete, and list
klu.workflowsWorkflowClientTrigger and per-run results, plus methods for older unregistered routes
klu.workspaceWorkspaceClientWorkspace 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.