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
| Route | Authorization: Bearer <key> | x-api-key: <key> |
|---|---|---|
GET /models, POST /predict, POST /batch, POST /mcp | Yes | No |
POST /chat/completions, POST /messages, POST /warm | Yes | Yes |
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
| Access | Can call |
|---|---|
| Full access | Everything. |
| Read only | GET /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):
| Option | Values | Effect |
|---|---|---|
| Name | 1–64 characters | Shown in the Console, logs and usage breakdowns. |
| Access | Full access, Read only | See above. |
| Expires | 30 days, 90 days (default), 1 year, Never | After expiry, requests fail with 401 "This API key has expired." |
| Monthly spend cap | Any amount above $0, up to $1,000,000; empty for none | Once the key's spend this calendar month (UTC) reaches the cap, its requests fail with 402 spend_limit_reached and scope: "key". |
| IP allowlist | Up to 50 IPv4/IPv6 addresses or CIDR ranges | Requests from other addresses fail with 403 permission_error. Empty allows any address. |
| RPM override | 1–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:
- Create a new key with the same settings.
- Deploy it everywhere the old one is used.
- 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
| Status | Type | Message |
|---|---|---|
| 401 | authentication_error | Missing API key. Send Authorization: Bearer ostk_live_…. |
| 401 | authentication_error | Invalid API key. |
| 401 | authentication_error | This API key has been revoked. |
| 401 | authentication_error | This API key has expired. |
| 403 | permission_error | Requests from this IP address are not allowed for this API key. |
| 403 | permission_error | This 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.