API Reference

One API.
Every model.

Authenticate with a key from Settings and you are one request away from production.

Authentication

Create a key in Settings → API keys. Send it as a bearer token. Keys are shown once and stored only as a hash.

curl -X POST {YOUR_APP_URL}/api/hai/inference \
  -H "Authorization: Bearer hai_live_…" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"Hello, world"}'

POST/api/hai/inference

Run one inference. Pin a deployment with ?deployment=<slug>, or pass model_id. Send Idempotency-Key to make retries safe.

{
  "prompt": "Write a haiku about speed",
  "model_id": "optional-model-id",
  "temperature": 0.7,
  "max_tokens": 512
}
{ "ok": true, "result": { "id": "…", "response": "…", "model_name": "…", "input_tokens": 9, "output_tokens": 17, "latency_ms": 412, "cache_hit": false, "price_micros": 0 } }

GET/api/hai/models

List the model catalog with capabilities, context windows, latency and your price per 1K tokens.

GET/api/hai/usage

Month-to-date usage: tokens, requests, spend, latency and free allowance remaining.

GET/api/hai/requests

Paginated request history (offset, limit, status).

POST/api/hai/venturerails/revenue

Report a sale earned through the platform. external_id de-duplicates retries.

{ "amount_cents": 4900, "external_id": "order_1042", "customer_email": "buyer@example.com", "route_id": "optional" }

POST/api/hai/venturerails/leads

Record a lead, optionally attributed to a payment route.

{ "email": "lead@example.com", "name": "Ada", "route_id": "optional" }

Errors

401 not authenticated · 402 overdue balance (pay in Billing to resume) · 404 unknown deployment · 409 deployment paused · 425 deployment still spinning up · 429 rate limited.