OpusGate

Endpoints & authentication

OpusGate is wire-compatible with both the Anthropic and OpenAI APIs. Anything built for either SDK works by changing the base URL and the key — request and response bodies are the vendor originals, passed through unchanged.

Base URL
https://api.opusgate.dev for Anthropic-style clients (they add /v1/... themselves); https://api.opusgate.dev/v1 for OpenAI-style clients.

Authentication

Every request needs your sk-og-... key from the Keys page. Both standard header conventions are accepted — use whichever your SDK sends:

HTTP
Authorization: Bearer sk-og-...
# — or —
x-api-key: sk-og-...

A missing key returns 401 {"error": "missing_api_key"}, an unknown or revoked one 401 {"error": "invalid_api_key"} — see error codes.

Endpoints

EndpointProtocolPurpose
POST /v1/messagesAnthropic MessagesChat / agent requests with Claude-native features (system, tools, thinking). Streaming via "stream": true.
POST /v1/chat/completionsOpenAI Chat CompletionsSame models through the OpenAI wire format — for OpenAI-SDK tools. Streaming supported.
POST /v1/messages/count_tokensAnthropicCount tokens for a request without running it (free).
GET /v1/modelsOpenAI-styleList of model IDs available to your key. Human-readable catalog with prices: models page.

Quick test with curl

Anthropic protocol
Bash
curl https://api.opusgate.dev/v1/messages \
  -H "x-api-key: sk-og-..." \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4.6",
    "max_tokens": 100,
    "messages": [{"role": "user", "content": "Say hi"}]
  }'
OpenAI protocol
Bash
curl https://api.opusgate.dev/v1/chat/completions \
  -H "Authorization: Bearer sk-og-..." \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4.6",
    "messages": [{"role": "user", "content": "Say hi"}]
  }'

SDK configuration

Anthropic SDK (Python / TypeScript)
Python
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.opusgate.dev",  # no /v1 — the SDK adds it
    api_key="sk-og-...",
)
TypeScript
import Anthropic from '@anthropic-ai/sdk';

const client = new Anthropic({
  baseURL: 'https://api.opusgate.dev',  // no /v1 — the SDK adds it
  apiKey: 'sk-og-...',
});
OpenAI SDK
Python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.opusgate.dev/v1",  # /v1 required
    api_key="sk-og-...",
)

Streaming

Set "stream": true in the body (or use your SDK's streaming call) — responses arrive as standard server-sent events in the vendor's own event format. For generations longer than a couple of minutes, streaming is strongly recommended: non-streaming requests are cut off at the 180-second gateway timeout (see rate limits).

← PreviousOpenCodeNext →Error codes