SDKs

Quote, stream, receipt, budget. From code.

Minimal Python and TypeScript clients for the agent account. They cover models, quotes, streaming chat, receipts, agent account creation and per-key budgets.

PythonTypeScriptStreamingBudgetsReceipts

Python

pip install -e sdk/python
from fikra import Fikra client = Fikra(api_key="fk_...") q = client.quote(model="deepseek-v4.1-flash-1017", messages=[{"role":"user","content":"Hello"}], max_tokens=512) for chunk in client.chat(model="deepseek-v4.1-flash-1017", messages=[{"role":"user","content":"Hello"}], max_tokens=512, quote_id=q["quote_id"], stream=True): if chunk["type"] == "text": print(chunk["text"], end="") if chunk["type"] == "receipt": print(chunk)

TypeScript

npm install && npm run build
import { Fikra } from "fikra-api"; const client = new Fikra({ apiKey: process.env.FIKRA_API_KEY }); const q = await client.quote({ model: "deepseek-v4.1-flash-1017", messages: [{ role: "user", content: "Hello" }], max_tokens: 512 }); for await (const chunk of client.stream({ model: "deepseek-v4.1-flash-1017", messages: [{ role: "user", content: "Hello" }], max_tokens: 512, quote_id: q.quote_id })) { if (chunk.type === "text") process.stdout.write(chunk.text ?? ""); }
Agent budgets

Set a cap on the key the agent uses.

The existing key caps are enforced in code. Create a key with a daily or monthly cap, or update it later.

# Python key = client.create_key(agent_token, name="worker", daily_cap_usd=5, monthly_cap_usd=50) client.set_budget(agent_token, key["id"], daily_cap_usd=10)
// TypeScript const key = await client.createKey(agentToken, { name: "worker", daily_cap_usd: 5, monthly_cap_usd: 50 }); await client.setBudget(agentToken, key.id, { daily_cap_usd: 10 });
Scope today: budgets are enforced per API key. A key over its cap gets HTTP 402 until the cap is raised or the window resets. x402 calls are individually priced and paid per request.
Receipts

Reconcile quote and actual.

The streaming response emits a final receipt event. The same receipt is available at GET /v1/agent/receipts/{id}.

curl https://api.fikraapi.co.ke/v1/agent/receipts/<receipt_id>

Receipts carry model, usage, quoted USD, actual cost and provider cost. They do not contain prompt or response bodies.