Skip to main content

Endpoint reference

The complete map of the gateway's HTTP surface: /v1/, /scim/v2/, /admin/*, /connect.

Three auth lanes

/v1/* is gated by an enrolled client key (minted by anyray-connect) or a non-human service key; attribution rides the x-anyray-metadata header. /admin/* is gated by the admin token (ANYRAY_ADMIN_TOKEN, the break-glass owner) or a role-scoped console SSO session — and authenticated ≠ privileged: each route additionally requires the capability in its row, per the RBAC lattice (viewer → auditor → operator → security_admin → owner). /scim/v2/* uses its own static bearer configured through PUT /admin/scim/settings; it is not an admin-console session. Inference requests and the VS Code pre-call hook carry content on the request path under ANYRAY_CONTENT_MODE; SCIM identities, admin spend records, and request logs remain metadata-only and never expose prompt/response bodies to humans.

Inference API — /v1/*

OpenAI-compatible, plus the Anthropic-native Messages API. Point any OpenAI/Anthropic SDK's base URL at the gateway. Fully described in the OpenAPI spec and the API reference.

MethodPathWhat it does
post/v1/chat/completionsChat completions (streaming + non-streaming).
post/v1/seat/cursor/chat/completionsCursor OpenAI-BYOK lane — identical to /v1/chat/completions, but classified as an Anyray subscription seat because Cursor cannot send a seat header. This is API-key-upstream traffic, not the native Cursor Team entitlement. Configured by anyray-connect; not called by hand.
post/v1/extensions/vscode/optimizeOptimize a VS Code extension request before the extension calls its provider. Fails open and does not record client-supplied usage; the optimizer's own savings are metered as a zero-token spend row.
post/v1/completionsLegacy text completions.
post/v1/embeddingsEmbeddings.
post/v1/messagesAnthropic-native Messages API.
post/v1/messages/count_tokensToken counting (no inference; not metered).
post/v1/responsesResponses API — create (GET/DELETE /v1/responses/{id}, GET /v1/responses/{id}/input_items).
post/v1/audio/speechText-to-speech.
post/v1/audio/transcriptions · post /v1/audio/translationsAudio transcription / translation.
post/v1/images/generations · post /v1/images/editsImage generation / edits.
post/v1/filesUpload a file (GET list; GET/DELETE /v1/files/{id}, GET /v1/files/{id}/content).
post/v1/batchesCreate a batch (GET list; GET /v1/batches/{id}, POST /v1/batches/{id}/cancel).
get/v1/modelsList available models.
get/v1/realtimeRealtime (WebSocket) passthrough.

Inbound SCIM v2 — /scim/v2/*

Okta, Microsoft Entra ID, and other SCIM clients push verified users and groups to these gateway routes. Every request sends the SCIM bearer as Authorization: Bearer <token>. SCIM responses use application/scim+json; errors use the SCIM 2.0 error envelope.

Discovery

MethodPathWhat it does
get/scim/v2/ServiceProviderConfigAdvertise PATCH, filtering, paging, and bearer authentication.
get/scim/v2/ResourceTypesList the User and Group resource types.
get/scim/v2/SchemasReturn the supported core User and Group schemas.

Users

MethodPathWhat it does
post/scim/v2/UsersCreate a user from the verified IdP payload.
get/scim/v2/UsersList users. Supports filter=userName eq "dev@example.com", startIndex, and count.
get/scim/v2/Users/:idRead one user.
put/scim/v2/Users/:idReplace a user.
patch/scim/v2/Users/:idPatch activation, display name, or identity type. active:false blocks the user's client keys.
delete/scim/v2/Users/:idSoft-delete and deactivate a user so existing client keys stay blocked.

Groups

MethodPathWhat it does
post/scim/v2/GroupsCreate a group and resolve or create its members.
get/scim/v2/GroupsList groups with startIndex and count paging.
get/scim/v2/Groups/:idRead one group and its members.
put/scim/v2/Groups/:idReplace a group and recompute member team/role mappings.
patch/scim/v2/Groups/:idAdd, remove, or replace members; update the display name.
delete/scim/v2/Groups/:idDelete a group and recompute affected identities.

Billing app machine API

Served by the Billing app (app.anyray.ai), not the gateway — the gateway calls it with its adt_ deployment token. Distinct from the inference /v1/* above, and metadata only: usage rollups, lease state, release metadata, or an explicitly customer-submitted redacted support bundle; never prompt/response content.

MethodPathWhat it does
post/v1/meterIngest a usage rollup (+ deployment heartbeat); returns a freshly signed entitlement lease.
get/v1/entitlementLease heartbeat — refresh the signed lease without ingesting usage.
get/v1/tenant-contextFleet mode only: resolve an ark_ key hash to its tenant context.
get/v1/releases/latestReturn the current release-line version and its bounded requirements manifest; manifest may be null.
post/v1/support-bundlesAccept a reviewed, redacted support bundle (deployment bearer, 1,000,000-byte cap, one per deployment per minute), analyze it, and return { receiptId }.
post/v1/connect-eventsGateway-down fallback for connect-health: anyray-connect posts its content-free doctor results here when its gateway is unreachable. Authenticated by a DevCert + Ed25519 proof of possession (not a deployment bearer); the deployment identity comes from the signed cert. Best-effort, throttled, never on the billing path.
post/v1/cert/renewRoll a live DevCert forward, so a machine in use never has to re-enroll — only a genuinely idle one reaches expiry. Authenticated by a signed challenge proving possession of the enrolled key (the same DevCert + Ed25519 proof of possession as above, not a deployment bearer); identity and deployment come from the signed cert. Refused for a revoked developer or a revoked deployment — renewal is never a way around revocation. An SSO-issued certificate is also refused when the tenant's SSO policy is absent or unreadable, rather than falling back to a longer default key lifetime.
post/v1/cli-sso/startStart the Billing app's deployment-authenticated identity half of a CLI login. Receives the gateway session id + user code; returns the browser activation URL.
post/v1/cli-sso/pollReturn pending or the WorkOS-verified identity, governed team list/default, resolved role, and configured key lifetime. Never returns the gateway key.
put/v1/enrollment-identitiesRecord a deployment-verified roster identity with allowlisted source and type. Used by gateway SCIM reflection.

CLI self-service login

Pre-key gateway routes used only by anyray-connect login. Start is rate-limited by source IP. Poll is authorized by the separate high-entropy secret returned once by start; the secret travels in a header, not the URL, and is stored by the gateway only as a salted hash.

MethodPathWhat it does
post/sso/cli/startCreate a durable ten-minute login session, start the Billing app SSO grant, and return { id, browser_url, user_code, poll_secret, interval, expires_in }.
get/sso/cli/poll/:idWith x-anyray-poll-secret, return pending, the eligible team list, or the one-time minted key. Send the selected eligible team in x-anyray-team.

The Billing app also serves the browser-only /sso/cli/activate/:id, /sso/cli/authorize, and /sso/cli/callback pages. They confirm the terminal code, complete WorkOS SSO, and JIT-provision the identity; they are HTML/redirect surfaces, not integration APIs.

Health & settings

MethodPathCapabilityWhat it does
get/admin/healthconfig:readLiveness, spend-store ping, schema version (applied vs expected), optimizer reachability.
get/admin/meThe caller's identity plus deploymentOwner, which is false for tenant SSO principals in fleet mode (authenticated, no capability required).
get/admin/settingsconfig:readRead runtime settings (content mode, seat overflow, flags).
put/admin/settingscontent:manageUpdate runtime settings (contentMode, heartbeatTier, seatOverflow, seatOverflowHourlyMaxRequests).
get/admin/metering/last-reportconfig:readExact final payload from this process's last successful, verified usage report, plus the active heartbeat tier and metering state.
get/admin/update-statusconfig:readSelf-updater status: available vs running version, the local preflight verdict (missing environment-variable names + breaking notes), the computed updateClass (soft = image-only, self-applies on Compose installs · hard = operator action required, never applied unattended), the autoSoftUpdates policy, and the last unattended apply attempt.
put/admin/update/settingsupdate:runUpdate policy: {"autoSoftUpdates": true|false} — whether soft (image-only) updates apply unattended (Compose installs; other platforms are always notify-only). Default on.
get/admin/authAuth-mode probe (pre-session; reports whether SSO is required).
get/admin/auth/updateupdate:runTrigger a self-update check/apply.

Spend & governance

The spend surface and per-user token caps. In the OpenAPI spec and the explorer.

MethodPathCapabilityWhat it does
get/admin/spendconfig:readIn-memory spend summary: requests + tokens per attributed user.
get/admin/spend/dashboardconfig:readWindowed dashboard — money by billing class, trend, top strategies, latency, prompt-cache economics. ?window=.
get/admin/spend/usageconfig:readPer-user usage detail — per-model & per-day breakdown, org per-model rollup, cap gauges. ?window=, ?limit=.
get/admin/spend/quality-parityconfig:readHoldout-vs-treated outcome parity (turns, output tokens, error rate, latency) with CIs. ?window=.
get/admin/spend-connectorsconfig:read + deployment ownerRead redacted Cursor, Devin, and GitHub Copilot connector state and poll status. Credentials are never returned.
put/admin/spend-connectorsproviderkeys:manage + deployment ownerPartially set, rotate, or remove write-only connector credentials. Omitted connectors stay unchanged; null or {} removes one.
post/admin/spend-connectors/syncproviderkeys:manage + deployment ownerSync vendor usage. Returns safe per-connector counts or skipped/failed.
get/admin/spend-connectors/usageconfig:read + deployment ownerAggregate content-free vendor-native usage. ?days= accepts 1–90 and defaults to 30.
get/admin/auth-eventsconfig:readReason-coded auth/cap rejections (per-developer diagnostics) with remediation hints. ?user=, ?limit=.
get/admin/user-capsconfig:readPer-user monthly token caps + current-month usage + cap-alert posture (webhook URL never returned).
put/admin/user-capsusercaps:writeSet caps and cap-approach alert settings (thresholds + Slack-compatible webhook).

Spend connector rules

Connector credentials (cursor.adminApiKey, devin.serviceUserToken, and githubCopilot.token) are write-only. Responses show configuration and poll status, safe counts, and GitHub's non-secret scope and slug. They never return credentials, vendor payloads, signed URLs, or vendor errors.

POST /admin/spend-connectors/sync returns {connectors: [...]}. Each connector reports fetched, inserted, and duplicate counts, {skipped: true} when another replica is syncing, or {failed: true} without the vendor error. Usage keeps each vendor's units separate. Copilot's public list value is an estimate, not an invoice total.

These routes manage the whole deployment. In fleet mode, tenant SSO users cannot use them even with the listed capability. Use the deployment owner credential or an unbound local owner session.

The deprecated /admin/spend/connectors GET/PUT path uses the same encrypted store for older Cursor/Copilot clients. New clients should use /admin/spend-connectors.

Optimizer, pricing & routing

MethodPathCapabilityWhat it does
get/admin/optimizer/settingsconfig:readRead the optimizer pipeline config.
put/admin/optimizer/settingsoptimizer:writeUpdate the optimizer pipeline config.
post/admin/optimizer/purgeoptimizer:purgePurge optimizer caches / session state.
get/admin/pricingconfig:readThe read-only official price table.
get/admin/model-aliasesconfig:readRead model-alias mappings.
put/admin/model-aliasesmodelaliases:writeUpdate model-alias mappings.
get/admin/routing-configconfig:readRead routing (single / loadbalance / fallback / conditional).
put/admin/routing-configrouting:writeUpdate routing config.
post/admin/test-requestplayground:runConsole playground: send a test request through the gateway.

Providers

MethodPathCapabilityWhat it does
get/admin/provider-keysproviderkeys:manageList configured providers (slugs only — key values never returned).
put/admin/provider-keysproviderkeys:manageSet server-held provider API keys.

Access, SSO & enrollment

MethodPathCapabilityWhat it does
get/admin/idp-configconfig:readRead the SSO / IdP configuration.
put/admin/idp-configidp:manageConfigure SSO / IdP.
delete/admin/idp-configidp:manageRemove the SSO / IdP configuration.
get/admin/scim/settingsconfig:read + deployment ownerRead redacted SCIM state, admin group, and group-to-team mappings. The bearer and hash are never returned.
put/admin/scim/settingsidp:manage + deployment ownerSet or rotate the SCIM bearer and update group mappings. Omitting bearerToken preserves it.
post/admin/workos-portal-linkidp:manageMint a WorkOS admin-portal link.
get/admin/sso/startBegin the console SSO login handshake (pre-session).
get/admin/sso/callbackSSO redirect callback (pre-session).
post/admin/sso/logoutEnd the console SSO session.
get/admin/client-keysconfig:readList minted client keys (enrolled users).
post/admin/client-keysclientkeys:manageMint a client key.
delete/admin/client-keys/:idclientkeys:manageRevoke a client key.
get/admin/service-keysconfig:readList non-human service keys. Metadata only; tokens and hashes are never returned.
post/admin/service-keysclientkeys:manageMint an ark_svc_… key for an AI agent, CI job, or SDK script.
delete/admin/service-keys/:idclientkeys:manageRevoke a service key.
get/admin/enrollment-linksconfig:readList enrollment / setup links.
post/admin/enrollment-linksenrollment:manageCreate an enrollment link.
delete/admin/enrollment-links/:idenrollment:manageDisable an enrollment link.
delete/admin/enrollment-links/:id/hardenrollment:manageHard-delete an enrollment link.
get/admin/provisioning-tokensconfig:readList deployment provisioning tokens.
post/admin/provisioning-tokensprovisioning:manageMint a provisioning token.
delete/admin/provisioning-tokens/:idprovisioning:manageRevoke a provisioning token.
post/admin/provisioning-tokens/:id/rotateprovisioning:manageRotate a provisioning token.

Privacy, support & observability

MethodPathCapabilityWhat it does
get/admin/gdpr/users/:user/exportgdpr:manageExport a user's spend records.
delete/admin/gdpr/users/:usergdpr:manageErase a user's spend records (and cap-alert dedup rows).
get/admin/support/bundleconfig:readGenerate a support bundle for remote debugging.
post/admin/support/bundle/sharecontent:manageExplicitly rebuild, redact, and send a support bundle to the Billing app; return its receipt and audit metadata.
get/admin/observability/traces/:idobservability:readFetch one trace (content redacted unless observability:read-content).
get/admin/observability/*observability:readProxy to the observability read API for the console.
get/admin/team-skillsconfig:readRead team-skill / onboarding metadata.
put/admin/team-skillsteamskills:writeUpdate team-skill / onboarding metadata.
get/admin/wizard-statusconfig:readOnboarding wizard progress.
put/admin/wizard-confirmwizard:writeConfirm an onboarding wizard step.

Service key request and response

post /admin/service-keys accepts a non-empty name and team, plus an optional non-negative monthlyBudgetUsd. name becomes the key label and attributed service identity.

Request
{
"name": "synthetic-release-agent",
"team": "platform",
"monthlyBudgetUsd": 50
}

The 201 response returns the raw ark_svc_… value exactly once. The record is metadata only and is also returned by get /admin/service-keys inside { "keys": [...] }.

Response
{
"key": "ark_svc_synthetic-once-only",
"record": {
"id": "synthetic-key-id",
"user": "synthetic-release-agent",
"team": "platform",
"label": "synthetic-release-agent",
"tenant": "default",
"createdAt": "2030-06-01T00:00:00.000Z",
"keyType": "service",
"monthlyBudgetUsd": 50,
"source": "service",
"type": "service"
}
}

The cap covers the key's successful request cost in the current UTC calendar month. Once completed spend is at or above the cap, inference returns HTTP 402 with error.code: "service_key_budget_exceeded". Enforcement is a soft cap: completed requests update the counter after the response, so concurrent in-flight requests can overshoot. Counter read/write failures pass traffic through so a budget-store outage does not stop agents or CI. Omitting the budget, or setting it to 0, leaves the key unlimited.

delete /admin/service-keys/:id returns { "ok": true }. The raw key cannot be recovered after minting; revoke it and mint a replacement.

anyray-connect contract — /connect/*

Called by the anyray-connect CLI and its hooks, not by end apps. Metadata only (savings beacons, policy, CCR retrieve/recall). No admin capability — authenticated as the connected client.

MethodPathWhat it does
post/connect/verifyVerify a client key / enrollment.
get/connect/policyFetch the client's effective policy. Optional ?model=<id> also returns modelContext.contextTokens — that model's real context window — so a client can budget against the true window instead of its own default. Omitted when the model is unknown.
get/connect/savingsReport realized savings for the client.
post/connect/hook-savingsRecord hook-trim savings (PostToolUse).
post/connect/optimize-outputOptimize a tool output at the source.
post/connect/recall · post /connect/retrieveCCR recall / retrieve of externalized context. A human/CLI caller sends x-anyray-retrieve-probe: 1 (the anyray-connect retrieve / recall verbs do) so the call does not latch retrieve capability — only the MCP server’s calls prove the model can pull spans back.
post/connect/mcp-heartbeatMCP-server session-start heartbeat; records explicit retrieval availability without overriding persistent-client safety.
post/connect/healthRecord the content-free results of anyray-connect doctor checks (gateway reachability, retrieval loop, per-tool MCP registration, enrollment, connect run) plus the reporting client's own version. Best-effort — always 200; the gateway forwards a rolling 24h rollup to the Billing app on the next meter round. Metadata only, never content.
Not a public API

/public/* (console login: /public/auth, /public/auth/session, /public/logs) and /log/stream back the console UI's in-browser session. They aren't part of the integration surface — use /admin/* with the admin token for automation.