The API.
A standard OpenAI-compatible API that can be used with most coding harnesses, agent frameworks, or LLM-compatible systems. Our LLM router sends your prompt to the best model for your task.
Get started
Open web chat and click the round account icon in the top right. Create a key under API keys. The key starts with kai_sk_ and is shown once. Copy it into your tool.
Then point anything that speaks the OpenAI dialect at three settings:
- Base URL
https://api.alohak.ai/v1 - API key
kai_sk_… - Model
kai
curl https://api.alohak.ai/v1/chat/completions \
-H "Authorization: Bearer kai_sk_…" \
-H "Content-Type: application/json" \
-d '{
"model": "kai",
"stream": true,
"messages": [{"role": "user", "content": "Hello!"}]
}'
Models
Model kai is the full K.ai experience. The router reads each request, picks the best lane, and searches the web when that makes the answer better.
Pinned models lock one lane and add nothing. No injected prompt, no retrieval. Your harness stays in charge, which is what a coding tool usually wants.
GET /v1/models lists every model with its prices. No key needed.
| Model | What it does |
|---|---|
kai · kai-auto | Routed, grounded, and cited. K.ai picks the lane |
kai-fast | Everyday answers, lowest latency and price |
kai-standard | More depth for ordinary work |
kai-multilingual | Strong non-English writing and translation |
kai-vision | Images in, understanding out |
kai-flagship | The strongest general lane |
kai-coding | Hard programming work |
kai-reasoning | Deep multi-step thinking |
Tools and agents
Function calling works the standard way. Send tools, get tool_calls back, return the results, repeat. Parallel calls work. So do temperature, top_p, max_tokens, stop, seed, the penalties, and JSON mode.
Model kai routes on its own and searches the web when that helps. A pinned model, or any request with tools or sampling settings, goes straight to that lane and obeys the harness.
Streams send a keep-alive every 15 seconds during silent thinking, so long runs do not drop. Add an Idempotency-Key header to a non-streaming request and a retried request bills once.
{
"model": "kai-coding",
"temperature": 0.2,
"tools": [{
"type": "function",
"function": {
"name": "run_tests",
"parameters": {
"type": "object",
"properties": { "path": { "type": "string" } }
}
}
}],
"messages": [{ "role": "user", "content": "Fix the failing test." }]
}
More than chat
The same base URL and key cover audio, images, and embeddings. Every endpoint keeps the standard OpenAI shape and the same transparent pricing.
POST /v1/audio/transcriptionsturns audio into textPOST /v1/audio/speechturns text into spoken audioPOST /v1/images/generationsmakes an image, returned inlinePOST /v1/embeddingsembeds text in over 100 languages
curl https://api.alohak.ai/v1/audio/speech \
-H "Authorization: Bearer kai_sk_…" \
-H "Content-Type: application/json" \
-d '{"input": "Hello!", "voice": "nova"}' \
--output aloha.mp3
Quickstarts
The OpenAI SDKs work unchanged. So does any tool that lets you set a base URL. Use kai for routed answers, or kai-coding to pin the coding lane.
Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.alohak.ai/v1",
api_key="kai_sk_...",
)
reply = client.chat.completions.create(
model="kai",
messages=[{"role": "user", "content": "Hello!"}],
)
print(reply.choices[0].message.content)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.alohak.ai/v1",
apiKey: "kai_sk_...",
});
const reply = await client.chat.completions.create({
model: "kai",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(reply.choices[0].message.content);
aider
export OPENAI_API_BASE=https://api.alohak.ai/v1 export OPENAI_API_KEY=kai_sk_... aider --model openai/kai-coding # or in .aider.conf.yml openai-api-base: https://api.alohak.ai/v1 openai-api-key: kai_sk_... model: openai/kai-coding
Continue
# ~/.continue/config.yaml
models:
- name: Kai
provider: openai
model: kai-coding
apiBase: https://api.alohak.ai/v1
apiKey: kai_sk_...
What every reply includes
Every reply says what it cost and what credit remains, in micro-dollars. One dollar is 1,000,000. The numbers ride two headers and a kai object in the body. A streamed reply carries them in the final chunk.
Out of credit returns HTTP 429 with insufficient_quota, the shape tools already understand. Top up with Lightning from $1 and get 15% bonus credit.
x-kai-cost-micro·x-kai-balance-microon every reply- Real token counts in
usage x-ratelimitheaders on every response
"kai": {
"tier": "fast",
"cost_micro": 1840,
"balance_micro": 4998160,
"searched": false
}
Try it
Paste a key, pick a model, write a prompt. The reply streams straight from the API to this page.
The API allows any origin, so a plain fetch works from any web page. Your key stays in this browser and is sent only to api.alohak.ai.
Privacy
The API is the same transient pipeline the apps use. Prompts and answers are never logged and never stored past delivery. Accounting keeps lane, token counts, latency, and cost. Never content.
Accounts are pseudonymous. No email, no phone number, no card. Keys are stored only as hashes. The secret exists once, on your screen. A revoked key dies on the next request.
- No prompt or answer logging
- No personal data attached to keys or credits
- Revoke any key instantly from web chat