API quickstart
From zero to your first Ostra Decision and Ostra Pro calls in five minutes — key, credit, cURL, Python, TypeScript and MCP.
1. Get a key and some credit
Sign in to the TestRelic Console with your TestRelic account (the same login as the TestRelic platform). A new account gets its own workspace.
Add your billing details and at least $5 of credit. The Console is pay as you go and prepaid: every request made with an API key needs credit on the balance, and the Console has no subscription. See Billing and credits.
Open API keys → Create key. Leave access on Full access, copy the key (ostk_live_…) and store it in your secrets manager. It is shown only once.
export OSTRA_API_KEY="ostk_live_..."Keep keys out of code
Never commit a key or put it in client-side code. Use environment variables or your CI's secret store, and create one key per system so you can revoke one without breaking the rest.
2. Check the key
GET /models is free and works with any key:
curl https://ostra.testrelic.ai/api/v1/models -H "Authorization: Bearer $OSTRA_API_KEY"A 200 with two models means you're set. A 401 means the key is wrong or revoked; see Authentication.
3. Triage a failing test (Ostra Decision)
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",
"action": "click",
"error_message": "TimeoutError: locator.click: Timeout 30000ms exceeded.",
"memory": { "runs_50": 40, "failed_count_50": 6, "flake_rate_50": 0.15 }
}
}
}'output.decision is one of flaky, likely_flaky, product_bug, test_bug, environment, selector_drift or defer, with its probability in p. What to do with each answer: Failure triage.
4. Ask Ostra Pro
Ostra Pro is OpenAI-compatible: point any OpenAI client at https://ostra.testrelic.ai/api/v1.
curl https://ostra.testrelic.ai/api/v1/chat/completions \
-H "Authorization: Bearer $OSTRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "ostra-pro",
"reasoning_effort": "low",
"messages": [
{ "role": "user", "content": "Write a Playwright test that logs in and checks the dashboard title." }
]
}'The first call after a quiet period can wait
Ostra Pro scales to zero after 5 idle minutes. The next request starts it, which usually takes under a minute. Streaming requests simply wait; non-streaming ones may get 503 with Retry-After. Call POST /warm first if you're about to send a burst. Details: Cold starts.
5. Give your coding agent the tools
Connect the Ostra MCP server and your agent can call every model directly. For Claude Code:
claude mcp add --transport http ostra https://ostra.testrelic.ai/mcp --header "Authorization: Bearer $OSTRA_API_KEY"Cursor, VS Code and other clients: MCP overview.
Next
- Read the endpoint reference for every field, header and error.
- Learn what each Ostra Decision answer means and how to act on it: Ostra Decision.
- Put it in CI: Triage failures in CI.
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.
Authentication
Ostra API keys — format, where to send them, Full access vs Read only, expiry, monthly spend caps, IP allowlists and workspace key policies.