canonical: https://jentic.com/apis/openmayhem.ai/openmayhem

# OpenMayhem API

The OpenMayhem API sells pay-per-use AI inference routed across a decentralised network of model providers, with OpenAI-compatible chat completions, completions, responses, and embeddings endpoints. Beyond text, it queues image, video, speech, transcription, audio, and music generation jobs and ComfyUI workflow graphs, which you poll for status, cost, and downloadable artifacts. Billing reserves then settles from prepaid credit, and every request can be looked up afterwards for its settled usage, cost, and provider-signed receipt. Public model endpoints report each model's pricing history, throughput and latency, and provider availability, and request headers let a caller cap cost or require a minimum context size or attestation tier.

## For AI agents

Call OpenAI-compatible chat, completion, and embedding models on a decentralised provider network, run image, video, audio, and music generation jobs, and check cost and signed receipts per request.

## Scope

Does not fine-tune models, host your own weights, or store conversation history. Use for pay-per-use inference and media generation on OpenMayhem's provider network only.

## Capabilities

- Generate chat completions and embeddings through OpenAI-compatible endpoints, with optional server-sent event streaming
- Cap what a single request may spend with the X-OpenMayhem-Max-Cost-Usd header, or price it first with POST /estimates
- Queue image, video, text-to-speech, transcription, audio, and music generation jobs, then poll GET `/jobs/{id}` for status, cost, and artifacts
- Run ComfyUI workflow graphs with input files as jobs
- Look up settled usage, cost, and the provider-signed receipt for any request id
- Compare models by price, context size, modality, and attestation tier, with throughput, latency, and pricing history
- Count or tokenize a prompt exactly for a given model before sending it

## Use cases

### Cost-capped model calls from your agent

An AI agent working through Jentic sends POST `/chat/completions` with a model and messages, and sets X-OpenMayhem-Max-Cost-Usd so the request cannot spend past a limit. Each response carries an openmayhem.request_id, and GET `/requests/{id}` returns the settled usage, cost, and provider-signed receipt so the agent or its operator can audit what was charged. Your own Jentic One instance injects the sk-om-v1- key at call time.

Example prompt: Call POST `/chat/completions` with a model, two messages, max_tokens 500, and X-OpenMayhem-Max-Cost-Usd 0.05, then fetch GET `/requests/{id}` with the returned request id and report the settled cost

### Choosing a model by price and capability

Before committing to a model, GET /models filters the public model list by modality, minimum context tokens, maximum input and output price per million tokens, structured output, and tool support. GET `/models/by-id/stats` and GET `/models/by-id/availability` add throughput, latency, and provider availability, so an agent can pick the cheapest model that meets its context and reliability needs.

Example prompt: Call GET /models with min_context_tokens 128000 and max_input_price_per_million_usd 1, then GET `/models/by-id/stats` for the top three and pick the fastest

### Media generation jobs

Image, video, speech, transcription, music, and audio generation run as jobs rather than synchronous calls. POST `/images/generations` or POST /videos returns a job, GET `/jobs/{id}` reports its status, cost, and artifacts, GET `/artifacts/{id}` downloads a result, and POST `/artifacts/{id}/link` creates a short-lived link to share it. DELETE `/jobs/{id}` cancels a job that is still running.

Example prompt: POST `/images/generations` with a model, prompt, and size, poll GET `/jobs/{id}` until it completes, then create a link with POST `/artifacts/{id}/link`

### Credit and spend monitoring

GET /balance returns posted, reserved, and available USD credit, and POST /estimates validates a request against live pricing and key limits without placing a credit hold or charging, so an agent can check that a large batch fits the remaining credit before it starts.

Example prompt: Call GET /balance, then POST /estimates with endpoint `/chat/completions` and the planned request body, and proceed only if the estimate is below available credit

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/chat/completions` | Chat completion |
| POST | `/embeddings` | Embedding vectors |
| POST | `/estimates` | Estimate a billable request |
| GET | `/requests/{id}` | Settled usage, cost, and receipt |
| POST | `/images/generations` | Image generation job |
| GET | `/jobs/{id}` | Poll job status, cost, and artifacts |
| GET | `/balance` | Read account credit |
| GET | `/models` | List models with filters |

## Key resources

- **Text inference** — OpenAI-compatible chat completions, completions, responses, and embeddings
- **Decisions** — Typed choice, score, or yes-or-no questions evaluated against application state
- **Jobs and artifacts** — Image, video, audio, speech, transcription, music, and ComfyUI workflow jobs with downloadable artifacts
- **Requests and billing** — Per-request settled usage, cost, and signed receipt, plus account credit balance and estimates
- **Models** — Public model list with pricing history, throughput and latency stats, activity, and provider availability

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 50 / 100
- **Maturity:** Foundational
- **Dimensions:**
  - Foundational Compliance: 51 / 100
  - Developer Experience & Jentic Compatibility: 65 / 100
  - AI-Readiness & Agent Experience: 29 / 100
  - Agent Usability: 94 / 100
  - Security: 60 / 100
  - AI Discoverability: 55 / 100
- **View full report:** https://jentic.com/apis/openmayhem.ai/openmayhem/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring OpenMayhem by hand means issuing a scoped sk-om-v1- key, sending it as a bearer token, polling media jobs to completion, and handling Retry-After on 429s. Through Jentic you install once, import OpenMayhem from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** Rules bound OpenMayhem by operation: the model and prompt travel in the request body, so a rule decides which endpoint families your agent may call, such as chat but not video, not which model it picks. You choose the operations it may call, so DELETE `/jobs/{id}` and the costlier media jobs are not included unless you add them.
- **Credential handling:** Your OpenMayhem key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'generate a chat completion' or 'check my credit balance', and Jentic returns the matching OpenMayhem operation with its input schema, including model, messages, and the optional cost-cap headers, so the agent calls it directly.

## Related APIs

- **OpenRouter API** — OpenAI-compatible routing across many model providers
- **OpenAI API** — First-party GPT models, embeddings, and media generation
- **Replicate API** — Run open-source image, video, and audio models as predictions
- **Browser Use API** — Cloud browser tasks for agents

## FAQ

### What authentication does the OpenMayhem API use?

The OpenMayhem API uses a bearer token per its OpenAPI spec, with a key from the dashboard in the format sk-om-v1-. Each operation names the key scope it needs, such as CHAT, EMBEDDINGS, IMAGES, or BILLING_READ. The model endpoints under GET /models are public and need no key. Through Jentic the key is stored by your own instance and attached at call time.

### Can I cap how much a single OpenMayhem API request costs?

Yes. Inference endpoints accept the X-OpenMayhem-Max-Cost-Usd header, and further headers cap the input and output price per million tokens. POST /estimates validates a request against live pricing and key limits without a credit hold or charge; the estimate expires after ten minutes and is not a reservation. After the call, GET `/requests/{id}` returns the settled cost and signed receipt.

### What are the rate limits for the OpenMayhem API?

The OpenAPI spec does not publish a numeric limit. It documents a 429 response that asks you to wait the Retry-After seconds before retrying. See https://openmayhem.ai/docs for current limits.

### Is there an OpenMayhem MCP server?

You don't need an MCP server to give your agent OpenMayhem. Jentic connects it directly from the API Directory: import it, store your credential once, and your agent calls the inference, job, and model operations on demand without loading another server's tool definitions into its context.

### How do I get a chat completion from OpenMayhem through Jentic?

Search Jentic for 'chat completion with a cost cap', load the POST `/chat/completions` operation, and execute it with model and messages, plus max_tokens to budget the reply. The response follows the OpenAI shape and includes an openmayhem.request_id for GET `/requests/{id}.` To run it on your own infrastructure, install Jentic One from its GitHub repo.

### Can I limit what my agent is allowed to do with the OpenMayhem API?

Yes. For a writing assistant, write a rule that allows POST `/chat/completions` and GET `/requests/{id}` only, and the agent can call text models and check what each call cost but cannot start video or music jobs, cancel jobs, or create artifact links. Every call it makes is logged.
