Public reference · no account required

OmniStrat AI API

Multi-provider AI gateway with capability-aware routing, BYOK, answer caching (exact; semantic near-match per organisation, opt-in), code-mode execution, and SSE streaming. Single API for many providers (OpenAI, Anthropic, Google, xAI, Microsoft Azure, Amazon Bedrock, Cloudflare Workers AI and more).

https://api.petraproof.com OpenAPI 3.1.0 v0.1.0 51 operations

Authentication

Every endpoint under /api/ requires credentials. /health, /version, /models and this document are public.

SchemeTypeNotes
agentKey http The agent endpoints (/v1/messages, /v1/responses, /v1/chat/completions, /v1/identities) take the org API key, a member key or a scoped ost_ token as "Authorization Bearer" or as x-api-key. The org comes from the credential only; no org header or body field is read.
bodyCredentials apiKey header: authorization Credentials travel in the JSON body as {"org_id": "org_...", "api_key": "sk_live_..."} on every /api/ endpoint. OpenAPI has no vocabulary for body-carried credentials, so this scheme is declared against the Authorization header, which the OpenAI-compatible surface (/v1/chat/completions) does accept as "Bearer sk_live_...". Use whichever matches the endpoint you are calling; both resolve to the same org.
passportSession http A verified Passport session (the admin console), as "Authorization Bearer <JWT>", with NO api_key in the body. Accepted by /api/byok, /api/usage and /api/scoped-tokens (and /api/members, /api/org). The org and the role come from the session: the org the signed-in user created (role owner) or the one they are an active member of (that members row's role, never owner). org_id may be omitted; when sent it must be the session's org, else 403 SESSION_ORG_MISMATCH. 403 EMAIL_NOT_VERIFIED / NO_ORG for a session that acts for no org; 503 AUTH_UNAVAILABLE when that cannot be read. A body api_key, when present, authenticates as before.

Base URLs

URLUse
https://api.petraproof.comProduction
https://api.omnistrat.aiProduction (earlier host; permanent, same service)
https://omnistrat-ai.workers.devworkers.dev fallback

Endpoints

Operations

Agents

Long-running work: managed agents, workflows, memory and the MCP server.

POST /api/memory Agent typed memory with 5-channel RRF retrieval (Agents Week 2026)

Typed memory store with 5-channel RRF retrieval (BM25, key, substring, vector, HyDE).

Request bodyrequired

FieldTypeDescription
org_idrequired string
api_keyrequired string
actionrequired enum remember retrieve forget
type enum fact event instruction task
text string
key string Canonical fact-key for supersession.
importance number
query string Required for retrieve action.
topK integer
types array of string
id string Required for forget action.

Responses

StatusMeaningBody
200 ok
POST /api/elicit Approval gate for Code Mode / MCP write tools (Agents Week 2026, Agent Lee)

Two-phase approval: agent calls action=create to request approval, admin calls action=decide approved=true to grant a token, then the original tool call can proceed. Classifies as read / write / destructive automatically.

Request bodyrequired

FieldTypeDescription
org_idrequired string
api_keyrequired string
actionrequired enum create decide list
agent_id string
call object Required for action=create.
ttlSec integer
token string Required for action=decide.
approved boolean Required for action=decide.

Responses

StatusMeaningBody
200 ok
POST /api/mcp/v1 Native MCP JSON-RPC server

Native MCP JSON-RPC server (initialize, tools/list, tools/call)

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/agent Managed agent

Managed agent: configure | turn | get | reset (DO-backed memory)

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/workflows Dynamic workflows

Dynamic workflows: set | get | delete | start | get-run

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/code-review AI-powered code review

AI-powered code review (security / correctness / performance)

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error

Billing

Usage counters, credits and Stripe surfaces.

POST /api/usage Per-day usage counters

Per-day usage counters

Responses

StatusMeaningBody
200 ok
POST /api/whoami Authenticated org info

Authenticated org info

Responses

StatusMeaningBody
200 ok
POST /api/billing/checkout Create a Stripe checkout session for plan upgrade

Create a Stripe checkout session for plan upgrade

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/billing/webhook Stripe webhook receiver

Stripe webhook receiver (HMAC-signed)

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/billing/portal Stripe Customer Portal session

Stripe Customer Portal session

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/billing/credits Account credits

Account credits: get | add | refund (admin)

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error

Governance

Audit search, experiments, feature flags and routing policy.

POST /api/dsl Routing DSL get/set/delete

Routing DSL: get | set | delete

Responses

StatusMeaningBody
200 ok
POST /api/audit/search Search audit events

Searches the 30-day rolling KV-indexed audit log. Best for dev/debug; production analytics should query a SIEM via Logpush.

Request bodyrequired

FieldTypeDescription
org_idrequired string
api_keyrequired string
trace_id string
request_id string
event string
provider string
status_min integer
status_max integer
from_unix_sec integer
to_unix_sec integer
limit integer

Responses

StatusMeaningBody
200 matches
POST /api/experiments A/B experiment management

CRUD + report for A/B experiments. Variants override request fields (provider, model, profile, etc.) so the same prompt routes differently per variant. Optional Workers AI judge scores responses on a customer-supplied rubric. Report endpoint returns metrics with 95% confidence intervals.

Request bodyrequired

FieldTypeDescription
oprequired enum list get set delete conclude report
org_idrequired string
api_keyrequired string
id string Required for get/delete/conclude/report
experiment object Required for set op

Responses

StatusMeaningBody
200 ok
400 invalid experiment config
404 experiment not found
GET /api/flags Evaluate a feature flag (Flagship-compatible, Agents Week 2026)

OpenFeature compatible feature flags backed by KV.

Parameters

NameInTypeDescription
app query string App namespace. Defaults to 'default'.
keyrequired query string
type query enum boolean string number object
default query string Default value (coerced per `type`).
ctx query string JSON-encoded evaluation context.

Responses

StatusMeaningBody
200 ok
POST /api/flags Manage feature flags (upsert | delete | list)

OpenFeature compatible feature flags backed by KV.

Request bodyrequired

FieldTypeDescription
org_idrequired string
api_keyrequired string
actionrequired enum upsert delete list
app string
key string
flag object

Responses

StatusMeaningBody
200 ok
POST /api/templates Prompt templates

Prompt templates: get | set | list | delete

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error

Inference

Prompt in, completion out. Routing profile, capability filter and cost cap all apply.

POST /v1/messages Anthropic Messages API (Claude Code)

The Anthropic Messages wire format, on the metered /api/route pipeline. Billed from provider-reported usage (cache tokens at their own prices) at the platform price (vendor + 10%) on platform keys; BYOK is not marked up. Every answer carries x-omnistrat-receipt, or x-omnistrat-receipt-unavailable RECEIPT_UNAVAILABLE when its receipt could not be recorded (the answer is still served and billed). Contract and status (checked against Anthropic's documented examples; a live Claude Code session not yet verified) in docs/foundry-terminal/CONTRACT.md.

Responses

StatusMeaningBody
200 an Anthropic Message, or an SSE stream when stream is true
400 invalid_request_error (unknown or refused field, prompt too long)
401 authentication_error
402 out of credit or spend limit reached
404 model_not_found
429 rate_limit_error, with retry-after
529 overloaded_error, with retry-after (never switched to another vendor mid-conversation)
POST /v1/responses OpenAI Responses API (Codex), stateless

The OpenAI Responses wire format on the same metered pipeline. Stateless -- store true, previous_response_id, conversation and background are refused 400 by name; replay the conversation in input. Checked against OpenAI's documented examples; a live Codex session not yet verified.

Responses

StatusMeaningBody
200 a Response object, or an SSE stream when stream is true
400 invalid_request_error naming the refused field
401 invalid credential
402 out of credit or spend limit reached
404 model_not_found
POST /v1/chat/completions OpenAI Chat Completions, with tool calls

OpenAI Chat Completions on the structured agent path -- tools, tool calls and tool results are carried through, not flattened. Same metering, receipts and margin as /v1/messages.

Responses

StatusMeaningBody
200 a chat.completion, or an SSE stream when stream is true
400 invalid request
401 invalid credential
402 out of credit or spend limit reached
GET /v1/identities Petra and Rowdy availability for the caller

Free and content-free -- no inference, no hold, no charge. Per identity, available, unavailable (identity_disabled or not_deployed, with a reason) or unknown (the operator switch could not be read; never reported as available). The site's Petra and Rowdy chat boxes light up only on available.

Responses

StatusMeaningBody
200 {object: "list", billed: false, identities: [{identity, model, status, reason, detail, alternative, open_models_default}]}
401 no or invalid credential
POST /api/route Main inference endpoint

Main inference endpoint

Request bodyrequired RouteRequest

FieldTypeDescription
promptrequired string
org_idrequired string
api_keyrequired string
temperature number
system_prompt string
provider string Explicit intent or any:vision / any:cheap / etc.
model string A vendor model id (GET /v1/models) or an omni/* virtual model, including omni/petra and omni/rowdy. An unknown id is 404 model_not_found, never forwarded.
open_models enum off include only The open-weight toggle (also the x-omnistrat-open-models header; the two must agree). off excludes open-weight rows, only excludes every row not confirmed open-weight, include (default) filters nothing. Applies to a named model only. When the toggle alone leaves nothing eligible the answer is 409 NO_OPEN_MODEL_ELIGIBLE with every row's reasons; the request is never widened.
session_id string
capabilities array of Capability
routing_profile RoutingProfile
max_cost_usd number
fan_out integer
fallback array of string
tools array of ToolDef
tool_choice object auto | none | required | {type:function,function:{name}}
response_format object
redact_pii boolean
semantic_cache boolean The semantic (near-match) answer cache is OFF unless your organisation's owner or admin has enabled it (semantic_cache_enabled on PUT /api/routing/settings; default false). When it is enabled, false opts this request out. true cannot turn it on for an organisation that has not enabled it: the request is served without it and the response says so in x-omnistrat-adjusted (semantic_cache). A setting that cannot be read counts as off. The exact-answer cache is not affected. A semantic hit answers with cache "semantic" and its similarity.
no_store boolean When true, this call neither reads nor writes the answer cache (exact or semantic) and shares no in-flight result with another request, in either direction. (No inference call, no_store or not, is cached at Cloudflare AI Gateway.) An honoured call answers with no_store true. A non-boolean value is refused with 400 INVALID_NO_STORE.
study object A theology study request (docs/STUDY-LIBRARY.md). The sources are checked against the study catalog (GET /api/study/catalog) before any model is called. mark_quotes true asks the router to send the quotation-marking instruction; its tokens are not billed, and with a system prompt of your own it is refused with 400 STUDY_MARK_QUOTES_CONFLICT (your prompt is never edited). The omni CLI and the web terminal send it by default. The response's study.quotes says which quotations were checked or flagged.
stream boolean
moderate_output boolean
execute_code boolean Opt in to Code Mode. Only when true is a tool declaration injected into the prompt and a js/ts code block in the answer run, in an isolated Worker sandbox with no network. Default false - the answer is returned as the model wrote it and nothing is executed. If no isolate is available the answer is returned unchanged and routing.code_exec says why. Never triggers a second provider call. Required when mcp_servers is sent.
mcp_servers array of object

Responses

StatusMeaningBody
200 ok RouteResponse
400 invalid body
401 auth failed
402 cost cap exceeded
429 rate limited or budget exhausted
451 moderation flagged
502 model failed
POST /api/route/stream Streaming inference endpoint (SSE)

Returns text/event-stream with chunks data&#58; {"text":"...","done":false}\n\n. The final done event carries receipt (the decision receipt), or receipt null beside receipt_unavailable (see ReceiptUnavailable) when the receipt could not be minted.

Request bodyrequired RouteRequest

FieldTypeDescription
promptrequired string
org_idrequired string
api_keyrequired string
temperature number
system_prompt string
provider string Explicit intent or any:vision / any:cheap / etc.
model string A vendor model id (GET /v1/models) or an omni/* virtual model, including omni/petra and omni/rowdy. An unknown id is 404 model_not_found, never forwarded.
open_models enum off include only The open-weight toggle (also the x-omnistrat-open-models header; the two must agree). off excludes open-weight rows, only excludes every row not confirmed open-weight, include (default) filters nothing. Applies to a named model only. When the toggle alone leaves nothing eligible the answer is 409 NO_OPEN_MODEL_ELIGIBLE with every row's reasons; the request is never widened.
session_id string
capabilities array of Capability
routing_profile RoutingProfile
max_cost_usd number
fan_out integer
fallback array of string
tools array of ToolDef
tool_choice object auto | none | required | {type:function,function:{name}}
response_format object
redact_pii boolean
semantic_cache boolean The semantic (near-match) answer cache is OFF unless your organisation's owner or admin has enabled it (semantic_cache_enabled on PUT /api/routing/settings; default false). When it is enabled, false opts this request out. true cannot turn it on for an organisation that has not enabled it: the request is served without it and the response says so in x-omnistrat-adjusted (semantic_cache). A setting that cannot be read counts as off. The exact-answer cache is not affected. A semantic hit answers with cache "semantic" and its similarity.
no_store boolean When true, this call neither reads nor writes the answer cache (exact or semantic) and shares no in-flight result with another request, in either direction. (No inference call, no_store or not, is cached at Cloudflare AI Gateway.) An honoured call answers with no_store true. A non-boolean value is refused with 400 INVALID_NO_STORE.
study object A theology study request (docs/STUDY-LIBRARY.md). The sources are checked against the study catalog (GET /api/study/catalog) before any model is called. mark_quotes true asks the router to send the quotation-marking instruction; its tokens are not billed, and with a system prompt of your own it is refused with 400 STUDY_MARK_QUOTES_CONFLICT (your prompt is never edited). The omni CLI and the web terminal send it by default. The response's study.quotes says which quotations were checked or flagged.
stream boolean
moderate_output boolean
execute_code boolean Opt in to Code Mode. Only when true is a tool declaration injected into the prompt and a js/ts code block in the answer run, in an isolated Worker sandbox with no network. Default false - the answer is returned as the model wrote it and nothing is executed. If no isolate is available the answer is returned unchanged and routing.code_exec says why. Never triggers a second provider call. Required when mcp_servers is sent.
mcp_servers array of object

Responses

StatusMeaningBody
200 SSE stream string
POST /api/batch Batch inference (up to 50 prompts)

Batch inference (up to 50 prompts) - sync or webhook-async

Request bodyrequired

FieldTypeDescription
org_idrequired string
api_keyrequired string
shared RouteRequest
promptsrequired array of RouteRequest

Responses

StatusMeaningBody
200 ordered results array
POST /api/estimate Pre-flight cost estimate

Returns USD estimate per provider for the given prompt without making a provider call. Takes the credentials POST /api/route takes, through the same resolver - the body api_key, or "Authorization Bearer ost_..." (a scoped token whose scope reaches /api/estimate) with no api_key. org_id is required either way and must be the token's own org.

Request bodyrequired RouteRequest

FieldTypeDescription
promptrequired string
org_idrequired string
api_keyrequired string
temperature number
system_prompt string
provider string Explicit intent or any:vision / any:cheap / etc.
model string A vendor model id (GET /v1/models) or an omni/* virtual model, including omni/petra and omni/rowdy. An unknown id is 404 model_not_found, never forwarded.
open_models enum off include only The open-weight toggle (also the x-omnistrat-open-models header; the two must agree). off excludes open-weight rows, only excludes every row not confirmed open-weight, include (default) filters nothing. Applies to a named model only. When the toggle alone leaves nothing eligible the answer is 409 NO_OPEN_MODEL_ELIGIBLE with every row's reasons; the request is never widened.
session_id string
capabilities array of Capability
routing_profile RoutingProfile
max_cost_usd number
fan_out integer
fallback array of string
tools array of ToolDef
tool_choice object auto | none | required | {type:function,function:{name}}
response_format object
redact_pii boolean
semantic_cache boolean The semantic (near-match) answer cache is OFF unless your organisation's owner or admin has enabled it (semantic_cache_enabled on PUT /api/routing/settings; default false). When it is enabled, false opts this request out. true cannot turn it on for an organisation that has not enabled it: the request is served without it and the response says so in x-omnistrat-adjusted (semantic_cache). A setting that cannot be read counts as off. The exact-answer cache is not affected. A semantic hit answers with cache "semantic" and its similarity.
no_store boolean When true, this call neither reads nor writes the answer cache (exact or semantic) and shares no in-flight result with another request, in either direction. (No inference call, no_store or not, is cached at Cloudflare AI Gateway.) An honoured call answers with no_store true. A non-boolean value is refused with 400 INVALID_NO_STORE.
study object A theology study request (docs/STUDY-LIBRARY.md). The sources are checked against the study catalog (GET /api/study/catalog) before any model is called. mark_quotes true asks the router to send the quotation-marking instruction; its tokens are not billed, and with a system prompt of your own it is refused with 400 STUDY_MARK_QUOTES_CONFLICT (your prompt is never edited). The omni CLI and the web terminal send it by default. The response's study.quotes says which quotations were checked or flagged.
stream boolean
moderate_output boolean
execute_code boolean Opt in to Code Mode. Only when true is a tool declaration injected into the prompt and a js/ts code block in the answer run, in an isolated Worker sandbox with no network. Default false - the answer is returned as the model wrote it and nothing is executed. If no isolate is available the answer is returned unchanged and routing.code_exec says why. Never triggers a second provider call. Required when mcp_servers is sent.
mcp_servers array of object

Responses

StatusMeaningBody
200 estimate
POST /api/embed Standalone embeddings

Standalone embeddings (OpenAI / Workers AI)

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/tokenize Token count estimate

Token count estimate (no provider call)

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/moderate Standalone LlamaGuard moderation

Standalone LlamaGuard moderation

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error

Keys & access

Customer-provided provider keys and scoped sub-tokens.

POST /api/byok Customer-provided keys

Customer-provided keys: list | upsert | delete | add-to-rotation | check

Request bodyrequired

FieldTypeDescription
oprequired enum list upsert delete add-to-rotation check
org_id string Required with api_key; optional with a Passport session (must be the session's org).
api_key string The org key or a member key. Omit it to authenticate with a Passport session.
provider enum openai claude gemini xai groq muse mistral cohere perplexity nvidia-nim anyscale hyperbolic baseten lepton replicate together inkling Required for every op but list.
byok_key string Required for upsert and add-to-rotation
store_unchecked boolean upsert / add-to-rotation: store the key even when the provider could not be asked about it (it is then answered and listed as key_check "unchecked", never "works"). A key the provider refused is never stored.

Responses

StatusMeaningBody
200 ok. op=list answers {ok, complete: true, providers: [{provider, state: "configured", masked, key_check}]}, key_check being the last check with the provider: {state: "checked", verdict, checked_at, status?, detail, phase} or {state: "not_checked", reason: "never" | "unreadable"}. upsert / add-to-rotation check the key with the provider FIRST (one read-only list-models or account request) and answer key_check "works" | "unverified" (the provider has no verified check endpoint; no request was made) | "unchecked" (store_unchecked). op=check re-checks every stored key for the provider, changes no key, and answers {verdict: "works" | "refused" | "unreachable" | "unverified", checked_at, detail, keys: [{slot, verdict, status?, provider_reason?}]}.
403 upsert | delete | add-to-rotation need the admin role (INSUFFICIENT_ROLE; ROLE_UNVERIFIED for a credential with no verified role).
404 op=check with no key stored for the provider (BYOK_NOT_CONFIGURED).
422 PROVIDER_KEY_REFUSED: the provider refused the key (provider_status, provider_error_code, provider_reason in its words, the key withheld). Nothing was stored.
429 KEY_CHECK_RATE_LIMITED: the organisation reached the key-check limit (10 a minute, 100 a day). No request was made and nothing was stored. Retry-After.
503 op=list could not read every provider's record: error.code BYOK_LIST_INCOMPLETE, error.complete false, error.unreadable [provider], error.providers with state "read_failed" for those. Never reported as "not registered". Retry-After. PROVIDER_KEY_UNCHECKED: the provider could not be asked (timeout, network, 5xx, 429 or another status that does not answer), nothing stored; KEY_CHECK_UNAVAILABLE: the key-check limiter could not count; KEY_CHECK_READ_FAILED (op=check): the stored record could not be read.
POST /api/scoped-tokens Issue / revoke / verify scoped sub-tokens

Issue / list / revoke / revoke-all / verify scoped sub-tokens. op=issue takes scope (inference | agent | admin), ttl_sec (whole seconds; default 7 days, or the scope's maximum when shorter), caps and an optional label (1-64 printable ASCII characters, shown by op=list, never inside the signed token). A ttl_sec above the scope's maximum (24 h for admin, 30 days otherwise) is REFUSED with 400 TTL_TOO_LONG naming max_ttl_sec -- it is never shortened; below 60 s is TTL_TOO_SHORT, a non-integer INVALID_TTL, a bad label INVALID_LABEL. Success answers {ok, token, sub_id, scope, ttl_sec, expires_at, label?}.

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body, TTL_TOO_LONG, TTL_TOO_SHORT, INVALID_TTL or INVALID_LABEL Error
401 authentication failed Error
429 rate limited or budget exhausted Error

Media

Image generation, transcription and speech.

POST /api/image Text-to-image

Text-to-image (SDXL / DALL-E)

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/transcribe Speech-to-text

Speech-to-text (Whisper)

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/speak Text-to-speech

Text-to-speech (MeloTTS / OpenAI TTS)

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error

Notifications

Outbound email.

POST /api/email Send notification email via Cloudflare Email Service (Agents Week 2026)

Notifications via Cloudflare Email Service.

Request bodyrequired

FieldTypeDescription
org_idrequired string
api_keyrequired string
kind enum raw Optional; plain-text messages only. System notification kinds are sent by the platform itself and are not accepted here.
torequired string An active member of the org, or its contact address, that has a verified OmniStrat account.
subjectrequired string
textrequired string Plain text body. HTML is not accepted; mail is sent from the platform default sender.

Responses

StatusMeaningBody
200 ok
502 email transport unavailable

Platform

Everything else the worker exposes.

POST /api/orders/multi Multi-account execution

Multi-account execution: one order to every account the caller owns. Two-phase - preflight refuses the whole request before anything is placed

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/atm Arm automatic trade management on a position

Arm automatic trade management on a position: stop, target, breakeven and trailing. Requires an explicit acknowledgement that the server holds usable credentials

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
GET /api/level2 Depth-of-market book for the DOM ladder, from the venue that trades the symbol.

Depth-of-market book for the DOM ladder, from the venue that trades the symbol. Refuses rather than showing another venue's book

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/scheduling/pages Create a public booking page

Create a public booking page: availability windows, slot length, buffer, notice and horizon

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
GET /api/scheduling/bookings The host's bookings

The host's bookings

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
GET /api/book PUBLIC booking page. Free slots only - never a busy list, which would publish th

PUBLIC booking page. Free slots only - never a busy list, which would publish the host's working day

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error
POST /api/matchmaking/impact-ratio Impact-ratio calculator for a deployer of the talent-matching program

Arithmetic on aggregate counts the deployer supplies, by the selection-rate method of 6 RCNY 5-301 (selection rate per category; impact ratio = category rate / the most selected category's rate; sex, race/ethnicity and intersectional categories; a category under 2% is excluded only with a stated justification). For an owner or admin of an org that is a deployer of the program, for that org only. Nothing is stored and nothing acts on the result; it is not an independent audit. Input that looks like individual records is refused.

Request bodyrequired

FieldTypeDescription
total_assessedrequired integer
sex ImpactDimensionCounts
race_ethnicity ImpactDimensionCounts
intersectional ImpactDimensionCounts
exclude_small_categories object

Responses

StatusMeaningBody
200 rates and ratios per category, the excluded categories named, stored false
400 IMPACT_INPUT_INVALID, ROW_LEVEL_DATA_REFUSED, UNKNOWN_CATEGORY, INCONSISTENT_COUNTS or JUSTIFICATION_REQUIRED; nothing stored Error
401 no Passport session
403 NO_ORG, or ROLE_REQUIRED (not an owner or admin)
404 NOT_FOUND (the org is not a deployer, or the body names another org)
413 BODY_TOO_LARGE
503 DEPLOYER_UNREADABLE

Retrieval

Search and document-backed context.

POST /api/aisearch Hybrid BM25 + vector retrieval over RAG collections (Agents Week 2026)

Hybrid BM25 + vector retrieval with cross-instance support.

Request bodyrequired

FieldTypeDescription
org_idrequired string
api_keyrequired string
queryrequired string
collection string Single-instance mode.
collections array of string Cross-instance mode.
topK integer
metadataFilter object
boosts array
vectorizeWeight number
bm25Weight number

Responses

StatusMeaningBody
200 ok
POST /api/artifacts Git-shape versioned config storage (Agents Week 2026 - Artifacts)

Operations: init, commit, read, list, fork, log. Stores routing DSL, prompt templates, experiments, and agent skills with full Git semantics (time-travel reads, branch fork, content-addressed SHA-256 blobs).

Request bodyrequired

FieldTypeDescription
org_idrequired string
api_keyrequired string
actionrequired enum init commit read list fork log
repo string
branch string
source string Source ref for fork.
path string
data string
message string
ref string Branch name or commit sha.
limit integer

Responses

StatusMeaningBody
200 ok
POST /api/rag RAG document store

RAG document store: upsert | query | delete | list

Request bodyrequired AuthenticatedRequest

FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.

Responses

StatusMeaningBody
200 ok
400 invalid body Error
401 authentication failed Error
429 rate limited or budget exhausted Error

Service

Unauthenticated: health, version, catalogue and this document.

GET /health Liveness probe

Liveness probe (?deep=1 for dependency checks)

Parameters

NameInTypeDescription
deep query enum 1 When 1, runs dependency probes (KV, Supabase, key presence).

Responses

StatusMeaningBody
200 ok or degraded
503 down
GET /version Build version and timestamp

Build version and timestamp

Responses

StatusMeaningBody
200 ok
GET /v1/models Model catalogue (OpenAI shape; Anthropic shape with anthropic-version)

Every model id the router accepts, each row marked verified true/false (price checked against the vendor's page), open or closed weights, and the omni/* virtual models with their published billing rule.

Responses

StatusMeaningBody
200 list
GET /models Provider catalogue

Lists all 12 provider intents with vendor labels, cost rank, category pseudo-providers, supported endpoints, and feature flags.

Responses

StatusMeaningBody
200 catalogue
GET /openapi.json OpenAPI schema (this document, in JSON)

OpenAPI 3.1 schema summary

Responses

StatusMeaningBody
200 ok
GET /admin Self-contained admin web UI

HTML SPA served at /admin. Authenticates against /api/whoami using org_id + api_key entered at the login screen. Pure same-origin; no server-side session.

Responses

StatusMeaningBody
200 HTML string

Schemas

SCHEMAError
FieldTypeDescription
errorrequired object
SCHEMACapability

No declared properties.

SCHEMARoutingProfile

No declared properties.

SCHEMAToolDef
FieldTypeDescription
typerequired enum function
functionrequired object
SCHEMAJsonSchema
FieldTypeDescription
type enum object array string number integer boolean
properties object
required array of string
items JsonSchema
enum array
minLength integer
maxLength integer
minimum number
maximum number
SCHEMAImpactDimensionCounts Aggregate counts for one dimension. counts maps each category (EEO-1 Component 1; intersectional keys are "<sex>.<race_ethnicity>") to assessed and selected; every assessed individual is in one category or in unknown_assessed.
FieldTypeDescription
countsrequired object
unknown_assessedrequired integer
SCHEMARouteRequest
FieldTypeDescription
promptrequired string
org_idrequired string
api_keyrequired string
temperature number
system_prompt string
provider string Explicit intent or any:vision / any:cheap / etc.
model string A vendor model id (GET /v1/models) or an omni/* virtual model, including omni/petra and omni/rowdy. An unknown id is 404 model_not_found, never forwarded.
open_models enum off include only The open-weight toggle (also the x-omnistrat-open-models header; the two must agree). off excludes open-weight rows, only excludes every row not confirmed open-weight, include (default) filters nothing. Applies to a named model only. When the toggle alone leaves nothing eligible the answer is 409 NO_OPEN_MODEL_ELIGIBLE with every row's reasons; the request is never widened.
session_id string
capabilities array of Capability
routing_profile RoutingProfile
max_cost_usd number
fan_out integer
fallback array of string
tools array of ToolDef
tool_choice object auto | none | required | {type:function,function:{name}}
response_format object
redact_pii boolean
semantic_cache boolean The semantic (near-match) answer cache is OFF unless your organisation's owner or admin has enabled it (semantic_cache_enabled on PUT /api/routing/settings; default false). When it is enabled, false opts this request out. true cannot turn it on for an organisation that has not enabled it: the request is served without it and the response says so in x-omnistrat-adjusted (semantic_cache). A setting that cannot be read counts as off. The exact-answer cache is not affected. A semantic hit answers with cache "semantic" and its similarity.
no_store boolean When true, this call neither reads nor writes the answer cache (exact or semantic) and shares no in-flight result with another request, in either direction. (No inference call, no_store or not, is cached at Cloudflare AI Gateway.) An honoured call answers with no_store true. A non-boolean value is refused with 400 INVALID_NO_STORE.
study object A theology study request (docs/STUDY-LIBRARY.md). The sources are checked against the study catalog (GET /api/study/catalog) before any model is called. mark_quotes true asks the router to send the quotation-marking instruction; its tokens are not billed, and with a system prompt of your own it is refused with 400 STUDY_MARK_QUOTES_CONFLICT (your prompt is never edited). The omni CLI and the web terminal send it by default. The response's study.quotes says which quotations were checked or flagged.
stream boolean
moderate_output boolean
execute_code boolean Opt in to Code Mode. Only when true is a tool declaration injected into the prompt and a js/ts code block in the answer run, in an isolated Worker sandbox with no network. Default false - the answer is returned as the model wrote it and nothing is executed. If no isolate is available the answer is returned unchanged and routing.code_exec says why. Never triggers a second provider call. Required when mcp_servers is sent.
mcp_servers array of object
SCHEMATokenUsage
FieldTypeDescription
prompt_tokens integer
completion_tokens integer
total_tokens integer
SCHEMAToolCallOutput
FieldTypeDescription
id string
type enum function
function object
SCHEMARouteResponse
FieldTypeDescription
tier integer 1=cache, 2=system, 3=byok, 4=code-mode, 5=tier5-reasoning
provider string
model string
key_source enum byok system cache
cache enum hit miss stale semantic
result string
usage TokenUsage
tool_calls array of ToolCallOutput
schema_validated boolean
similarity number Cosine similarity (semantic cache only)
cost_usd number,null The call's price on the basis of the key that served it -- the platform price (vendor price plus the platform margin) on OmniStrat's key, the vendor price on your own key (BYOK). null when the price is unknown (an unpriced call); never 0 for unknown. This is a price, not the money taken from your balance -- that is charged_usd.
cost_estimated boolean Present and true when cost_usd (and charged_usd) is an estimate -- the provider did not report usage, or the usage could not be priced -- rather than a priced figure.
charged_usd number What this call debited from your prepaid credit. 0 when your own provider key (BYOK) served it (the vendor bills you directly) or a free model did, even though cost_usd states the price. Also present, inside the error envelope, on every refusal that comes after a provider call ran (402/403/503 post-call admission, 451 MODERATION_FLAGGED, Code Mode and MCP tool-loop failures, a failed agent turn), so a 4xx there is never read as free.
receipt object,null The decision receipt (receipt_id, entry_hash, verify_url, signed, ...). Verify it at GET /api/decision/verify/{receipt_id}; its id is also in the x-omnistrat-receipt header. null when this call has no receipt, and then receipt_unavailable says why -- never omitted.
receipt_unavailable ReceiptUnavailable
SCHEMAReceiptUnavailable Present, beside receipt null, when a call that was served has no receipt because its decision could not be recorded in the audit chain. Every routed exit mints one otherwise (cache answers and streams included). The answer is still served and billed. Headers say the same with x-omnistrat-receipt-unavailable RECEIPT_UNAVAILABLE in place of x-omnistrat-receipt.
FieldTypeDescription
coderequired enum RECEIPT_UNAVAILABLE
reasonrequired string Plain words, content-free.
SCHEMAAuthenticatedRequest Base body for every authenticated endpoint. Operation-specific fields are documented per endpoint and may be sent alongside these.
FieldTypeDescription
org_idrequired string Organisation id, e.g. org_9f2c.
api_keyrequired string Org API key or a scoped sub-token.