API Reference.
OpenAI, Anthropic and Gemini compatible endpoints. One Outrun key (sk-rs-...) works for every endpoint and every model.
Base URLs
Enter the base URL in your app exactly as shown. Apps add the request path (/chat/completions, /messages, ...) themselves.
| Protocol | Base URL | Used by |
|---|---|---|
| OpenAI-compatible | https://api.outrun.to/v1 | OpenAI SDKs, Codex, OpenCode, Cline, Zo Computer, Grok Build, most apps |
| Anthropic Messages | https://api.outrun.to | Claude Code, Anthropic SDKs (bare host, no /v1) |
| Gemini native | https://api.outrun.to/v1/gemini-cli | Gemini CLI, Google Gen AI SDKs (the client adds /v1beta/...) |
If an OpenAI-compatible app adds /v1 by itself, use the bare host https://api.outrun.to instead. Gemini native requests must go through https://api.outrun.to/v1/gemini-cli; plain https://api.outrun.to/v1beta/... is blocked by the firewall (403).
Authentication
Get your key in @outrunAPI_Bot -> My API key. Send it in one of these headers; never share it or commit it to a repository.
| Header | Example | Typical use |
|---|---|---|
| Authorization | Authorization: Bearer $OUTRUN_API_KEY | OpenAI-style requests (all /v1 endpoints) |
| x-api-key | x-api-key: $OUTRUN_API_KEY (plus anthropic-version: 2023-06-01) | Anthropic-style requests (/v1/messages) |
| x-goog-api-key or ?key= | x-goog-api-key: $OUTRUN_API_KEY | Gemini native requests (/v1/gemini-cli/v1beta/...) |
Endpoints
| Method | Path | What it does | Models |
|---|---|---|---|
| POST | / | OpenAI Chat Completions (add "stream": true to stream) | All text models; image models for chat-to-image |
| POST | / | OpenAI Responses API | GPT models (used by Codex) |
| POST | / | Anthropic Messages API | Claude models (used by Claude Code) |
| POST | / | Anthropic token counting | Claude models |
| GET | / | List the model IDs available to your key | - |
| POST | / | Generate an image | gemini-3-pro-image, gemini-3.1-flash-image, gpt-image-2, grok-imagine-image |
| POST | / | Text to speech | gemini-3.1-tts |
| POST | / | Speech to text: send the audio inside a chat message | gemini-3-stt |
| POST | / | Start a video generation task | Video models |
| GET | / | Check a video task | Video models |
| GET | / | Download the finished video (mp4) | Video models |
| POST | / | Gemini native generation | Gemini models |
| POST | / | Gemini native streaming (add ?alt=sse) | Gemini models |
| GET | / | Your Outrun Credit balance in USD | - |
| GET | / | Public price list as JSON (no key needed) | - |
Model IDs are case-sensitive and must match Models & Pricing exactly. /v1/audio/transcriptions is not available; use the input_audio example below for speech to text.
Chat Completions: request and response
curl https://api.outrun.to/v1/chat/completions \
-H "Authorization: Bearer $OUTRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hello in five words."}
],
"max_tokens": 64
}'{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "gpt-5.6-sol",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Hello there, nice to meet!" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 24, "completion_tokens": 8, "total_tokens": 32 }
}Responses API (GPT, Codex)
curl https://api.outrun.to/v1/responses \
-H "Authorization: Bearer $OUTRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-5.6-sol", "input": "Write a haiku about rivers.", "reasoning": {"effort": "high"}}'Anthropic Messages (Claude)
curl https://api.outrun.to/v1/messages \
-H "x-api-key: $OUTRUN_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model": "claude-sonnet-5", "max_tokens": 256, "messages": [{"role": "user", "content": "Hello, Claude"}]}'
# Count tokens before sending:
curl https://api.outrun.to/v1/messages/count_tokens \
-H "x-api-key: $OUTRUN_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model": "claude-sonnet-5", "messages": [{"role": "user", "content": "Hello, Claude"}]}'Gemini native
curl "https://api.outrun.to/v1/gemini-cli/v1beta/models/gemini-3.8-flash:generateContent" \
-H "x-goog-api-key: $OUTRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents": [{"role": "user", "parts": [{"text": "Explain DNS in one sentence."}]}]}'
# Streaming (server-sent events); the key can also go in ?key=
curl "https://api.outrun.to/v1/gemini-cli/v1beta/models/gemini-3.8-flash:streamGenerateContent?alt=sse&key=$OUTRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents": [{"role": "user", "parts": [{"text": "Count to five."}]}]}'List models
curl https://api.outrun.to/v1/models \
-H "Authorization: Bearer $OUTRUN_API_KEY"Image generation
curl https://api.outrun.to/v1/images/generations \
-H "Authorization: Bearer $OUTRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gemini-3-pro-image", "prompt": "A lighthouse at dawn, oil painting", "size": "16:9"}'
# Response: {"created": 1790000000, "data": [{"b64_json": "<base64 PNG>"}], "usage": {...}}
# Gemini image models return one image per request (n = 1).
# gpt-image-2 and grok-imagine-image use the same request shape.Text to speech
curl https://api.outrun.to/v1/audio/speech \
-H "Authorization: Bearer $OUTRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gemini-3.1-tts", "input": "Welcome to Outrun.", "voice": "Kore", "response_format": "wav"}' \
--output speech.wav
# Use a Gemini voice name (for example Kore) and response_format wav or pcm.Speech to text
# macOS / Linux: put the audio file into a JSON body as base64
B64=$(base64 < clip.mp3 | tr -d '\n')
cat > stt.json <<EOF
{"model": "gemini-3-stt",
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Transcribe this audio."},
{"type": "input_audio", "input_audio": {"data": "$B64", "format": "mp3"}}
]}]}
EOF
curl https://api.outrun.to/v1/chat/completions \
-H "Authorization: Bearer $OUTRUN_API_KEY" \
-H "Content-Type: application/json" \
-d @stt.jsonVideo generation
# 1) Start a task
curl https://api.outrun.to/v1/videos \
-H "Authorization: Bearer $OUTRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "veo-3.1-fast", "prompt": "A paper boat drifting down a rainy street", "seconds": 4, "size": "16:9"}'
# -> returns a task id and "status": "queued"
# 2) Check it every few seconds until "status" is "completed" (or "failed")
curl https://api.outrun.to/v1/videos/VIDEO_ID \
-H "Authorization: Bearer $OUTRUN_API_KEY"
# 3) Download the mp4
curl -L https://api.outrun.to/v1/videos/VIDEO_ID/content \
-H "Authorization: Bearer $OUTRUN_API_KEY" \
-o video.mp4Video is billed per second of output. Allowed lengths depend on the model; veo-3.1, veo-3.1-fast and gemini-omni-flash accept size 16:9 or 9:16; add "resolution": "4k" on veo-3.1 or veo-3.1-fast for the 4K tier. Links to finished videos point to api.outrun.to.
| Model | Allowed seconds |
|---|---|
| veo-3.1, veo-3.1-fast | 4, 6 or 8 |
| gemini-omni-flash | 3 to 10 |
| seedance-2.5-720p-official, seedance-2.5-720p, seedance-2.5-1080p, wan3.0-video-1080p | 4 to 30 |
| seedance-2.0-mini-720p, seedance-2.0-720p, seedance-2.0-1080p | 4 to 15 |
| grok-imagine-video, grok-imagine-video-1.5-1080p | 1 to 15 |
Check your credit
curl https://api.outrun.to/v1/account \
-H "Authorization: Bearer $OUTRUN_API_KEY"
# Response: {"currency": "USD", "credit": 12.34}Errors
Errors use the usual OpenAI / Anthropic JSON error shape. See Troubleshooting for fixes.
| Status | Meaning |
|---|---|
| 401 | "Invalid token" or "Invalid API key": the key is missing, mistyped or was replaced |
| Insufficient balance | Not enough Outrun Credit for the request; redeem a new code in the bot |
| 429 | Rate limit; wait a moment and retry |
| 503 | "<model> is temporarily paused"; try another model or check /status in the bot |
| 5xx | Upstream provider failure; retry after a short wait |