Skip to content
API PROTOCOLS & REFERENCE

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.

ProtocolBase URLUsed by
OpenAI-compatiblehttps://api.outrun.to/v1OpenAI SDKs, Codex, OpenCode, Cline, Zo Computer, Grok Build, most apps
Anthropic Messageshttps://api.outrun.toClaude Code, Anthropic SDKs (bare host, no /v1)
Gemini nativehttps://api.outrun.to/v1/gemini-cliGemini 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.

HeaderExampleTypical use
AuthorizationAuthorization: Bearer $OUTRUN_API_KEYOpenAI-style requests (all /v1 endpoints)
x-api-keyx-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_KEYGemini native requests (/v1/gemini-cli/v1beta/...)

Endpoints

MethodPathWhat it doesModels
POST/v1/chat/completionsOpenAI Chat Completions (add "stream": true to stream)All text models; image models for chat-to-image
POST/v1/responsesOpenAI Responses APIGPT models (used by Codex)
POST/v1/messagesAnthropic Messages APIClaude models (used by Claude Code)
POST/v1/messages/count_tokensAnthropic token countingClaude models
GET/v1/modelsList the model IDs available to your key-
POST/v1/images/generationsGenerate an imagegemini-3-pro-image, gemini-3.1-flash-image, gpt-image-2, grok-imagine-image
POST/v1/audio/speechText to speechgemini-3.1-tts
POST/v1/chat/completions (input_audio)Speech to text: send the audio inside a chat messagegemini-3-stt
POST/v1/videosStart a video generation taskVideo models
GET/v1/videos/{id}Check a video taskVideo models
GET/v1/videos/{id}/contentDownload the finished video (mp4)Video models
POST/v1/gemini-cli/v1beta/models/{model}:generateContentGemini native generationGemini models
POST/v1/gemini-cli/v1beta/models/{model}:streamGenerateContentGemini native streaming (add ?alt=sse)Gemini models
GET/v1/accountYour Outrun Credit balance in USD-
GET/pricingPublic 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 Request
Request · POST /v1/chat/completions
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
  }'
JSON Response (200 OK)
Response · application/json
{
  "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)

POST /v1/responses
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)

POST /v1/messages
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

POST /v1/gemini-cli/v1beta/models/{model}:generateContent
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

GET /v1/models
curl https://api.outrun.to/v1/models \
  -H "Authorization: Bearer $OUTRUN_API_KEY"

Image generation

POST /v1/images/generations
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

POST /v1/audio/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

POST /v1/chat/completions with input_audio
# 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.json

Video generation

POST /v1/videos, then GET /v1/videos/{id}
# 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.mp4
Try video and image models in the Playground

Video 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.

ModelAllowed seconds
veo-3.1, veo-3.1-fast4, 6 or 8
gemini-omni-flash3 to 10
seedance-2.5-720p-official, seedance-2.5-720p, seedance-2.5-1080p, wan3.0-video-1080p4 to 30
seedance-2.0-mini-720p, seedance-2.0-720p, seedance-2.0-1080p4 to 15
grok-imagine-video, grok-imagine-video-1.5-1080p1 to 15

Check your credit

GET /v1/account
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.

StatusMeaning
401"Invalid token" or "Invalid API key": the key is missing, mistyped or was replaced
Insufficient balanceNot enough Outrun Credit for the request; redeem a new code in the bot
429Rate limit; wait a moment and retry
503"<model> is temporarily paused"; try another model or check /status in the bot
5xxUpstream provider failure; retry after a short wait