API endpoint reference
Every endpoint the gateway forwards. All paths are relative to the base URL (`https://www.sleepyai.org/api/v1`), and all require a valid key or session.
Every endpoint the gateway forwards. All paths are relative to the base URL
(https://www.sleepyai.org/api/v1), and all require a valid key or session.
The authoritative machine-readable manifest is
dashboard/lib/api-endpoints.ts; a test asserts it stays in lockstep with the proxy's allowlists, so this page and the proxy can't drift apart.
Metering key: tokens = billed per input/output token (cache reads at a lower rate) · native = billed per image / second / character · none = free, no upstream generation.
Chat & text
POST /v1/chat/completions — Chat completions
Standard OpenAI chat. Streaming and non-streaming, with tool calling. Billed as: input + output tokens.
Accepts the OpenAI envelope natively, and also understands the Anthropic messages envelope (it is translated).
curl https://www.sleepyai.org/api/v1/chat/completions \
-H "Authorization: Bearer ork_..." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{ "role": "user", "content": "Hello!" }],
"stream": true,
"max_tokens": 1024
}'
POST /v1/messages — Anthropic Messages
The Anthropic envelope that Claude Code and the Anthropic SDKs speak.
Translated to and from the OpenAI shape on the gateway. Billed as: input +
output tokens. Base URL for this path is …/api (see
Anthropic clients).
curl https://www.sleepyai.org/api/v1/messages \
-H "x-api-key: ork_..." \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "Hello!" }]
}'
POST /v1/messages/count_tokens — Count tokens
Size a context before sending it. Makes no generation call upstream, so it is never billed.
curl https://www.sleepyai.org/api/v1/messages/count_tokens \
-H "x-api-key: ork_..." \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-4-5","messages":[{"role":"user","content":"hi"}]}'
POST /v1/completions — Legacy completions
The pre-chat text-completion envelope, for older clients. Billed as: input
- output tokens.
POST /v1/systemone — SystemOne (TypeSafe / Jev)
TypeSafe SystemOne native-decision endpoint on the same host. Body is
{ model, state, questions }; no streaming. Billed as: input + output
tokens.
curl https://www.sleepyai.org/api/v1/systemone \
-H "Authorization: Bearer ork_..." \
-H "Content-Type: application/json" \
-d '{"model":"<model-id>","state":{},"questions":[]}'
Images
POST /v1/images/generations — Image generation
Generate up to 10 images per request (the gateway clamps n so upstream
can never serve more than was billed). Billed as: images returned (per-unit
price; variant pricing by size/quality when configured).
curl https://www.sleepyai.org/api/v1/images/generations \
-H "Authorization: Bearer ork_..." \
-H "Content-Type: application/json" \
-d '{"model":"dall-e-3","prompt":"a sleepy cat","n":1}'
Video
Video generation is asynchronous: create a job, poll it, download the result. Each job is owned by the user who created it.
POST /v1/videos — Create video job
Start a generation (up to 20 seconds per request). Billed as: seconds rendered.
curl https://www.sleepyai.org/api/v1/videos \
-H "Authorization: Bearer ork_..." \
-H "Content-Type: application/json" \
-d '{"model":"<video-model>","prompt":"a sleepy cat","seconds":5}'
GET /v1/videos/{id} — Poll video job
Read a job's status and result. Free. You can only fetch jobs you created.
GET /v1/videos/{id}/content — Download video
Stream the finished video file once the job succeeds. Free.
Audio
POST /v1/audio/speech — Text to speech
Synthesise speech. Input is capped at 4096 characters — over that the request is rejected rather than truncated. Billed as: input characters.
curl https://www.sleepyai.org/api/v1/audio/speech \
-H "Authorization: Bearer ork_..." \
-H "Content-Type: application/json" \
-d '{"model":"<tts-model>","input":"hello","voice":"alloy"}' \
--output speech.mp3
POST /v1/audio/transcriptions — Speech to text
Transcribe an uploaded audio file (multipart form). Billed as: audio
seconds, taken from the duration the provider reports (the gateway always
requests verbose_json so a duration comes back; a file with no reported
duration is metered as one second).
curl https://www.sleepyai.org/api/v1/audio/transcriptions \
-H "Authorization: Bearer ork_..." \
-F "model=<stt-model>" \
-F "[email protected]"
Catalogue
GET /v1/models — List models
List the models your plan can reach, in OpenAI's list shape. Free.
curl https://www.sleepyai.org/api/v1/models \
-H "Authorization: Bearer ork_..."
By default only runnable models are returned — a model your plan restricts,
or whose daily free allowance is exhausted, is omitted (or, with ?all=true,
annotated runnable: false plus a reason of plan, daily_limit, or
credits). See Models.
Each entry includes inputPrice, outputPrice, cacheReadPrice (per 1M
tokens when the model is token-billed), contextWindow, maxOutputLimit,
and the modality/type of the model.
Not served
Anything not listed above returns 404 with the list of supported endpoints —
including /v1/embeddings, /v1/responses, /v1/images/edits,
/v1/moderations, and /v1/complete. This is deliberate: an unlisted path
can't be metered, so it's refused rather than forwarded (an unmeterable path is
a billing hole, not a harmless upstream 404).
Next: Models · Errors & status codes