agent-k.ai Developer API
OpenAI-compatible chat completions, live WebSocket market streams, and REST market data. Paid endpoints are metered per token; market data is free. Point your existing OpenAI SDK at https://agent-k.ai/v1 and start building.
Get a first call working in 60 seconds
Four steps: create an account, mint an API key, top up a few KAI credits, then hit the chat completions endpoint with any OpenAI-compatible client.
Register an account
Or sign up on the web dashboard. Returns a bearer JWT you can use immediately to mint a long-lived API key.
curl -sS -X POST https://agent-k.ai/v1/auth/register \
-H 'Content-Type: application/json' \
-d '{"email":"[email protected]","password":"a-long-password"}'Mint an API key
Creates a long-lived kai-... key. The raw secret is only shown once — copy it somewhere safe.
curl -sS -X POST https://agent-k.ai/v1/auth/api-keys \
-H "Authorization: Bearer $JWT" \
-H 'Content-Type: application/json' \
-d '{"name":"my-first-bot"}'Add KAI credits
Two paths: hosted Stripe checkout, or deposit SOL / USDC to your custodial address via the web Account page. 1 KAI = 1,000,000 micros.
curl -sS https://agent-k.ai/v1/billing/balance \
-H "Authorization: Bearer $KAI_KEY"Call the API
Point the OpenAI Python SDK at https://agent-k.ai/v1 with your key as the bearer token. No code changes beyond the base_url.
from openai import OpenAI
client = OpenAI(
base_url="https://agent-k.ai/v1",
api_key="kai-...",
)
resp = client.chat.completions.create(
model="kai-fast",
messages=[{"role": "user", "content": "hi"}],
max_tokens=20,
)
print(resp.choices[0].message.content)Endpoints
Every public /v1/* endpoint on agent-k.ai. Metered endpoints debit your KAI balance per request; everything else is free and rate-limited by key tier.
Auth
/v1/auth/register
Create an account (email + password)
/v1/auth/login
Sign in, returns a bearer JWT
/v1/auth/api-keys
List your API keys
/v1/auth/api-keys
Mint a new API key (secret shown once)
/v1/auth/api-keys/{key_id}
Revoke an API key
Billing
/v1/billing/balance
Current KAI credit balance (micros + KAI)
/v1/billing/usage
Metered request history with per-call cost
/v1/billing/stripe/checkout
Hosted Stripe URL for card top-ups
AI
/v1/chat/completions
OpenAI-compatible chat completions (streaming + reasoning toggle)
/v1/ai/chat
Simple single-prompt chat with an explicit cost breakdown
/v1/models
List available model aliases + upstream ids
Market data
/v1/market/ohlcv/{symbol}
Historical OHLCV candles from TimescaleDB
/v1/news
Recent AI-enriched market news feed
/v1/tokens/trending
Top trending tokens on a given network
/v1/tokens/{network_id}/{address}
Full metadata for a specific token
/v1/pumpfun/top
Top pump.fun tokens
Streaming
/v1/ws
Live OHLCV event stream (subscribe/unsubscribe, 10 conns/key, 50 channels/conn)
System
/v1/health
Liveness check (unauthenticated)
Pick a model: kai-fast or kai-smart
Both aliases back the same reasoning-capable LLM at the same per-token rate. The cost savings on kai-fast are organic — it generates ~100× fewer tokens for the same prompt because chain-of-thought is disabled.
kai-fast
Chain-of-thought disabled. Great for classification, routing, structured output, simple Q&A, agent sub-steps.
~2 completion tokens for a "say hi" prompt.
kai-smart
Full reasoning mode. Use for market structure reads, multi-step analysis, code generation, portfolio reviews.
~200 completion tokens for the same "say hi" prompt (mostly hidden reasoning).
Power users can override the default per-call with reasoning: false on any request.
Live market data over WebSocket
Free, per-tick OHLCV updates from 90+ symbols. Topic-based subscribe/unsubscribe protocol, snapshot-on-subscribe, JSON frames.
Python example
import asyncio, json, os, websockets
KEY = os.environ["KAI_API_KEY"]
async def stream():
url = f"wss://agent-k.ai/v1/ws?api_key={KEY}"
async with websockets.connect(url) as ws:
# First frame is the welcome
print(json.loads(await ws.recv()))
# Subscribe to one or more channels
await ws.send(json.dumps({
"op": "subscribe",
"channels": ["market.BTC.1m", "market.ETH.1m"],
}))
async for raw in ws:
msg = json.loads(raw)
if msg["op"] == "snapshot":
print(f"snapshot {msg['channel']}: {len(msg['data'])} bars")
elif msg["op"] == "event":
d = msg["data"]
print(f"{msg['channel']} c={d['close']} closed={d['is_closed']}")
elif msg["op"] == "ping":
await ws.send(json.dumps({"op": "pong", "ts": msg["ts"]}))
asyncio.run(stream())Protocol
- Channels
market.{SYMBOL}.{INTERVAL}— e.g.market.BTC.1m- Client ops
- subscribe, unsubscribe, ping, pong
- Server ops
- welcome, subscribed, snapshot, event, ping, error
- Limits
- 10 concurrent connections per key, 50 channels per connection
- Auth
?api_key=kai-...on the connect URL- Close codes
4401unauthorized,4429too many connections
Pay only for the AI
Market data, streaming, auth, and billing endpoints are free forever. Only the LLM endpoints debit your custodial KAI balance, priced per actual upstream token count.
Free forever
- ✓
/v1/market/ohlcv/{symbol}historical candles - ✓
/v1/wslive WebSocket market stream - ✓
/v1/news,/v1/tokens/*,/v1/pumpfun/top - ✓Auth, billing, and API key management (
/v1/auth/*,/v1/billing/*)
Rate-limited per key tier. WebSocket: 10 concurrent connections + 50 channels per connection.
Metered (AI)
- $
/v1/chat/completionsOpenAI-compatible - $
/v1/ai/chatsimple shape with explicit cost breakdown
Priced per real upstream token count (input + output) times the configured per-1k rate and a small service fee. Every call records a row in /v1/billing/usage with tokens_in, tokens_out, cost_micros, and latency_ms.
Tip: pass reasoning: false (or use kai-fast) on simple prompts to cut completion tokens ~100× vs the default.