Endpoint reference
Every endpoint authenticates with a bearer key, and the required scope is shown in parentheses.
Text
| Endpoint | Purpose |
|---|---|
POST /v1/chat/completions (CHAT) | OpenAI-compatible chat completion; streaming optional |
POST /v1/completions (COMPLETIONS) | Legacy text completion |
POST /v1/responses (RESPONSES) | Stateless responses API |
POST /v1/embeddings (EMBEDDINGS) | Embedding vectors |
POST /v1/decisions (DECISIONS) | Run typed policy decisions over application state. |
POST /v1/decisions/flash-jev (DECISIONS) | Ask Flash JEV typed choice, score, or yes-or-no questions about your application state. |
POST /v1/tokenize | Exact native token count with optional token IDs |
POST /v1/count_tokens | Alias of /v1/tokenize |
Count tokens exactly
POST /v1/tokenize asks a live provider to apply the selected model's native tokenizer. POST /v1/count_tokens is an identical alias. Use either endpoint before generation to measure a prompt against that model's context limit.
Send model and exactly one of messages or prompt. With messages, the provider applies the same serving chat template used for inference. Set return_tokens to true only when you also need the token IDs.
exact token-count request
curl https://api.openmayhem.ai/v1/tokenize \
-H "Authorization: Bearer $OPENMAYHEM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen3.8-27B",
"messages": [{"role": "user", "content": "Count this before sending."}],
"return_tokens": false
}'response
{
"object": "tokenization",
"model": "qwen/qwen3.8-27b",
"count": 13,
"tokens": null,
"max_model_len": 262144,
"provider": "…"
}This is an authenticated, rate-limited control request. It creates no inference job, credit hold, receipt or charge, and it does not consume a generation slot.
The endpoint is available for every catalog model whose live serving runtime exposes an exact native tokenizer. Other runtimes return token_count_unsupported; OpenMayhem never substitutes an estimate.
Media jobs
| Endpoint | Purpose |
|---|---|
POST /v1/images/generations (IMAGES) | Image generation job |
POST /v1/videos (VIDEOS) | Video generation job |
POST /v1/audio/speech (AUDIO_SPEECH) | Text-to-speech job |
POST /v1/audio/transcriptions (AUDIO_TRANSCRIPTIONS) | Speech-to-text job |
POST /v1/audio/generations (AUDIO_GENERATIONS) | Audio generation job |
POST /v1/music/generations (MUSIC) | Music generation job |
POST /v1/workflows (WORKFLOWS) | ComfyUI workflow-graph job |
GET /v1/jobs | List recent jobs |
GET /v1/jobs/{id} | Poll job status, cost and artifacts |
DELETE /v1/jobs/{id} | Cancel a running job |
GET /v1/artifacts/{id} | Download a job artifact (cached for no more than 12 hours; not backed up) |
Catalog and usage
| Endpoint | Purpose |
|---|---|
GET /v1/models | Public model catalog with prices and availability (no auth) |
GET /v1/models/by-id?id={id} | Model detail: pricing, parameters, request contracts |
GET /v1/models/by-id/stats?id={id} | Throughput and latency statistics |
GET /v1/models/by-id/activity?id={id} | Recent request activity |
GET /v1/models/by-id/availability?id={id} | Provider availability history |
GET /v1/models/by-id/pricing-history?id={id} | Every published price version |
GET /v1/requests/{id} | Settled usage, cost and receipt for one request |
Pass the exact model id, including vendor/model slashes, in the id query parameter.
Conventions
- An Idempotency-Key header makes POST retries safe.
- The x-request-id response header identifies every request.
- Hitting the rate limit returns 429 with Retry-After seconds.
- Errors are a JSON envelope with a stable code.
- Amounts are USD; the ledger uses micro-USD strings (1,000,000 = $1).
- Catalog filters and request routing controls are documented under Routing and trust.
https://api.openmayhem.ai/v1
Routing and trust: Catalog filters, provider constraints, attestation and retail cost limits.
