Quickstart

Three steps of setup, then one request. Nothing here needs a sales call or a subscription.

View as Markdown

Set up

  1. Create an account and add credit on the credit page. Credit is spent per request.
  2. Create an API key under API keys. The secret is shown once and never again.
  3. Pick a model id from the live catalog, which shows prices and how many providers are online right now.

Make a request

curl https://api.openmayhem.ai/v1/chat/completions \
  -H "Authorization: Bearer $OPENMAYHEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen/qwen3.8-flash-next",
    "messages": [{"role": "user", "content": "Hello"}],
    "max_tokens": 2000
  }'

The response is OpenAI-shaped, with two additions: the exact cost in USD inside usage, and the identity of the signed receipt the charge settled against.

response (abridged)

{
  "choices": [{ "message": { "role": "assistant", "content": "…" } }],
  "usage": {
    "prompt_tokens": 8, "completion_tokens": 62, "total_tokens": 70,
    "cost": "0.000023"
  },
  "openmayhem": {
    "request_id": "…",
    "receipt": { "session_id": "…", "sequence": 1, "final": true, "verified": true }
  }
}
Reasoning models spend tokens thinking before they answer. Give them a generous max_tokens (2000 or more) or the reply can arrive empty with finish_reason "length". You are still charged for the thinking the provider did.

Use it with agents

OpenMayhem is not limited to Studio. Coding agents and automation tools can use the same live models through the OpenAI-compatible API.

This setup is prefilled for qwen/qwen3.8-flash-next using /v1/chat/completions.
  1. Create an account or sign in, then create a key under API keys.
  2. Copy the key when it appears. It is shown only once.
  3. Replace replace-with-your-openmayhem-api-key below with that copied key.

agent environment

export OPENAI_API_KEY="replace-with-your-openmayhem-api-key"
export OPENAI_BASE_URL="https://api.openmayhem.ai/v1"
export OPENAI_MODEL="qwen/qwen3.8-flash-next"

For an agent that accepts the standard OpenAI environment variables, set the OpenMayhem base URL and API key as shown. Keep the key in an environment variable, never in a project file.

exact request for this model

curl https://api.openmayhem.ai/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen/qwen3.8-flash-next",
    "messages": [{"role": "user", "content": "Hello"}],
    "max_tokens": 2000
  }'

JavaScript agent request

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
  baseURL: "https://api.openmayhem.ai/v1",
});

const stream = await client.chat.completions.create({
  model: process.env.OPENAI_MODEL ?? "qwen/qwen3.8-flash-next",
  messages: [{ role: "user", content: "Inspect this project and propose the next change." }],
  max_tokens: 8000,
  stream: true,
});

for await (const event of stream) {
  process.stdout.write(event.choices[0]?.delta?.content ?? "");
}

Choose the current model id, context, price and availability from the live model catalog before starting a task. Tools, images, streaming and structured output work when the selected model lists them.

Routing and trust: Catalog filters, provider constraints, attestation and retail cost limits.