RuntokenDocs

Integration guide

Revision 2 · Updated 2026-11-12 · 2 min read

Connect models to Runtoken through their native protocols.

Prerequisites#

Before you start, prepare:

  • Create a platform API key in the console; keep it on the server.
  • Copy the model ID and native protocol from the catalogue.
  • Prepare an HTTP client or SDK environment that can access the gateway.

Platform endpoint#

Every protocol shares one host. SDKs that expect an OpenAI-style base URL take the /v1 path.

Gatewayhttps://api.runtoken.net
OpenAI SDK base_urlhttps://api.runtoken.net/v1

Supported protocols#

ProtocolEndpointKey header
OpenAI Chat CompletionsPOST /v1/chat/completionsAuthorization: Bearer
OpenAI ResponsesPOST /v1/responsesAuthorization: Bearer
Responses CompactPOST /v1/responses/compactAuthorization: Bearer
Anthropic MessagesPOST /v1/messagesx-api-key · anthropic-version
Gemini v1betaPOST /v1beta/models/{model}:streamGenerateContentx-goog-api-key
EmbeddingsPOST /v1/embeddingsAuthorization: Bearer
Image generationPOST /v1/images/generationsAuthorization: Bearer
Image editsPOST /v1/images/editsAuthorization: Bearer
Audio speechPOST /v1/audio/speechAuthorization: Bearer
Audio transcriptionPOST /v1/audio/transcriptionsAuthorization: Bearer

Native asynchronous video tasks use a separate API, configured per model.

Example request#

Streaming chat request. Pick the protocol your model speaks.

bash
# Optional: prefer a channel with -H 'Channel-Slug: your-channel-slug'
curl -N 'https://api.runtoken.net/v1/chat/completions' \
  -H 'Authorization: Bearer YOUR_PLATFORM_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "YOUR_MODEL_ID",
    "messages": [{ "role": "user", "content": "Hello!" }],
    "stream": true
  }'

Replace these placeholders before running the example.

PlaceholderReplace with
YOUR_PLATFORM_KEYYour platform API key from the console.
YOUR_MODEL_IDA model ID for the selected protocol.

Routing#

Add an optional Channel-Slug header to prefer a channel. Copy the slug from the model’s price details.

How failover works#

  • If the preferred channel is unavailable or failing, the request falls back to the normal platform order before any output starts.
  • Once output has started, a request never switches channels.
  • Routes fixed by an administrator take precedence and never switch.

Billing & usage#

  • The platform requests usage from the model on every call. Interrupted streams may go to billing review.
  • Media is billed only on explicit evidence. Prices by count, characters or duration use zero token rates.
  • For transcription, use verbose_json to get duration where the model supports it.

Errors#

Errors return a JSON body with a type and a human-readable message.

200
Request succeeded.
400
The request body or a parameter is invalid.
401
Missing, invalid, expired or revoked key.
429
A rate or spend limit was reached. The error names the limit and when it resets.
503
Service temporarily unavailable. Retry with backoff.

Not supported yet#

Next steps#

Was this page helpful?