Documentation Quickstart · 5 minutes

Make your first routed call

SentinelGateway speaks the OpenAI chat-completions schema on the edge and routes to OpenAI, Anthropic, Gemini, and Groq behind it. If your code already uses the OpenAI SDK, the integration is a one-line base_url change.

1. Base URL and authentication

Every request goes to the gateway endpoint with your workspace API key as a Bearer token. Keys are issued on the Command Center API Keys panel and look like gw-live-….

  • Base URL: https://sentinelgateway.ai/v1
  • Auth header: Authorization: Bearer YOUR_API_KEY
  • Endpoint: POST /v1/chat/completions (streaming and non-streaming)

2. First request with cURL

bash
curl https://sentinelgateway.ai/v1/chat/completions \
  -H "Authorization: Bearer $SENTINEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "Ping"}]
  }'

3. Drop-in SDK snippets

Python

python
from openai import OpenAI

client = OpenAI(
    base_url="https://sentinelgateway.ai/v1",
    api_key=os.environ["SENTINEL_API_KEY"],
)

resp = client.chat.completions.create(
    model="claude-3-5-haiku-20241022",  # any routable model
    messages=[{"role": "user", "content": "Ping"}],
)
print(resp.choices[0].message.content)

Node / TypeScript

typescript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://sentinelgateway.ai/v1",
  apiKey: process.env.SENTINEL_API_KEY,
});

const resp = await client.chat.completions.create({
  model: "llama-3.3-70b-versatile",
  messages: [{ role: "user", content: "Ping" }],
});

Model routing is prefix-based: gpt-*/o1-*/o3-* go to OpenAI, claude-* to Anthropic, llama-*/mixtral-*/gemma-* to Groq, and gemini-* to Gemini. The response always carries the model that actually served the request.

4. Gateway headers

HeaderDirectionBehavior
X-Fallback-Model Request Model to serve from when the primary provider fails transiently (429, 5xx, timeout). Deterministic 4xx errors are never masked.
X-Sentinel-Original-Model Response Present on fallback responses; the model you originally requested, when a different one served the call.
Cache-Control: no-cache Request Skips all cache reads and writes for the request.
X-Sentinel-Cache: false Request Gateway-specific equivalent of no-cache for non-HTTP-native clients.

5. Error codes

StatusTypeMeaning
400invalid_request_errorMalformed JSON body or an unconfigured provider key for the requested model.
401authentication_errorMissing or invalid API key.
403unverified_emailFree-tier key inactive until the account email is verified.
429quota_exceededMonthly token quota exhausted. The body includes an upgrade_url for one-click plan upgrades.
429rate_limit_exceededPer-key request velocity or daily token velocity exceeded; resets automatically.
503service_unavailableTransient gateway dependency unavailable (fail-closed quota gate). Safe to retry with backoff.

Retry guidance: retry 429 rate_limit_exceeded and 503 with exponential backoff. Do not retry 401/403, and treat 429 quota_exceeded as a billing signal, not a transient error.

6. Where to go next