API protocols

OctaRouter exposes three HTTP protocols. They are not three vendors — they are three ways to call the same gateway with the same API key.

Pass-through: OctaRouter forwards compatible requests to upstream providers. Use OctaRouter's base URL and your API key; all request and response parameters follow the official provider documentation linked below.

Protocol overview

ProtocolBase URLEndpointWhen to use
OpenAI-compatiblehttps://api.octarouter.com/v1POST /chat/completionsDefault for every model. Use when your tool expects OpenAI Chat Completions or you are unsure.
Anthropic Messageshttps://api.octarouter.comPOST /v1/messagesClaude models when your SDK or agent already speaks Anthropic.
Gemini generateContenthttps://api.octarouter.comPOST /v1beta/models/{model}:generateContentGemini / Google models when your client is Gemini-native.

Pick a model ID on the Models page before calling.

OpenAI-compatible (default)

Auth

Authorization: Bearer YOUR_API_KEY

Minimal example

curl "https://api.octarouter.com/v1/chat/completions" \
  -H "Authorization: Bearer sk-or-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Official reference: OpenAI Chat Completions API

Anthropic Messages

Use the gateway root URL (not the /v1 OpenAI prefix).

Headers

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
anthropic-version: 2023-06-01

Minimal example

curl "https://api.octarouter.com/v1/messages" \
  -H "Authorization: Bearer sk-or-..." \
  -H "Content-Type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "claude-3-5-sonnet-latest",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Official reference: Anthropic Messages API

Gemini generateContent

Minimal example

curl "https://api.octarouter.com/v1beta/models/gemini-2.0-flash:generateContent" \
  -H "Authorization: Bearer sk-or-..." \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"parts": [{"text": "Hello"}]}]
  }'

Official reference: Gemini API REST reference

Advanced: listing models programmatically

If your integration needs to fetch model IDs at runtime (instead of using the Models page):

  • OpenAI-compatible: GET https://api.octarouter.com/v1/models with Authorization: Bearer YOUR_API_KEY
  • SDK clients: point the OpenAI SDK at https://api.octarouter.com/v1 and call client.models.list()

Use the model IDs returned by these endpoints in your requests.