Ostra API reference

REST and MCP reference for Ostra Decision and Ostra Pro — base URLs, authentication, every endpoint and tool, errors, limits and billing, with copyable samples in every major language and prompts for AI coding agents.

The Ostra API gives your code and your AI agents direct access to TestRelic's testing models:

  • Ostra Decision (ostra-lite, beta) answers three CI questions in milliseconds: why did this test fail? (failure triage), which tests does this change affect? (test impact) and will this selector survive the release? (selector survival).
  • Ostra Pro (ostra-pro, 1.0) is a testing model for writing and fixing tests, analysing failures and logs, and reading screenshots and video. It speaks the OpenAI Chat Completions and Anthropic Messages formats, so existing SDKs and tools work by changing the base URL.

Both models are served from one host, over REST and over MCP.

REST APIhttps://ostra.testrelic.ai/api/v1
MCP serverhttps://ostra.testrelic.ai/mcp
Anthropic SDK base URLhttps://ostra.testrelic.ai/api

Start in two minutes

Get a key. Sign in to the TestRelic Console with your TestRelic account, add at least $5 of credit, and create a key under API keys. Keys start with ostk_live_ and are shown once.

Export it so every sample on this site works as-is:

export OSTRA_API_KEY="ostk_live_..."

Make a call. Check the key with the free models list, then triage a failure:

curl https://ostra.testrelic.ai/api/v1/predict \
  -H "Authorization: Bearer $OSTRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ostra-lite",
    "task": "triage",
    "input": {
      "test_id": "checkout.spec.ts > applies coupon",
      "context": {
        "framework": "playwright",
        "error_message": "TimeoutError: locator.click: Timeout 30000ms exceeded.",
        "memory": { "runs_50": 40, "failed_count_50": 6, "flake_rate_50": 0.15 }
      }
    }
  }'

The Quickstart goes further: Ostra Pro, MCP, and the same calls in Python and TypeScript.

Endpoints and tools

Conventions

FormatJSON request and response bodies, UTF-8. Ostra Pro can also stream server-sent events.
AuthAuthorization: Bearer <key> on every route; Ostra Pro routes also accept x-api-key. See Authentication.
Request idsEvery response carries x-request-id (req_ + 26 characters). Errors repeat it as error.request_id. Quote it to support.
ErrorsOne envelope everywhere: {"error": {"type", "message", "request_id", ...}} (Anthropic's shape on /messages). See Errors.
MoneyPrices are per 1M units. Costs come back as exact decimal strings in USD ("0.0000005") and as integer nano-dollars (500 = $0.0000005).
LimitsRequests per minute, shared by every key and channel in a workspace. See Rate limits.
BillingPrepaid credit. Cached answers and failed requests are free. See Billing.
VersioningThe path carries the API version (/api/v1); responses name the model version that answered. See Versioning.

Built for AI agents

Every endpoint page has an AI agent prompt next to its code samples: paste it into Claude Code, Cursor, Copilot or Codex and the agent gets the exact contract (fields, limits, errors, retry rules) instead of guessing. You can also point any assistant at the machine-readable versions:

Want your agent to call Ostra itself?

Connect the Ostra MCP server and your agent can triage failures, pick impacted tests, check selectors and ask Ostra Pro directly, with no glue code.

Product guides

The API reference covers the contract. For how the models behave, what to send them and how to run the Console, see Ostra and the TestRelic Console.

Was this page helpful?

On this page