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.
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:
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
| Endpoint | Protocol | Purpose |
|---|---|---|
POST /v1/messages | Anthropic Messages | Chat / agent requests with Claude-native features (system, tools, thinking). Streaming via "stream": true. |
POST /v1/chat/completions | OpenAI Chat Completions | Same models through the OpenAI wire format — for OpenAI-SDK tools. Streaming supported. |
POST /v1/messages/count_tokens | Anthropic | Count tokens for a request without running it (free). |
GET /v1/models | OpenAI-style | List of model IDs available to your key. Human-readable catalog with prices: models page. |
Quick test with curl
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"}]
}'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
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.opusgate.dev", # no /v1 — the SDK adds it
api_key="sk-og-...",
)import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({
baseURL: 'https://api.opusgate.dev', // no /v1 — the SDK adds it
apiKey: 'sk-og-...',
});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).