kirha
v0.1.1
Published
Official TypeScript SDK for the Kirha Search API
Downloads
186
Readme
Kirha SDK
TypeScript SDK for the Kirha API.
Installation
npm install kirha
# or
pnpm install kirha
# or
yarn add kirha
# or
bun add kirhaQuick Start
import { Kirha } from "kirha";
const kirha = new Kirha({
apiKey: process.env.KIRHA_API_KEY,
vertical: "crypto",
});
const result = await kirha.search("What is the profit and loss of the largest USDC holder on Base?");
console.log(result.data);Examples
Summarization
const kirha = new Kirha({ apiKey: "your-api-key" });
const result = await kirha.search("What is the profit and loss of the largest USDC holder on Base?", {
vertical: "crypto",
summarization: "kirha-flash",
});
console.log(result.summary);Summarization with instruction
const kirha = new Kirha({ apiKey: "your-api-key" });
const result = await kirha.search("What is the profit and loss of the largest USDC holder on Base?", {
vertical: "crypto",
summarization: {
model: "kirha-flash",
instruction: "Format the response as a table with columns: Address, PnL, Percentage",
},
});
console.log(result.summary);Plan mode
const kirha = new Kirha({ apiKey: "your-api-key" });
const plan = await kirha.plan("Compare trading volumes on Ethereum vs Base network", {
vertical: "crypto",
});
// Review plan (Human in the loop or agent validation)
console.log(plan.steps);
console.log(plan.usage);
const result = await plan.execute();
console.log(result.data);Direct tool calling
const tools = await kirha.tools({ vertical: "crypto" });
console.log(tools.map(t => t.name));
const result = await kirha.executeTool("zerion_getEthereumWalletProfitAndLoss", {
currency: "usd",
ethereumAddress: "0xbbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb",
});Local planning with Kirha tools
import { Kirha } from "kirha";
const kirha = new Kirha({
apiKey: "your-api-key",
planner: "http://localhost:8080/v1", // any OpenAI completion api endpoint running our open source kirha/planner model
vertical: "crypto",
});
const result = await kirha.search("What is the profit and loss of the largest USDC holder on Base?");
console.log(result.data);Documentation
- API Mode - Full API reference
- Local Mode - Local planning with hybrid tools
Errors
| Error | Description |
|-------|-------------|
| KirhaError | Base error class |
| ConfigurationError | Invalid SDK configuration |
| ApiError | API returned an error |
| AuthenticationError | Invalid or missing API key (401) |
| RateLimitError | Rate limit exceeded (429) |
| ValidationError | Invalid input parameters |
| PlanExpiredError | Plan expired (5 minute limit) |
| NetworkError | Network/connection failure |
License
MIT
