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 are mghp_ followed by 48 hex characters. The full key is shown only once — afterwards the dashboard displays just the mghp_… prefix to identify it.

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.

Example response

A non-streamed call returns a standard chat.completion object. The model field echoes the resolved model id, and usage reflects what you were billed (see credits).

json
{
  "id": "chatcmpl-9f3a1c7b8e2d4a6f0b1c2d3e",
  "object": "chat.completion",
  "created": 1782819600,
  "model": "google/gemini-2.5-flash-lite",
  "choices": [{
    "index": 0,
    "message": {"role": "assistant", "content": "Hello! How can I help you today?"},
    "finish_reason": "stop"
  }],
  "usage": {"prompt_tokens": 9, "completion_tokens": 9, "total_tokens": 18}
}

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 every id you can pass in the model field. Use a MUHGPT model id for a specific model, or an OpenAI-style alias for drop-in compatibility — both are accepted.

MUHGPT models

Modelmodel idBest for
MUH Litegoogle/gemini-2.5-flash-liteDefault. Fast, economical, everyday chat & vision.
MUH Minigoogle/gemini-3.1-flash-liteNewer lightweight model; strong multimodal / vision.
MUH Coderqwen/qwen3-coder:freeCode generation and tool use.
MUH Progoogle/gemini-3.5-flashHighest-quality reasoning and longer answers.

OpenAI-compatible aliases

These aliases are accepted and routed to MUH Lite (the default), so existing OpenAI code runs unchanged. Pass a MUHGPT model id above when you need a specific model.

AliasRoutes to
muh-chatMUH Lite (default)
gpt-4oMUH Lite
gpt-4o-miniMUH Lite
gpt-3.5-turboMUH Lite

An unrecognized model returns 404 model_not_found. Call GET /v1/models to fetch the live list programmatically — it returns these ids in OpenAI's { "object": "list", "data": [...] } shape.

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 )

Worked example

A request with 1,000 prompt tokens and 500 completion tokens:

cost = ceil( (1000 × 1 + 500 × 3) × 1.3 ) = ceil(3250) = 3,250 credits

The same weights apply to streaming. A few reference points:

Prompt tokensCompletion tokensCredits charged
100100520
5000650
1,0005003,250
2,0001,0006,500

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
400invalid_request_errorMalformed JSON, or messages missing/empty.
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.
404model_not_foundThe model value is not a known id or alias.
413invalid_request_errorRequest body too large.
429rate_limitMore than 60 requests/minute.
502upstream_errorModel provider unavailable — retry.

OpenAI compatibility

The API implements the parts of the OpenAI REST surface that most apps actually use. If your SDK only touches the endpoints below, it works unchanged against https://api.muhgpt.com/v1.

Supported

EndpointNotes
POST/v1/chat/completionsIncl. streaming, function calling, vision and response_format JSON mode.
GET/v1/modelsLists the model ids you can call.
GET/v1/usageCredit balance and consumption — a MUHGPT extension.

Not supported yet

These endpoints respond 404 — design around them for now:

EndpointNote
/v1/embeddingsNo embeddings endpoint.
/v1/images/generationsImage generation lives in the app, not the API.
/v1/audio/*No speech-to-text or text-to-speech.
/v1/completions (legacy)Use /v1/chat/completions instead.
Other/v1/files, /v1/assistants, /v1/moderations, fine-tuning and batches are not available.

Behavior to know

TopicDetail
System promptA MUHGPT system prompt is always applied; custom system messages in your request are currently ignored.
Extra paramsOnly the fields listed under Chat completions are forwarded. Others (n, logit_bias, logprobs, user…) are ignored, not rejected.
ChoicesEach response returns exactly one choice — n > 1 is not supported.
Resolved modelThe model in the response is the underlying provider id (e.g. google/gemini-2.5-flash-lite), not the alias you sent.