Auth header: Authorization: Bearer sg_live_... (provider keys stay encrypted in your Vault, BYOK)
Client: any OpenAI SDK, or our open-source SDKs (Apache-2.0): sentiogate-python on PyPI (pip install sentiogate-python), @sentiogate/sdk on npm (npm i @sentiogate/sdk), and our official Model Context Protocol (MCP) server @sentiogate/mcp (npx -y @sentiogate/mcp or Streamable HTTP POST /v1/mcp).
model: "auto" picks a qualifying model; any provider/model id pins one.
Optional controls: route_preference (cost, quality, or latency), max_cost_usd, max_latency_ms, and X-Session-ID for session affinity.
Send model: "auto" and SentioGate automatically selects an enabled model from your Vault based on your routing preferences and live availability, with automatic failover on upstream errors or rate limits.
Send a provider/model id to pin one model. OpenRouter model ids keep their own slash, for example openrouter/anthropic/claude-sonnet-4. GET /v1/models lists the ids you can route to.
Authentication and your provider keys (BYOK)
Every request carries a SentioGate gateway key (sg_live_...) as Authorization: Bearer sg_live_.... Create one in the dashboard.
The Anthropic-compatible /v1/messages endpoint also accepts the key as x-api-key, which is what Anthropic SDKs and Claude Code send.
Your provider keys (for example OpenAI, Anthropic, Gemini, Groq, Mistral, DeepSeek, xAI or OpenRouter) go in the Vault, encrypted at rest. Providers bill your own accounts directly, with 0% token markup.
You can store up to 5 keys per provider, in priority order, with optional per-key spend and balance limits that pause a key.
model: "auto" only routes to models you enabled in the Vault.
Endpoints
POST /v1/chat/completions
OpenAI-compatible Chat Completions. With stream: true the Server-Sent Events stream is passed through and router metadata arrives in the X-SentioGate-Router response header.
GET /v1/models
Lists the model ids you can route to.
POST /v1/messages
Anthropic Messages API, for Claude Code and Anthropic SDKs. Claude models need your own Anthropic or OpenRouter key.
POST /v1/messages/count_tokens
Counts input tokens for a Messages request.
POST /v1/mcp
Streamable HTTP Model Context Protocol (MCP 2025-03-26 & 2024-11-05) control plane for FinOps waste auditing, model recommendations, tool guardrails, payload optimization and sub-task routing.
GET /v1/live
WebSocket endpoint for real-time multimodal voice and video sessions (Google Gemini Live BYOK).
Model Context Protocol (MCP) Control Plane (@sentiogate/mcp)
Connect Claude Code, Claude Desktop, Cursor, Cline, Grok or the Senti Bot & Hermes Coding Dashboard directly to SentioGate via our published MCP server (@sentiogate/mcp on npm, SentioGate/sentiogate-mcp on GitHub, and io.github.SentioGate/sentiogate-mcp on the Official MCP Registry) or via Streamable HTTP at https://api.sentiogate.dev/v1/mcp.
sentiogate_audit_waste
Audits JSONL, CSV or JSON request logs against your enabled Vault models to quantify recoverable spend.
sentiogate_get_finops_ledger
Returns live provider spend, key health, and free community pool quota.
sentiogate_recommend_model
Recommends candidate models by cost, quality or latency for a task.
sentiogate_guard_check
Pre-flights tool calls and shell commands for destructive actions.
sentiogate_optimize_payload
Measures potential token savings on a request payload.
sentiogate_delegate_prompt
Delegates sub-tasks through model: "auto".
Free community pool (no provider keys yet)
With a gateway key and no provider keys in your Vault, model: "auto" is answered by the free community pool: 600 requests per 5 hours per user during the beta, with no credit card. It is meant for testing your integration. Other model ids need your own provider key. Once you add keys, the same model: "auto" call routes across them with no code change.
Errors and retries
Errors use the OpenAI error shape: {"error": {"message", "type", "code"}}. Check error.code:
401 invalid_api_key
Missing or invalid gateway key.
403 no_enabled_models
auto found no enabled models in your Vault. Enable at least one model.
403 community_model_only
No provider keys yet, and the request asked for a specific model. Send auto, or add your own key.
403 community_pool_disabled_with_byok
The request asked for the community pool while provider keys are saved. Send auto or a provider/model id.
422 max_cost_exceeded
Strict per-request budget exceeded when strict_cost is enabled with max_cost_usd. Do not retry without raising the budget.
429 upstream_rate_limited
Your providers rate-limited every model SentioGate tried. Wait for Retry-After, or add another key or provider.
429 community_pool_exhausted
You used your community pool requests for this window. Retry-After is the time until it frees up.
503 community_busy
The shared community pool is briefly busy. Retry after the short Retry-After.
Wait at least Retry-After before retrying, and retry in one layer only: if you use the OpenAI SDK's built-in retries, leave SentioGate SDK retries off, or the other way round.
Which model answered: router metadata
Non-streaming responses include a router object showing which provider and model answered. On streaming responses, the same summary is returned in the X-SentioGate-Router header.
Endpoint reference
Inference
POST/chat/completionsCreate a chat completion (OpenAI-compatible)
With `stream: true` the upstream Server-Sent Events stream is passed through unchanged and router metadata is returned in the `X-SentioGate-Router` response header (JSON). Non-streaming responses carry the same metadata in the `router` field.
Parameters
X-Session-IDheader
string
Conversation or agent-session id (max 256 chars) for session affinity.
X-SentioGate-Prompt-Cacheheader
"off"
Set to `off` to disable automatic prompt-cache optimization.
X-SentioGate-Cacheheader
"off" | "bypass" | "force"
Set to `off` to skip response caching for this request.
X-SentioGate-Tool-Guardheader
"flag" | "block" | "off"
Tool-call safety guard (`flag`, `block`, or `off`).
X-SentioGate-PII-Redactheader
"on" | "off"
Opt-in PII and secret redaction for outbound prompts (`on` or `off`).
X-SentioGate-Allow-Queueheader
"true" | "false" | "on" | "off" | "1" | "0"
Allow queuing on the community batch queue when busy (`true` or `false`).
Request body ChatCompletionRequest
model
string
`auto`, `auto-code` (dedicated coding agent profile), `sentiogate/auto-code`, `provider/model` (e.g. `openai/gpt-4o-mini`) or a bare model id.
models
string[]
Optional whitelist of candidate models for `auto` or `auto-code` routing.
messagesrequired
Message[]fields
rolerequired
"system" | "user" | "assistant" | "tool"
contentrequired
string | object[]
name
string
stream
boolean
temperature
number
Sent upstream only when set; unset uses the provider default.
Prioritize lowest estimated dollar cost over quality/value weighting.
max_cost_usd
number
Optional per-request expected cost ceiling (USD). Picks highest intelligence within budget, or relaxes gracefully unless strict_cost is true (which returns 422 max_cost_exceeded when no initial or fallback model fits the remaining budget).
POST/messagesCreate a message (Anthropic Messages API)
Anthropic-compatible endpoint for Claude Code and Anthropic SDKs: set `ANTHROPIC_BASE_URL=https://api.sentiogate.dev` and `ANTHROPIC_API_KEY` to your `sg_live_...` key (sent as `x-api-key` or `Authorization: Bearer`).
Supports `claude-*`, `auto`, `auto-code`, and `provider/model` ids. Router summary metadata is returned in the `X-SentioGate-Router` header.
Parameters
anthropic-versionheader
string
Anthropic API version (default `2023-06-01`).
anthropic-betaheader
string
Anthropic beta flags.
X-SentioGate-Tool-Guardheader
"flag" | "block" | "off"
Tool-call safety guard (`flag`, `block`, or `off`).
X-SentioGate-PII-Redactheader
"on" | "off"
Opt-in PII and secret redaction for outbound prompts (`on` or `off`).
Request body MessagesRequest
modelrequired
string
`claude-*` (native with your Anthropic key; via OpenRouter as `anthropic/<id>` otherwise), `auto`, `auto-code`, `sentiogate-community`, or `provider/model`.
max_tokensrequired
integer
messagesrequired
object[]fields
rolerequired
"user" | "assistant"
contentrequired
string | object[]
system
string | object[]
stream
boolean
temperature
number
top_p
number
top_k
integer
stop_sequences
string[]
tools
object[]
Custom tools are supported on every route; Anthropic server tools only on the native route.
tool_choice
object
thinking
object
metadata
object
Responses
200
Message. `text/event-stream` when `stream: true`.MessagesResponse
For `claude-*` models with your own Anthropic key in the Vault, Anthropic counts the tokens. Otherwise SentioGate returns an estimate. The `X-SentioGate-Token-Count` response header says which (`anthropic` or `estimate`).
Parameters
anthropic-versionheader
string
Anthropic API version (default `2023-06-01`).
anthropic-betaheader
string
Anthropic beta flags.
Request body MessagesRequest
modelrequired
string
`claude-*` (native with your Anthropic key; via OpenRouter as `anthropic/<id>` otherwise), `auto`, `auto-code`, `sentiogate-community`, or `provider/model`.
max_tokensrequired
integer
messagesrequired
object[]fields
rolerequired
"user" | "assistant"
contentrequired
string | object[]
system
string | object[]
stream
boolean
temperature
number
top_p
number
top_k
integer
stop_sequences
string[]
tools
object[]
Custom tools are supported on every route; Anthropic server tools only on the native route.