TypeScript SDK
The kirha package is a fully typed TypeScript client for the KIRHA API. It handles authentication, tool planning, provider orchestration, and response parsing so you can focus on building your agent logic.
With the SDK you can:
- Search across premium data providers with a single natural language query
- Plan and execute workflows where you review providers and costs before running the query
- Execute tools directly to give your agent access to the data providers without KIRHA's planning
- Run the planner locally to plan queries on your own machine
kirha-ai/kirha-sdk-typescript
40
Installation
npm install kirhapnpm add kirhayarn add kirhabun add kirhaSetup
Initialize the client with your API key:
import { Kirha } from "kirha";
const kirha = new Kirha({ apiKey: process.env.KIRHA_API_KEY });Run your first query
import { Kirha } from "kirha";
const kirha = new Kirha({ apiKey: process.env.KIRHA_API_KEY });
const result = await kirha.search("What does the boxed warning on Ozempic say?");
console.log(result.data); KIRHA picks the providers across every vertical. To restrict a search to one vertical, pass focus, in the constructor or per query:
const result = await kirha.search("List top 10 stablecoins yield on Ethereum", {
focus: "crypto",
});Error handling
All errors extend the base KirhaError class:
| Error | Description |
|---|---|
ConfigurationError | Invalid client configuration (missing API key, missing planner URL) |
AuthenticationError | Invalid or missing API key |
RateLimitError | Rate limit exceeded (20 requests/min) |
ValidationError | Invalid request parameters |
PlanExpiredError | Plan executed more than 5 minutes after it was created |
ApiError | Server-side error |
NetworkError | Connection or timeout failure |
Rate limits
All API requests are rate-limited to 20 requests per minute per API key. Plans are valid for 5 minutes after creation. If you need a higher quota, feel free to reach out with your use case at developers@kirha.com.