Quickstart

This page takes you from a new account to your first paid request in a few minutes.

View as MarkdownSuggest a change on GitHub
You need an account with credit.

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

POST /v1/chat/completionsCHAT ยท openai_chat_completions +

Working request

curl https://api.openmayhem.ai/v1/chat/completions \
  -H "Authorization: Bearer $OPENMAYHEM_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "model": "qwen/qwen3.8-27b",
  "max_tokens": 2000,
  "stream": false,
  "reasoning_effort": "xhigh",
  "thinking_mode": "enabled"
}'

Parameters

ParameterRequiredTypeDefaultAllowed valuesLimits and shape
messagesRequiredarrayโ€”โ€”min items 1; max items 4096 [{"role":"user","content":"Hello"}]
modelRequiredstringโ€”Qwen/Qwen3.8-27Bโ€”
frequency_penaltyOptionalnumberโ€”โ€”min -2; max 2
max_completion_tokensOptionalintegerโ€”โ€”min 0; max 262144
max_tokensOptionalintegerโ€”โ€”min 0; max 262144
metadataOptionalobjectโ€”โ€”JSON object; use the endpoint-specific schema shown in the examples
min_pOptionalnumberโ€”โ€”min 0; max 1
presence_penaltyOptionalnumberโ€”โ€”min -2; max 2
reasoning_effortOptionalstringxhighlow, medium, xhighโ€”
response_formatOptionalobjectโ€”โ€”{"type":"json_object"}
seedOptionalintegerโ€”โ€”min 0; max 4294967295
stopOptionalstring | array | nullโ€”โ€”JSON array
streamOptionalbooleanfalseโ€”โ€”
temperatureOptionalnumberโ€”โ€”min 0; max 2
thinking_historyOptionalstringpreservelatest_only, preserveโ€”
thinking_modeOptionalstringenableddisabled, enabledโ€”
tool_choiceOptionalstring | objectโ€”โ€”"auto" or an OpenAI tool-choice object
toolsOptionalarrayโ€”โ€”min items 1; max items 128 [{"type":"function","function":{"name":"get_time","description":"Get the current time","parameters":{"type":"object","properties":{}}}}]
top_kOptionalintegerโ€”โ€”min 0; max 1000000
top_pOptionalnumberโ€”โ€”min 0.000001; max 1
userOptionalstringโ€”โ€”min length 1; max length 512
Input shapes
tools
{
  "model": "qwen/qwen3.8-27b",
  "tools": [
  {
    "type": "function",
    "function": {
      "name": "get_time",
      "description": "Get the current time",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    }
  }
]
}
POST /v1/completionsCOMPLETIONS ยท openai_completions +

Working request

curl https://api.openmayhem.ai/v1/completions \
  -H "Authorization: Bearer $OPENMAYHEM_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "model": "qwen/qwen3.8-27b",
  "prompt": "A lighthouse at dusk",
  "max_tokens": 2000,
  "stream": false
}'

Parameters

ParameterRequiredTypeDefaultAllowed valuesLimits and shape
modelRequiredstringโ€”Qwen/Qwen3.8-27Bโ€”
promptRequiredstringโ€”โ€”min length 1; max length 32000
frequency_penaltyOptionalnumberโ€”โ€”min -2; max 2
max_tokensOptionalintegerโ€”โ€”min 0; max 262144
min_pOptionalnumberโ€”โ€”min 0; max 1
presence_penaltyOptionalnumberโ€”โ€”min -2; max 2
reasoning_effortOptionalstringxhighlow, medium, xhighโ€”
seedOptionalintegerโ€”โ€”min 0; max 4294967295
stopOptionalstring | array | nullโ€”โ€”JSON array
streamOptionalbooleanfalseโ€”โ€”
temperatureOptionalnumberโ€”โ€”min 0; max 2
thinking_historyOptionalstringpreservelatest_only, preserveโ€”
thinking_modeOptionalstringenableddisabled, enabledโ€”
top_kOptionalintegerโ€”โ€”min 0; max 1000000
top_pOptionalnumberโ€”โ€”min 0.000001; max 1
userOptionalstringโ€”โ€”min length 1; max length 512
POST /v1/responsesRESPONSES ยท openai_responses +

Working request

curl https://api.openmayhem.ai/v1/responses \
  -H "Authorization: Bearer $OPENMAYHEM_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "model": "qwen/qwen3.8-27b",
  "input": "Hello",
  "max_output_tokens": 2000,
  "stream": false,
  "reasoning_effort": "xhigh"
}'

Parameters

ParameterRequiredTypeDefaultAllowed valuesLimits and shape
inputRequiredstring | arrayโ€”โ€”JSON array
modelRequiredstringโ€”Qwen/Qwen3.8-27Bโ€”
max_output_tokensOptionalintegerโ€”โ€”min 0; max 262144
metadataOptionalobjectโ€”โ€”JSON object; use the endpoint-specific schema shown in the examples
min_pOptionalnumberโ€”โ€”min 0; max 1
reasoning_effortOptionalstringxhighlow, medium, xhighโ€”
streamOptionalbooleanfalseโ€”โ€”
temperatureOptionalnumberโ€”โ€”min 0; max 2
textOptionalobjectโ€”โ€”JSON object; use the endpoint-specific schema shown in the examples
thinking_historyOptionalstringpreservelatest_only, preserveโ€”
thinking_modeOptionalstringenableddisabled, enabledโ€”
tool_choiceOptionalstring | objectโ€”โ€”"auto" or an OpenAI tool-choice object
toolsOptionalarrayโ€”โ€”min items 1; max items 128 [{"type":"function","function":{"name":"get_time","description":"Get the current time","parameters":{"type":"object","properties":{}}}}]
top_kOptionalintegerโ€”โ€”min 0; max 1000000
top_pOptionalnumberโ€”โ€”min 0.000001; max 1
userOptionalstringโ€”โ€”min length 1; max length 512
Input shapes
tools
{
  "model": "qwen/qwen3.8-27b",
  "tools": [
  {
    "type": "function",
    "function": {
      "name": "get_time",
      "description": "Get the current time",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    }
  }
]
}
POST /v1/chat/completionsCHAT ยท hf_multimodal_chat +

Working request

curl https://api.openmayhem.ai/v1/chat/completions \
  -H "Authorization: Bearer $OPENMAYHEM_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "model": "qwen/qwen3.8-27b",
  "max_tokens": 2000,
  "stream": false,
  "reasoning_effort": "xhigh",
  "thinking_mode": "enabled"
}'

Parameters

ParameterRequiredTypeDefaultAllowed valuesLimits and shape
messagesRequiredarrayโ€”โ€”min items 1; max items 4096 [{"role":"user","content":"Hello"}]
modelRequiredstringโ€”Qwen/Qwen3.8-27Bโ€”
max_tokensOptionalintegerโ€”โ€”min 0; max 262144
min_pOptionalnumberโ€”โ€”min 0; max 1
reasoning_effortOptionalstringxhighlow, medium, xhighโ€”
response_formatOptionalobjectโ€”โ€”{"type":"json_object"}
seedOptionalintegerโ€”โ€”min 0; max 4294967295
streamOptionalbooleanfalseโ€”โ€”
temperatureOptionalnumberโ€”โ€”min 0; max 2
thinking_historyOptionalstringpreservelatest_only, preserveโ€”
thinking_modeOptionalstringenableddisabled, enabledโ€”
tool_choiceOptionalstring | objectโ€”โ€”"auto" or an OpenAI tool-choice object
toolsOptionalarrayโ€”โ€”min items 1; max items 128 [{"type":"function","function":{"name":"get_time","description":"Get the current time","parameters":{"type":"object","properties":{}}}}]
top_kOptionalintegerโ€”โ€”min 0; max 1000000
top_pOptionalnumberโ€”โ€”min 0.000001; max 1
Input shapes
tools
{
  "model": "qwen/qwen3.8-27b",
  "tools": [
  {
    "type": "function",
    "function": {
      "name": "get_time",
      "description": "Get the current time",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    }
  }
]
}

Use this model through MCP

These calls use this modelโ€™s exact live request contract. First estimate the unchanged request, then pass the returned estimate ID and maximum cost to the paid tool. Read the complete MCP guide.

chatCHAT +

Send this object to estimate_request. Review the result, then send the next object to the named paid tool without changing request.

estimate_request ยท CHAT
{
  "endpoint": "CHAT",
  "model": "qwen/qwen3.8-27b",
  "request": {
    "messages": [
      {
        "role": "user",
        "content": "Hello"
      }
    ],
    "max_tokens": 2000,
    "stream": false,
    "reasoning_effort": "xhigh",
    "thinking_mode": "enabled"
  }
}
chat
{
  "model": "qwen/qwen3.8-27b",
  "request": {
    "messages": [
      {
        "role": "user",
        "content": "Hello"
      }
    ],
    "max_tokens": 2000,
    "stream": false,
    "reasoning_effort": "xhigh",
    "thinking_mode": "enabled"
  },
  "estimate_id": "<estimate_id from estimate_request>",
  "max_cost_usd": "<maximum_cost_usd from estimate_request>"
}
create_responseRESPONSES +

Send this object to estimate_request. Review the result, then send the next object to the named paid tool without changing request.

estimate_request ยท RESPONSES
{
  "endpoint": "RESPONSES",
  "model": "qwen/qwen3.8-27b",
  "request": {
    "input": "Hello",
    "max_output_tokens": 2000,
    "stream": false,
    "reasoning_effort": "xhigh"
  }
}
create_response
{
  "model": "qwen/qwen3.8-27b",
  "request": {
    "input": "Hello",
    "max_output_tokens": 2000,
    "stream": false,
    "reasoning_effort": "xhigh"
  },
  "estimate_id": "<estimate_id from estimate_request>",
  "max_cost_usd": "<maximum_cost_usd from estimate_request>"
}
chatCHAT +

Send this object to estimate_request. Review the result, then send the next object to the named paid tool without changing request.

estimate_request ยท CHAT
{
  "endpoint": "CHAT",
  "model": "qwen/qwen3.8-27b",
  "request": {
    "messages": [
      {
        "role": "user",
        "content": "Hello"
      }
    ],
    "max_tokens": 2000,
    "stream": false,
    "reasoning_effort": "xhigh",
    "thinking_mode": "enabled"
  }
}
chat
{
  "model": "qwen/qwen3.8-27b",
  "request": {
    "messages": [
      {
        "role": "user",
        "content": "Hello"
      }
    ],
    "max_tokens": 2000,
    "stream": false,
    "reasoning_effort": "xhigh",
    "thinking_mode": "enabled"
  },
  "estimate_id": "<estimate_id from estimate_request>",
  "max_cost_usd": "<maximum_cost_usd from estimate_request>"
}

Agent drop-ins

These configurations make this exact model the main model in each harness. Create an API key first and keep it in OPENMAYHEM_API_KEY.

OpenCode+

Save this as opencode.json in your project, export the key, then select openmayhem/model in /models.

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "openmayhem": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "OpenMayhem",
      "options": {
        "baseURL": "https://api.openmayhem.ai/v1",
        "apiKey": "{env:OPENMAYHEM_API_KEY}"
      },
      "models": {
        "qwen/qwen3.8-27b": {
          "name": "Qwen3.8 27B",
          "limit": {
            "context": 262144,
            "output": 32768
          }
        }
      }
    }
  }
}
Run
export OPENMAYHEM_API_KEY="replace-with-your-openmayhem-api-key"
opencode --model "openmayhem/qwen/qwen3.8-27b"
Claude Code+

Claude Code speaks Anthropic Messages. Claude Code Router 2.0.0 translates it to this model's Chat Completions endpoint and removes Claude-only cache metadata.

~/.claude-code-router/config.json
{
  "LOG": false,
  "API_TIMEOUT_MS": 3600000,
  "Providers": [
    {
      "name": "openmayhem",
      "api_base_url": "https://api.openmayhem.ai/v1/chat/completions",
      "api_key": "$OPENMAYHEM_API_KEY",
      "models": [
        "qwen/qwen3.8-27b"
      ],
      "transformer": {
        "use": [
          "cleancache"
        ]
      }
    }
  ],
  "Router": {
    "default": "openmayhem,qwen/qwen3.8-27b",
    "background": "openmayhem,qwen/qwen3.8-27b",
    "think": "openmayhem,qwen/qwen3.8-27b",
    "longContext": "openmayhem,qwen/qwen3.8-27b",
    "longContextThreshold": 229376
  }
}
Run
npm install -g @anthropic-ai/claude-code @musistudio/claude-code-router@2.0.0
export OPENMAYHEM_API_KEY="replace-with-your-openmayhem-api-key"
export MAX_THINKING_TOKENS=0
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=262144
export CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1
ccr start &
ccr code
ccr stop
Codex CLI+

Codex 0.80.0 is the tested Chat Completions compatibility release for this model. The key stays in the environment; config.toml contains no secret.

~/.codex/config.toml
model = "qwen/qwen3.8-27b"
model_provider = "openmayhem"
model_context_window = 262144

[model_providers.openmayhem]
name = "OpenMayhem"
base_url = "https://api.openmayhem.ai/v1"
env_key = "OPENMAYHEM_API_KEY"
wire_api = "chat"
request_max_retries = 4
stream_max_retries = 5
stream_idle_timeout_ms = 3600000
Run
export OPENMAYHEM_API_KEY="replace-with-your-openmayhem-api-key"
npx -y @openai/codex@0.80.0
Hermes Agent+

Hermes uses OpenMayhem as a named custom provider over Chat Completions. The key stays in OPENMAYHEM_API_KEY and is not stored in YAML.

~/.hermes/config.yaml
providers:
  openmayhem:
    api: "https://api.openmayhem.ai/v1"
    key_env: OPENMAYHEM_API_KEY
    transport: chat_completions
    default_model: "qwen/qwen3.8-27b"
    models:
      "qwen/qwen3.8-27b":
        context_length: 262144

model:
  default: "qwen/qwen3.8-27b"
  provider: custom:openmayhem
  api_mode: chat_completions
  context_length: 262144
  max_tokens: 32768
Run
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
export OPENMAYHEM_API_KEY="replace-with-your-openmayhem-api-key"
hermes chat
OpenClaw+

Merge this provider into openclaw.json. apiKey is an environment SecretRef, so the resolved key is not written to the file.

~/.openclaw/openclaw.json
{
  "models": {
    "mode": "merge",
    "providers": {
      "openmayhem": {
        "baseUrl": "https://api.openmayhem.ai/v1",
        "apiKey": "${OPENMAYHEM_API_KEY}",
        "api": "openai-completions",
        "authHeader": true,
        "timeoutSeconds": 3600,
        "models": [
          {
            "id": "qwen/qwen3.8-27b",
            "name": "Qwen3.8 27B",
            "reasoning": true,
            "input": [
              "text"
            ],
            "contextWindow": 262144,
            "contextTokens": 229376,
            "maxTokens": 32768,
            "compat": {
              "supportsTools": true,
              "supportsReasoningEffort": true,
              "supportedReasoningEfforts": [
                "low",
                "medium",
                "xhigh"
              ],
              "supportsTemperature": true
            }
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "openmayhem/qwen/qwen3.8-27b"
      }
    }
  }
}
Run
export OPENMAYHEM_API_KEY="replace-with-your-openmayhem-api-key"
openclaw agent --local --model "openmayhem/qwen/qwen3.8-27b" --message "Hello"

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.

Details for experts
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.
Routing and trust: Catalog filters, provider constraints, attestation and retail cost limits.