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.
Proxy models: Use proxied models like native ones in Chat, the API and MCP.
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. |
X-OpenMayhem-Max-Input-Price-Per-Million-Usd | Price ceiling: the highest retail input price per one million tokens you accept for this model. |
X-OpenMayhem-Max-Output-Price-Per-Million-Usd | Price ceiling: the highest retail output price per one million tokens you accept for this model. |
X-OpenMayhem-Max-Representative-Request-Price-Usd | Price ceiling: the highest retail price of this model's representative request; use it for media, audio, video and workflow models. |
Provider preference and failover
X-Mayhem-Prefer-Providers is a strict list. 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.
Details for expertsAsynchronous jobs · Retail cost versus wholesale routing price
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.
Price ceilings per unit
The three price ceiling headers cap the retail price you accept for the model of the request. They take the same numbers as the max_input_price_per_million_usd, max_output_price_per_million_usd and max_representative_request_price_usd catalog filters, so one value filters the catalog and caps admission. The API compares them with the price fixed for the request, in exact integer arithmetic, before any credit is held, and refuses a higher price with 403 price_ceiling_exceeded naming the model, field, ceiling and current price. A ceiling on a unit the model does not charge for has no effect; cap media, audio, video and workflow models with the representative request ceiling.
Examples
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" \
-H "X-OpenMayhem-Max-Output-Price-Per-Million-Usd: 0.50" \
-d '{
"model": "qwen/qwen3.8-27b",
"messages": [{"role": "user", "content": "Summarize this contract."}],
"max_tokens": 1000
}'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",
"X-OpenMayhem-Max-Input-Price-Per-Million-Usd": "0.20",
"X-OpenMayhem-Max-Output-Price-Per-Million-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();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",
"X-OpenMayhem-Max-Output-Price-Per-Million-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 | — |
price_ceiling_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 | ✓ |
