Replays
Record routing decisions and simulate alternative strategies.
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /v1/replays/decisions | API Key | List recorded routing decisions |
| POST | /v1/replays/simulate | API Key | Simulate alternative routing |
| GET | /v1/replays/compare | API Key | Compare strategies side-by-side |
List decisions
curl "https://api.brainstormrouter.com/v1/replays/decisions?limit=100&since=2026-03-01T00:00:00Z" \
-H "Authorization: Bearer br_live_..."
Query parameters
| Param | Type | Default | Description |
|---|---|---|---|
limit | number | 100 (max 1000) | Max decisions to return |
since | string | last 24h | ISO 8601 timestamp filter |
Response
{
"decisions": [
{
"requestId": "req_001",
"timestamp": "2026-03-10T12:00:00Z",
"model": "claude-sonnet-4-20250514",
"provider": "anthropic",
"endpointId": "ep_1",
"strategy": "quality",
"inputTokens": 100,
"outputTokens": 200,
"latencyMs": 450,
"costUsd": 0.003
}
],
"count": 1
}
Simulate
"What would this week have cost with a different strategy?"
curl -X POST https://api.brainstormrouter.com/v1/replays/simulate \
-H "Authorization: Bearer br_live_..." \
-H "Content-Type: application/json" \
-d '{"strategy": "price", "since": "2026-03-01T00:00:00Z"}'
Request body
| Field | Type | Required | Description |
|---|---|---|---|
strategy | string | Yes | price, latency, throughput, quality, cascade, priority |
since | string | No | ISO 8601 period start (default: 7 days ago) |
until | string | No | ISO 8601 period end (default: now) |
Response
{
"period": {
"since": "2026-03-01T00:00:00Z",
"until": "2026-03-08T00:00:00Z"
},
"actual": {
"total_requests": 1500,
"total_cost_usd": 15.0,
"avg_latency_ms": 400
},
"simulated": {
"strategy": "price",
"total_requests": 1500,
"total_cost_usd": 9.0,
"avg_latency_ms": 520,
"cost_savings_vs_actual": 6.0,
"cost_savings_pct": 40.0
}
}
Compare
Compare all strategies used during a period:
curl "https://api.brainstormrouter.com/v1/replays/compare?since=2026-03-01T00:00:00Z" \
-H "Authorization: Bearer br_live_..."
Response
{
"since": "2026-03-01T00:00:00Z",
"strategies": [
{
"strategy": "quality",
"request_count": 300,
"total_cost_usd": 8.0,
"avg_cost_per_request": 0.027,
"avg_latency_ms": 400,
"p95_latency_ms": 800,
"total_output_tokens": 60000
},
{
"strategy": "price",
"request_count": 200,
"total_cost_usd": 3.0,
"avg_cost_per_request": 0.015,
"avg_latency_ms": 500,
"p95_latency_ms": 900,
"total_output_tokens": 40000
}
]
}