Call Aethyro's models from your own code — scripts, backend services, CI pipelines. No SDK required: it's a single JSON endpoint, billed in credits per request, same rates as the chat app.
Create a key from your dashboard, then:
curl -X POST https://uzmdqbtflcpikjdrggqc.supabase.co/functions/v1/api-chat \
-H "Authorization: Bearer ak_live_..." \
-H "Content-Type: application/json" \
-d '{"message": "Summarize the plot of Dune in two sentences.", "model": "sonnet"}'
{
"model": "sonnet",
"content": "...",
"usage": { "input_tokens": 18, "output_tokens": 64 },
"credits_charged": 1,
"credits_remaining": 199
}
Every key starts with ak_live_. Pass it as a bearer token — the API never sees or needs your Aethyro login, so it's safe to use from a server or CI job (never from client-side browser code, since anything in browser JS is visible to whoever loads the page). Keys are shown once at creation; if you lose one, revoke it and create a new one.
Authorization: Bearer ak_live_...
POST /functions/v1/api-chat — stateless: send the full conversation each time, same as most completion APIs. There's no server-side conversation history on this path.
| Field | Type | Notes |
|---|---|---|
| message | string | Shorthand for a single user turn. Use this or messages, not both. |
| messages | array | [{role: "user"|"assistant", content: string}], up to 20 entries, must end with a user turn. |
| model | string | haiku / sonnet / opus / auto. Defaults to sonnet. auto uses the same embedding-based router as chat.html, and the response's model field tells you which one it picked. |
| stream | boolean | If true, returns text/event-stream instead of a single JSON body — see Streaming below. Defaults to false. |
Pass "stream": true to get a standard Server-Sent Events response instead of waiting for the full reply. Each event is a JSON object on a data: line:
data: {"type": "delta", "text": "Para"}
data: {"type": "delta", "text": "mount"}
data: {"type": "done", "model": "sonnet", "content": "Paramount...", "usage": {"input_tokens": 18, "output_tokens": 64}, "credits_charged": 1, "credits_remaining": 198}
data: [DONE]
Billing happens once, after the stream completes — the done event carries the same credits_charged/credits_remaining fields the non-streaming response does. A stream that errors mid-flight sends a {"type": "error", ...} event (never partially billed) followed by [DONE].
Same per-1,000-token credit rates as the chat app — a request never costs less than 1 credit. Buy credit packs from your dashboard; they never expire.
| Model | Input / 1k tok | Output / 1k tok |
|---|---|---|
| Haiku | 0.08 credits | 0.40 credits |
| Sonnet | 0.30 credits | 1.50 credits |
| Opus | 1.50 credits | 7.50 credits |
| Status | Meaning |
|---|---|
| 401 | Missing, malformed, or revoked API key. |
| 400 | Malformed request body — see the returned error field. |
| 402 | Insufficient credits on the account that owns the key. |
| 429 | Over your key's per-minute limit (30, or 90 if the account has ever bought a Power or Pro pack). Check the Retry-After header (seconds). |
| 502 | The upstream model call failed. Safe to retry. |
This is still a v1. Streaming and auto model routing are both in now, and Power/Pro pack buyers get 90 req/min instead of 30 — but it's still fully stateless (no server-side conversation history, no file/image attachments, no tool use/web search on this endpoint — those stay chat.html-only for now). If you need any of those, tell us.
Free accounts start with 200 credits — enough to try the API before you buy more.
Create an account →