Authentication

Ostra API keys — format, where to send them, Full access vs Read only, expiry, monthly spend caps, IP allowlists and workspace key policies.

Every Ostra request is authenticated with an API key from the TestRelic Console. There is no OAuth: MCP clients send the same key as a header.

Sending the key

RouteAuthorization: Bearer <key>x-api-key: <key>
GET /models, POST /predict, POST /batch, POST /mcpYesNo
POST /chat/completions, POST /messages, POST /warmYesYes

The x-api-key header exists so Anthropic-style clients work unchanged. When both headers are present, Authorization wins.

curl https://ostra.testrelic.ai/api/v1/models -H "Authorization: Bearer $OSTRA_API_KEY"

Key format

Keys look like ostk_live_ followed by 40 letters and digits (50 characters). TestRelic stores only a hash: the full key is shown once, when you create it. The Console shows a hint such as ostk_live_…a91F afterwards.

A key works for every model and task, over REST and MCP. Keys are not scoped to a model or task; use separate keys for separate systems instead.

Access levels

AccessCan call
Full accessEverything.
Read onlyGET /models, POST /warm, and on MCP initialize, tools/list and ostra_list_models. Calls that run a model fail with 403 permission_error ("This API key is read-only and cannot run predictions."; over MCP, an isError result: "This API key is read-only and cannot run models.").

Use a read-only key for health checks and dashboards that only need to see that the API is reachable.

Key options

Set these when you create a key in API keys → Create key (name, spend cap, RPM override and allowlist can be edited later; access and expiry can't):

OptionValuesEffect
Name1–64 charactersShown in the Console, logs and usage breakdowns.
AccessFull access, Read onlySee above.
Expires30 days, 90 days (default), 1 year, NeverAfter expiry, requests fail with 401 "This API key has expired."
Monthly spend capAny amount above $0, up to $1,000,000; empty for noneOnce the key's spend this calendar month (UTC) reaches the cap, its requests fail with 402 spend_limit_reached and scope: "key".
IP allowlistUp to 50 IPv4/IPv6 addresses or CIDR rangesRequests from other addresses fail with 403 permission_error. Empty allows any address.
RPM override1–100,000 (edit only)Lowers the requests-per-minute limit this key sees. It can only lower it: the lower of this and the workspace limit applies, counted against the whole workspace's traffic.

Workspace key policy

Owners and admins can require, in Settings → Security and SSO → API key policy, that new keys:

  • expire within 30, 90 or 365 days, and/or
  • carry an IP allowlist when they have full access.

A key that breaks the policy can't be created. The policy applies to keys created afterwards; existing keys keep working.

Rotating and revoking

Keys can't be edited into new secrets. To rotate:

  1. Create a new key with the same settings.
  2. Deploy it everywhere the old one is used.
  3. Revoke the old key in API keys → ⋯ → Revoke. Requests with it fail immediately, over REST and MCP, with 401 "This API key has been revoked."

Revoked keys stay listed for the record. Removing a member from a workspace does not revoke the keys they created.

Authentication errors

StatusTypeMessage
401authentication_errorMissing API key. Send Authorization: Bearer ostk_live_….
401authentication_errorInvalid API key.
401authentication_errorThis API key has been revoked.
401authentication_errorThis API key has expired.
403permission_errorRequests from this IP address are not allowed for this API key.
403permission_errorThis API key is read-only and cannot run predictions.

401 responses carry WWW-Authenticate: Bearer realm="ostra". These errors are never retried successfully: fix the key, then retry.

Was this page helpful?

On this page