MUHGPT API
Site Get API Key
OpenAI-compatible

MUHGPT API

A drop-in OpenAI-compatible REST API. Point any OpenAI SDK at our base URL, use your mghp_ key, and you are done — chat, streaming, function calling and vision all work out of the box.

Base URL

https://api.muhgpt.com/v1

Streaming

Server-sent events, token by token.

Function calling

Full tools / tool_choice support.

Vision

Multimodal messages with images.

Usage API

Track spend per day and model.

Authentication

All requests are authenticated with a Bearer token. Create one in the app under Settings → API Keys. Keys start with mghp_ and are shown only once.

http
Authorization: Bearer mghp_your_key_here

Keep your key secret. Anyone with it can spend your credits. Revoke a leaked key in Settings → API Keys and create a new one.

Quickstart

Because the API is OpenAI-compatible, the official SDKs work by overriding base_url.

bash
curl https://api.muhgpt.com/v1/chat/completions \
  -H "Authorization: Bearer $MUHGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "muh-chat",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.muhgpt.com/v1",
    api_key="mghp_your_key_here",
)

resp = client.chat.completions.create(
    model="muh-chat",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
javascript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.muhgpt.com/v1",
  apiKey: "mghp_your_key_here",
});

const resp = await client.chat.completions.create({
  model: "muh-chat",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);

Chat completions

POST/v1/chat/completions

The main endpoint. Accepts the standard OpenAI body. Supported parameters:

FieldTypeNotes
modelstringSee models. Defaults to muh-chat.
messagesarrayRequired. Roles: system, user, assistant, tool.
streamboolServer-sent events when true.
max_tokensintCapped by your balance and key limit.
temperaturenumber0–2.
top_pnumber0–1.
stopstring/arrayStop sequences.
frequency_penaltynumber-2–2.
presence_penaltynumber-2–2.
response_formatobjecte.g. {"type":"json_object"}.
seedintBest-effort determinism.
tools, tool_choicearray/—See function calling.

Streaming

Set "stream": true to receive chat.completion.chunk events terminated by data: [DONE]. The final chunk carries usage.

python
stream = client.chat.completions.create(
    model="muh-chat",
    messages=[{"role": "user", "content": "Write a haiku"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

Function calling

Pass JSON-schema tools. The model replies with tool_calls and finish_reason: "tool_calls". Works in streaming too.

json
{
  "model": "muh-chat",
  "messages": [{"role": "user", "content": "Weather in Lisbon?"}],
  "tools": [{
    "type": "function",
    "function": {
      "name": "get_weather",
      "parameters": {
        "type": "object",
        "properties": {"city": {"type": "string"}},
        "required": ["city"]
      }
    }
  }],
  "tool_choice": "auto"
}

Vision

Send an array content mixing text and images. Use a vision-capable model.

json
{
  "model": "muh-chat",
  "messages": [{
    "role": "user",
    "content": [
      {"type": "text", "text": "What is in this image?"},
      {"type": "image_url", "image_url": {"url": "https://example.com/cat.jpg"}}
    ]
  }]
}

List models

GET/v1/models

Returns the available model aliases.

AliasNotes
muh-chatDefault. Recommended.
gpt-3.5-turboCompatibility alias.
gpt-4o-miniCompatibility alias.
gpt-4oCompatibility alias.

Usage

GET/v1/usage?start=YYYY-MM-DD&end=YYYY-MM-DD

Returns your credit balance plus consumption totals, a daily breakdown and a per-model breakdown. Defaults to the last 30 days.

json
{
  "object": "usage",
  "balance": 13997015,
  "totals": {"credits": 2985, "tokens": 2985, "requests": 10},
  "daily": [{"day": "2026-06-10", "credits": 2933, "requests": 8}],
  "by_model": [{"model": "muh-chat", "credits": 2933}]
}

Credits & pricing

Each request costs credits drawn from your balance. The cost weights output tokens more than input, like most providers:

cost = ceil( (prompt_tokens × 1 + completion_tokens × 3) × 1.3 )

Top up your balance in the app under Settings → API Keys → Buy credits (card or crypto). Check your remaining balance any time with GET /v1/usage.

Rate & key limits

LimitValue
Rate limit60 requests / minute per account
Active keysUp to 10 per account
Monthly key capOptional credit ceiling per key
Model allow-listOptional per key — restrict which models a key may call

Set a monthly limit and an allowed-model list per key when you create it, to safely hand a key to a third party.

Errors

Errors use the OpenAI shape: { "error": { "message", "type" } }.

StatusTypeMeaning
401invalid_request_errorMissing or invalid API key.
402insufficient_quotaNo credits, or key monthly limit reached.
403model_not_allowedModel not in this key's allow-list.
413invalid_request_errorRequest body too large.
429rate_limitMore than 60 requests/minute.
502upstream_errorModel provider unavailable — retry.