Routing and trust
Discover routes by capability, then place explicit bounds on the provider selected for a paid request. Omit every routing header to retain the default marketplace selection.
Catalog filters
GET /v1/models is public and cursor-paginated. Filters compose with AND semantics; repeated values are not accepted.
| Query parameter | Meaning |
|---|---|
| live | Only routes live now when true; otherwise inspect registered capabilities. |
| endpoint_family | Hosted endpoint family, such as CHAT, VIDEOS or WORKFLOWS. |
| modality | Text, embedding, image, video, audio, music or workflow capability. |
| attestation_tier | Exact integer 1–4; mutually exclusive with min_attestation_tier. |
| min_attestation_tier | Integer 1–4 minimum; mutually exclusive with attestation_tier. |
| max_input_price_per_million_usd | Maximum retail input price in USD per one million tokens. |
| max_output_price_per_million_usd | Maximum retail output price in USD per one million tokens. |
| max_representative_request_price_usd | Maximum unit-aware retail cost for the model's representative request. |
| min_context_tokens | Minimum context capacity in tokens. |
| quantization | Canonical quantization bucket such as bf16, nvfp4 or int4. |
| tools | Require or exclude native tool calling. |
| structured_output | Require or exclude structured JSON output. |
| provider | Restrict results to one 64-hex provider public key. |
| prompt_confidential | Require or exclude prompt-confidential compute. |
| sort | Sort by id, providers, input_price, output_price, request_price, context or listed. |
| order | Ascending or descending order. |
| limit | Page size from 1 to 100; default 50. |
| cursor | Opaque continuation cursor from the previous response. |
Exact tier, minimum tier, and confidentiality
attestation_tier is exact. min_attestation_tier accepts that tier or a higher one. T1 is a verified software report; T2 adds hardware device identity; T3 is confidential hardware; T4 is an admin-KYB identity tier. Tier order alone does not imply prompt confidentiality, so use prompt_confidential when that property is required.
With live=true, capability, tier, provider and confidentiality filters inspect only routes that can dispatch now. Without it, a result may be registered but temporarily offline.
Per-request routing headers
Tier, quantization, provider, throughput, wait and retail-cost controls apply to every paid endpoint. Context and hedging apply only to text generation. Throughput uses each endpoint's native measured unit. Every supplied value is validated before provider spend.
| Header | Effect |
|---|---|
| X-Mayhem-Min-Att-Tier | Minimum provider tier as 1–4 or T1–T4; higher tiers also qualify. |
| X-Mayhem-Min-Ctx | Text generation only. Minimum context capacity in tokens; the calculated request need remains the floor. |
| X-Mayhem-Quant | Require one canonical quantization bucket. |
| X-Mayhem-Prefer-Providers | Strict ordered provider set; comma-separated 64-hex public keys. |
| X-Mayhem-Hedge | Text generation only. Use 1 to request hedging, 0 to disable; incompatible with a strict provider list. |
| X-Mayhem-Min-Tok-S | Positive minimum sustained throughput in the endpoint's native measured unit per second. |
| X-Mayhem-Max-Wait-Ms | Wait 0–60,000 ms for provider admission; not a generation timeout. |
| X-OpenMayhem-Max-Cost-Usd | Maximum retail USD hold for this request, checked before spend. |
Provider preference and failover
X-Mayhem-Prefer-Providers is strict, not a hint. Providers are tried in the supplied order, and the request fails with preferred_provider_unavailable when none qualifies. OpenMayhem never silently falls back outside the list.
Tier, context, quantization, throughput and price constraints apply to every retry, failover and hedge candidate. Hedging does not weaken those constraints and cannot be combined with a strict preferred-provider list.
Asynchronous jobs
Routing headers are captured as immutable asynchronous-job evidence at creation. Idempotent replays must match those stored requirements, and they remain attached during reconciliation. Poll and artifact requests do not need the headers again; later changes cannot mutate the job.
Retail cost versus wholesale routing price
X-OpenMayhem-Max-Cost-Usd limits the customer's worst-case retail hold. The stricter of this value and the API key's per-request cap wins. It is an exact decimal USD string, not a floating-point estimate.
Examples
curl
curl "https://api.openmayhem.ai/v1/chat/completions" \
-H "Authorization: Bearer $OPENMAYHEM_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Mayhem-Min-Att-Tier: T2" \
-H "X-Mayhem-Min-Ctx: 131072" \
-H "X-Mayhem-Quant: nvfp4" \
-H "X-Mayhem-Max-Wait-Ms: 30000" \
-H "X-OpenMayhem-Max-Cost-Usd: 0.50" \
-d '{
"model": "qwen/qwen3.8-27b",
"messages": [{"role": "user", "content": "Summarize this contract."}],
"max_tokens": 1000
}'JavaScript
const response = await fetch(
"https://api.openmayhem.ai/v1/chat/completions",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OPENMAYHEM_API_KEY}`,
"Content-Type": "application/json",
"X-Mayhem-Min-Att-Tier": "T2",
"X-Mayhem-Hedge": "1",
"X-Mayhem-Min-Tok-S": "20",
"X-OpenMayhem-Max-Cost-Usd": "0.50",
},
body: JSON.stringify({
model: "qwen/qwen3.8-27b",
messages: [{ role: "user", content: "Give me three release risks." }],
max_tokens: 800,
}),
},
);
if (!response.ok) throw new Error(await response.text());
const completion = await response.json();Python
import os
import requests
response = requests.post(
"https://api.openmayhem.ai/v1/chat/completions",
headers={
"Authorization": f"Bearer {os.environ['OPENMAYHEM_API_KEY']}",
"X-Mayhem-Prefer-Providers": "PROVIDER_PUBLIC_KEY",
"X-Mayhem-Min-Att-Tier": "T2",
"X-Mayhem-Max-Wait-Ms": "30000",
"X-OpenMayhem-Max-Cost-Usd": "0.50",
},
json={
"model": "qwen/qwen3.8-27b",
"messages": [{"role": "user", "content": "Hello"}],
"max_tokens": 500,
},
timeout=120,
)
response.raise_for_status()
print(response.json())Stable constraint errors
Invalid values and unavailable combinations fail before spend with stable codes. Recheck the live catalog before changing the constraint or retrying. See Errors for the complete code catalog. Errors.
| Code | Status | Retry |
|---|---|---|
| retail_cost_limit_exceeded | 403 | — |
| invalid_catalog_filter | 400 | — |
| invalid_routing_control | 400 | — |
| routing_control_not_public | 400 | — |
| incompatible_routing_constraints | 400 | — |
| no_provider_satisfies_attestation_tier | 400 | — |
| no_provider_satisfies_quant | 400 | — |
| context_requirement_unavailable | 400 | — |
| preferred_provider_unavailable | 503 | ✓ |
| confidential_compute_unavailable | 503 | ✓ |