Skip to main content

Installation

The SDK is available on npm. You can install it using your preferred package manager:

Initialization

Import and initialize the client. It automatically picks up the LARKUP_API_URL and LARKUP_API_KEY from your environment.
The base URL defaults to http://localhost:8080. When constructor values are omitted, the client reads LARKUP_API_URL and LARKUP_API_KEY.

Basic Usage

Adding a Document

addDocument() embeds and stores the document immediately. No second index call is required.

Bulk Indexing with Progress

indexDocuments() accepts sequential and parallel scheduling. It yields a progress event after every server response and a final completion event.
Use mode: "sequential" when request order matters or the embedding provider has a strict rate limit. Parallel mode only controls client request scheduling. The server’s semantic, hybrid, vector store, embedding, and chunking configuration remains authoritative.

Querying

Streaming Chat

Use chat() when you want to render tokens as they arrive:
Use chatText() when you only need the completed answer:

Agent Server

Use LarkupAgentClient when the Larkup Server toggle is set to Agent. It exposes the Agent’s loaded tools and consumes its AI SDK UI-message stream.
Use capabilities() to inspect grouped integrations—selected built-ins, skills, sandbox, one entry per MCP connection, and plugins. A capability marked configured is selected in the Project but is not executable by this runtime; active entries are loaded. tools() remains available when you need the raw tool list. configuration() returns the UI prompt, selected tools, skills, and sandbox configuration; sandbox() checks readiness without exposing credentials. Use chatText() when you only need the completed answer. Use chat() to access the raw AI SDK stream.

Choose a chat model

Every generated runtime exposes GET /models. Use the SDK to inspect the providers and models that the runtime can actually use, then send modelId on an individual chat request. This does not change the deployment default.
An AI Gateway runtime can select any language model returned by its catalog. A runtime configured with a direct provider accepts only that provider’s model IDs, so its configured API key is never used with another vendor. Browse the current catalog and provider capabilities in the Vercel AI Gateway model catalog.

Corpus Inspection and Export

Media

Marketplace Hub

Tool discovery uses a separate Hub client because Marketplace installation is a local CLI control operation.
Install a discovered tool on the Larkup host:

API Coverage

Local Demo

The repository includes a complete demo configured for http://localhost:8080:

Integrations

For connecting to the Vercel AI SDK or LangChain.js, see the dedicated Vercel AI SDK Integration and LangChain Integration guides.