OmniStrat API

OmniStrat is an LLM gateway: one endpoint and one API key in front of the providers in the model list (GET /v1/models). Point the OpenAI SDK at https://api.omnistrat.ai/v1 and its chat completions, embeddings and model list calls work without code changes. Around each call it adds routing, BYOK, cost caps, per-org audit, tool translation, an opt-in semantic cache, and SSO/SCIM for enterprise.

New here? Start with the Quickstart for your first request.

Feature highlights

  • OpenAI-compatible. Chat completions, embeddings and the model list speak the OpenAI wire format, whichever provider serves the call. Other OpenAI endpoints (images, audio, files, assistants) are not offered here, and a parameter the router cannot reproduce for every provider is refused by name, never ignored.
  • Automatic fallback. If a provider errors or times out, the router tries the next one in the fallback order, within a per-provider repeat budget. On /api/route you can send your own order in fallback; otherwise the default applies.
  • Semantic cache (opt-in). Off by default. When an owner or admin turns it on for the org, an /api/route request close enough to an earlier one from the same org, with the same settings, can be answered with that earlier answer. A cache hit is not charged. A close match can still need a different answer, so a request can opt out with semantic_cache: false.
  • Cost caps. An org can carry a daily and a monthly USD cap. Once recorded spend reaches one, new requests are refused with 402. The cap is checked before each call, so the call that crosses it still completes and is billed. An org can also cap each call, and each key. Spend that cannot be read under a cap refuses the call, as does an unreachable daily gate (see Cost caps).
  • Tool calling everywhere. Send OpenAI-format tools once; we translate to Claude's input_schema, Gemini's functionDeclarations, and back.
  • Enterprise. Cloudflare Access SSO (SAML/OIDC via any IdP), SCIM 2.0 provisioning, BYOK, an audit log with opt-in replay, and a data region setting that filters provider selection (storage is not region-pinned).

Quickstart

Point your existing OpenAI client at https://api.omnistrat.ai/v1 and use your OmniStrat API key.

curl https://api.omnistrat.ai/v1/chat/completions \
  -H "Authorization: Bearer $OMNISTRAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [{"role": "user", "content": "Say hello."}]
  }'

Authentication

All API requests require a bearer token in the Authorization header. There are two key types:

PrefixTypeUse case
sk_live_…Org API keyOwner-level access. One per org. Rotate via /api/admin/rotate-key.
sk_mbr_…Member keyPer-user access with role (viewer / developer / admin / owner). Provisioned via SCIM or the admin UI.

Behind Cloudflare Access, no bearer token is required — the Cf-Access-Jwt-Assertion header authenticates via your IdP directly. See SSO.

Chat completions

POST/v1/chat/completions

OpenAI-compatible chat completion. All fields marked with an asterisk are supported by every provider; the rest are passed through where the provider supports them.

FieldTypeNotes
model*stringA model id from GET /v1/models, or a routing model: omni/auto, omni/cheapest, omni/fastest, omni/best, omni/code, omni/race, omni/petra, omni/rowdy. An unknown id is refused (404 model_not_found), never forwarded.
messages*arrayOpenAI chat messages. system, user, assistant, tool.
temperaturenumber0.0–2.0. Provider default when omitted.
max_tokensnumberUpper bound. Provider caps still apply.
streamboolSSE stream. See Streaming.
toolsarraySee Tool calling.
tool_choicestring / objectauto, none, required, or {"type":"function","function":{"name":"…"}}.
response_formatobjecttext, json_object, json_schema. Enforced by router when the provider lacks native support.

Model catalog

GET/v1/models (also /models)

Every model id the router accepts, with its provider, context window, capabilities, open or closed weights, and whether its price was checked against the vendor's page (verified). Per-model prices are at GET /api/public/pricing. Model calls on OmniStrat's platform keys are billed at the listed vendor price plus 10%. Calls on your own provider key (BYOK) are not marked up.

The omni/* routing models choose a model per request, filtered by tools, images, context size and your max_cost_usd. omni/petra routes to the highest-quality capable model among rows whose prices are verified; omni/rowdy to the cheapest. Each answer's receipt says which row served and why. The x-omnistrat-open-models header (off, include, only) keeps open-weight models out or in; when nothing qualifies the answer is 409 NO_OPEN_MODEL_ELIGIBLE with the reasons, never a wider set.

Coding agents

POST/v1/messages speaks the Anthropic Messages API (Claude Code's protocol). POST/v1/responses speaks the OpenAI Responses API (Codex's protocol), statelessly: replay the conversation in input; store: true and previous_response_id are refused. Both are checked against the vendors' documented examples; neither has yet been verified with a live Claude Code or Codex session.

Send your key as Authorization: Bearer or x-api-key. Every call is metered against your credits and spend mandate and returns a verifiable receipt in x-omnistrat-receipt; a call whose receipt could not be recorded says so in x-omnistrat-receipt-unavailable. GET/v1/identities reports whether Petra and Rowdy are available to you, free.

Streaming

Set stream: true. The response is text/event-stream in OpenAI SSE format — one data: line per delta, terminating with data: [DONE]. Tool call deltas follow the OpenAI streaming schema (indexed function argument concatenation).

data: {"choices":[{"delta":{"content":"Hel"}}]}
data: {"choices":[{"delta":{"content":"lo."}}]}
data: [DONE]

Tool calling

Send tools in OpenAI format. The router translates for Claude (input_schema), Gemini (functionDeclarations), Bedrock-Anthropic, and passes through for OpenAI/xAI/Azure. Responses come back in OpenAI shape (tool_calls) regardless of provider.

{
  "model": "auto",
  "messages": [{"role": "user", "content": "What's the weather in Tokyo?"}],
  "tools": [{
    "type": "function",
    "function": {
      "name": "get_weather",
      "description": "Look up current weather.",
      "parameters": {
        "type": "object",
        "properties": {"city": {"type": "string"}},
        "required": ["city"]
      }
    }
  }],
  "tool_choice": "auto"
}

Multi-turn tool loops: send the assistant's tool_calls back with a role: "tool" message containing the tool's content. The router translates that too (Claude sees a tool_result block; Gemini sees functionResponse).

Embeddings

POST/v1/embeddings

OpenAI-compatible. Supports text-embedding-3-small, text-embedding-3-large, Google's text-embedding-004, Voyage, and Workers AI.

Batch API

POST/v1/batches

Submit a JSONL file of requests. Runs asynchronously with a 50% discount. Poll GET /v1/batches/:id for status.

Study requests

POST/api/route with "study": {"sources": [...], "mark_quotes": true}. Sources are checked against GET /api/study/catalog before any model is called. mark_quotes asks the router to have the model mark every quotation as [quote source="<id>" ref="<reference>" book="<book>"]…[/quote]; those tokens are not billed. With your own system prompt as well it is refused with STUDY_MARK_QUOTES_CONFLICT (400): your prompt is never edited. The response’s study.quotes says which quotations were checked or flagged; without source text a marked quotation is unscored, never pass.

Rate limits

Default: 60 requests/sec, 1M tokens/min per org. Enterprise plans lift both. When exceeded, we return 429 with a Retry-After header. Per-IP secondary limits apply to public endpoints only.

Error codes

StatusCodeMeaning
400invalid_requestMalformed body or unknown field.
401invalid_api_keyMissing/invalid bearer.
402cost_cap_exceededDaily or monthly USD cap hit.
403origin_not_allowedCORS allowlist rejected the origin.
404model_not_foundModel ID unknown or org lacks access.
429rate_limitedRetry with backoff.
500internal_errorRouter error; safe to retry.
502upstream_errorProvider failure. The router tried the next provider in the fallback order first, where the repeat budget allowed.

Webhooks

POST/api/webhooks   GET/api/webhooks   DELETE/api/webhooks/:id   POST/api/webhooks/:id/rotate-secret   GET/api/webhooks/:id/deliveries

Subscribe an HTTPS endpoint to your organisation's events: signup, cost_cap_warning, cost_cap_breach, key_rotated, member_invited, member_accepted, member_removed, member_role_changed, webhook.created, webhook.deleted, webhook.secret_rotated. Body: {"url": "https://...", "event_filter": "*"} (or a comma-separated list of those events). Admin or owner only. The signing secret is returned once, on creation or rotation.

Each delivery is a POST signed with x-omnistrat-signature: sha256=HMAC_SHA256(secret, timestamp + "." + body) and x-omnistrat-timestamp; reject timestamps older than 5 minutes. A 5xx or network error is retried at 5 s and 25 s; redirects are not followed. Batch results (/api/batch with webhook_url) use the same signature.

Audit log

Every request produces an audit row: org, request ID, model, provider, latency, tokens, cost. Retrievable via /api/audit/search and exportable to S3. The audit index keeps attributes only, never the prompt or answer text. To re-run a past call on another model, an owner or admin of the organisation first switches on replay retention (PUT /api/audit/replay/settings; off by default; 7, 30 or 90 days): from then on each one-shot /api/route call's prompt and answer are kept, encrypted under the organisation's own key, and deleted when the period ends or when retention is switched off. A retained call can then be priced on another model (POST /api/audit/replay/estimate) and replayed (POST /api/audit/replay with an Idempotency-Key): the replay is an ordinary billed call with its own receipt, and the answer comes back next to the original's.

Servers API

Servers are chartered build crews on OmniStrat with text channels and server-vs-server wars. A crew runs on a charter earned in a Charter Drop (never sold) and has at most 12 builders (Solo or above, accepted by the founder); anyone eligible may follow a public crew. Every /api/servers/* and /api/wars/* route acts with a Passport session (never an organisation key), and every one-server route reads your membership live first: a private server, an unknown id, a removed server and a server you are not in all answer the same 404 SERVER_NOT_FOUND. A read that fails is 503 SERVERS_UNAVAILABLE and nothing is done. Errors use the envelope {"error": {"code", "message"}}. Servers are for people 18 or older (GET /api/servers/eligibility); no ID document, date of birth or government number is ever asked for or stored.

GET/api/servers/discover?q=&tag=   GET/api/servers/mine   POST/api/servers   GET/api/servers/:idOrSlug   POST/api/servers/join (the founder's invite code)   POST/api/servers/:id/leave

Crews: POST|DELETE /api/servers/:id/follow, GET /api/servers/:id/showcase, GET /api/servers/:id/announcements/:cid/messages (followers read announcements only), POST /api/servers/:id/crew-applications (the founder accepts or declines at .../crew-applications/:aid/accept|decline), GET /api/servers/charter-drops, POST /api/servers/charter-drops/:slug/apply, GET /api/servers/charters/mine. A crew that enters no war in a season lapses at its close.

Moderation: /api/servers/:id/members, .../members/:uid/role|kick|ban|mute|caps, .../invites (a code is shown once and stored only hashed), .../channels, .../reports, .../rules, .../safety (safety level and lockdown). Every change is an event on the server's hash-chained log: GET /api/servers/:id/events and GET /api/servers/:id/events/verify recompute it.

Chat: POST /api/servers/:id/ws-ticket mints a single-use 60-second ticket for the WebSocket GET /api/servers/:id/ws?ticket=, which carries post, edit, delete, react and typing frames. History is GET /api/servers/:id/channels/:cid/messages?before=&limit= (at most 100). Messages are text only and sealed at rest; links stay text. A removed member's open connection is closed, and connections are re-checked against membership every minute.

Allowances: members may give a monthly allowance from an organisation they own or administer (GET|POST /api/servers/:id/allowances, DELETE .../allowances/:aid). Nothing is pooled or transferred: an AI call in a server (POST /api/servers/:id/ai) is charged to one giver's own organisation, on its statement as a server_allowance line naming the server and the member. The server's total reads "at least $X" when an allowance could not be read.

Wars: GET /api/wars, GET /api/wars/:id, POST /api/servers/:id/challenges, POST /api/wars/:id/accept|decline, POST /api/wars/:id/roster, POST /api/wars/:id/entries, GET /api/wars/:id/results, GET /api/wars/:id/recompute (recomputes the result from the war ledger, receipts and seed), GET /api/leaderboard?format=&division=. Entry is always free. A friendly eval race's calls are paid from each server's own allowances; ratings apply after a 72-hour appeal window.

Your data: GET /api/servers/me/export returns your memberships, your messages (per server), your allowances and what you filed.

Cost caps

Each org carries a daily and a monthly USD cap, daily_usd_cap and monthly_usd_cap. A new org gets both from its plan. An owner or admin changes them with POST /api/org (op set-caps; a cap is a positive number of US dollars, or null for none), and a change applies within a minute.

Spend is the cost of each request, priced once when the request is recorded and kept per org in a Durable Object counter. Nothing reconciles it on a schedule. Before each /api/route call the router sums that spend for the UTC day and, when a monthly cap is set, for the month to date. Once either reaches its cap, the call is refused with 402 COST_CAP_EXCEEDED. The check runs before the call, so the call that crosses a cap still completes and is billed. If a cap is set and spend cannot be read, the call is not sent: it is refused with 503 COST_CAP_UNVERIFIABLE and logged as cost_cap_unverified. With no cap set, nothing is read.

A second gate holds each call's estimated cost against daily_usd_cap while it runs, and answers 429 BUDGET_EXHAUSTED when the day's spend on that gate, plus the calls in flight, plus this estimate would pass the cap. If that gate cannot be reached and a daily cap is set, the call is refused with 503 BUDGET_GATE_UNAVAILABLE.

A cap on one key. An owner or admin sets daily_usd_cap and monthly_usd_cap on one scoped token (ost_) with POST /api/scoped-tokens (op set-caps). Each call on that key holds its estimated cost against the key's caps while it runs, in the same kind of gate as the org's daily cap, so a burst of parallel calls cannot pass a key's cap by more than one call's estimate. Over it, the call is refused with 402 KEY_COST_CAP_EXCEEDED. A key's spend counts from its first call after the cap is set.

A cap per call. per_call_usd_cap (POST /api/org, op set-caps) is the most one call may cost, and the x-omni-max-cost-usd header can lower it for one call, never raise it. A header that is not a positive number of US dollars is refused with 400 BAD_MAX_COST. On /api/route and the agent endpoints, before any provider is called, the call's estimate (its input, and its max_tokens or, when it sets none, the 4096 output tokens the credit hold assumes, at the price of the key that serves it) is compared with the cap, and a call over it is refused with 402 CALL_COST_CAP_EXCEEDED, naming the estimate. On /v1/messages, /v1/responses and /v1/chat/completions, max_tokens is lowered to fit the cap when at least 256 output tokens fit, and the response says so in x-omnistrat-adjusted.

A member's cap. An owner or admin sets monthly_usd_cap on one member of their org with POST /api/members (op set-cap). A call with that member's key over it is refused with 402 MEMBER_BUDGET_EXCEEDED.

If the cap settings themselves cannot be read, the call is refused with 503 COST_CAP_UNVERIFIABLE: an unknown cap is not "no cap".

SSO — Cloudflare Access

OmniStrat SSO uses Cloudflare Access. This means any IdP that speaks SAML 2.0 or OIDC (Okta, Microsoft Entra ID, Google Workspace, JumpCloud, OneLogin, PingFederate) plugs in through Access's team dashboard — no per-app SAML config.

Setup

  1. In the Cloudflare dashboard, create a Zero Trust team and add your IdP (SAML or OIDC).
  2. Create an Access application for api.omnistrat.ai. Note the Audience (AUD) tag.
  3. Provide us the team domain and AUD tag; we set CF_ACCESS_TEAM_DOMAIN and CF_ACCESS_AUD.
  4. Optionally map IdP groups to OmniStrat roles via CF_ACCESS_ROLE_MAP.

Each request now carries a Cf-Access-Jwt-Assertion header. We verify it end-to-end (JWKS, iss, aud, exp) and derive the role fresh from group memberships — deprovisioning takes effect on the next request.

SCIM 2.0 provisioning

OmniStrat implements SCIM 2.0 (RFC 7643/7644) at /scim/v2/. Enrollable in Okta, Microsoft Entra ID, Workday, Rippling, and JumpCloud.

Endpoints

MethodPathPurpose
GET/scim/v2/ServiceProviderConfigDiscovery (public)
GET/scim/v2/ResourceTypesDiscovery (public)
GET/scim/v2/UsersList with filter
POST/scim/v2/UsersCreate member
GET / PUT / PATCH / DELETE/scim/v2/Users/{id}Read / replace / modify / delete
GET/scim/v2/GroupsRoles as groups

Authentication

Per-org bearer token. Rotate via POST /api/admin/orgs/:id/scim-token. We store the SHA-256 hash, never the plaintext.

Filter support

We accept the subset every major IdP uses: userName eq "…", userName sw "…", emails[type eq "work"].value eq "…", active eq true. Complex expressions return 400 invalidFilter.

Deactivation

Okta and Entra send PATCH /Users/{id} with {op: "replace", path: "active", value: false} when a user is deprovisioned. We map that to DELETE — the member row is removed and their key stops working immediately.

BYOK (Bring Your Own Keys)

Attach your own OpenAI / Anthropic / Google / xAI keys (and those of the other single-key providers in the model list) via POST /api/byok. Azure OpenAI and Amazon Bedrock take multi-part credentials and are not available as BYOK. Requests routed to those providers use your keys and your billing directly — the router still handles routing, caching, cost caps, and audit. Keys are encrypted with envelope encryption; you retain full rotation control.

Impact-ratio calculator

POST/api/matchmaking/impact-ratio with a Passport session, for an owner or admin of an organisation that uses the talent-matching program. Send totals per category (EEO-1 Component 1; how many were assessed and how many selected); the answer gives each category’s selection rate and impact ratio by the selection-rate method of 6 RCNY 5-301. A category under 2% is left out of the ratios only with a stated justification. Nothing is stored; it is not an independent audit.

Refusals: IMPACT_INPUT_INVALID, ROW_LEVEL_DATA_REFUSED, UNKNOWN_CATEGORY, INCONSISTENT_COUNTS, JUSTIFICATION_REQUIRED (400); NO_ORG, ROLE_REQUIRED (403); NOT_FOUND (404, another organisation or one that does not use the program); DEPLOYER_UNREADABLE (503).

Data residency

Choose your org's data_region at signup: us, eu, ap. Traffic is pinned to Cloudflare colos in that region and audit rows are stored in region-appropriate storage. EU orgs stay in Frankfurt / Amsterdam / Paris.

Node / TypeScript SDK

npm install @omnistrat/sdk
import { OmniStrat } from '@omnistrat/sdk';
const om = new OmniStrat({ apiKey: process.env.OMNISTRAT_API_KEY });
const res = await om.chat.complete({ model: 'auto', messages: [{ role: 'user', content: 'Hi.' }] });

The OpenAI SDK also works — just set baseURL: 'https://api.omnistrat.ai/v1'.

Python SDK

pip install omnistrat
from omnistrat import OmniStrat
om = OmniStrat(api_key=os.environ["OMNISTRAT_API_KEY"])
res = om.chat.complete(model="auto", messages=[{"role": "user", "content": "Hi."}])

Go SDK

go get github.com/omnistrat/omnistrat-go
client := omnistrat.New(os.Getenv("OMNISTRAT_API_KEY"))
res, _ := client.Chat.Complete(ctx, &omnistrat.ChatRequest{Model: "auto", Messages: []omnistrat.Message{{Role: "user", Content: "Hi."}}})

Java / .NET / Ruby / Rust

All four SDKs live in the same monorepo (sdk/java, sdk/dotnet, sdk/ruby, sdk/rust) and expose the same surface: chat, embeddings, tool calling, streaming, retries with jittered backoff, org-scoped auth. See each language's README.md for install instructions.

Something missing? Email support or try it in the playground.