Home API

Madhuram API

An OpenAI-compatible endpoint for Madhuram-v0.6. If your code already talks to OpenAI, changing two lines is enough.

Documentation

Quickstart

Create an API key from the chat interface, sign in, open Settings → API, and select Create API key. The key is shown once and cannot be retrieved afterwards, so store it somewhere safe.

Python , OpenAI SDK
from openai import OpenAI

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

response = client.chat.completions.create(
    model="madhuram",
    messages=[{"role": "user", "content": "Explain gradient descent in two sentences."}]
)

print(response.choices[0].message.content)
cURL
curl https://api.maruthlabs.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "madhuram",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
JavaScript , OpenAI SDK
import OpenAI from "openai";

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

const r = await client.chat.completions.create({
  model: "madhuram",
  messages: [{ role: "user", content: "Hello" }]
});

console.log(r.choices[0].message.content);

Authentication

Every request requires a bearer token in the Authorization header:

Authorization: Bearer sk-mrth-...

Keys are issued per account, one active key at a time. Regenerating a key revokes the previous one immediately. Only a hash of your key is stored on our side, which means we cannot recover it for you, if it is lost, generate a new one.

Keep keys server-side. A key in browser JavaScript or a mobile app bundle is publicly readable. Route requests through your own backend.

Endpoints

Base URL: https://api.maruthlabs.com/v1

POST/v1/chat/completions

Generates a completion for a conversation. Accepts and returns the standard OpenAI chat-completions shape, with or without streaming.

Response
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1785312496,
  "model": "madhuram",
  "choices": [{
    "index": 0,
    "message": { "role": "assistant", "content": "..." },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 57,
    "completion_tokens": 10,
    "total_tokens": 67
  }
}

GET/v1/models

Lists available models.

{
  "object": "list",
  "data": [{ "id": "madhuram", "object": "model", "owned_by": "maruthlabs" }]
}

GET/v1/usage

Returns your consumption against the current day's quota.

{
  "tier": "free",
  "day": "2026-07-29",
  "requests_used": 12,
  "requests_limit": 1000,
  "tokens_used": 4820,
  "tokens_limit": 200000,
  "resets": "00:00 UTC"
}

Parameters

ParameterTypeDescription
messages array Required. Conversation history. Each entry has a role (system, user, or assistant) and content.
model string Use "madhuram". Other values are ignored.
max_tokens integer Maximum tokens to generate. Capped at 4096. Values of -1 or 0 are treated as "use the maximum".
temperature number Sampling temperature. Lower is more deterministic; higher is more varied.
top_p number Nucleus sampling threshold.
top_k integer Restricts sampling to the k most likely tokens.
repetition_penalty number Multiplicative penalty on repeated tokens. 1.0 is neutral; useful range is roughly 1.0 to 1.3.
presence_penalty
frequency_penalty
number Additive OpenAI-style penalties. Do not stack these with repetition_penalty or output degrades.
stop string / array Sequences that halt generation. A bare string is accepted and normalised.
seed integer Seeds sampling for reproducible output.
stream boolean Streams tokens as server-sent events. Defaults to false.
Parameters outside this list are ignored rather than passed through, so an unknown field from your client library will not cause a request to fail.

Streaming

Set stream: true to receive tokens as they are generated, in the standard OpenAI server-sent-event format terminated by data: [DONE].

Python
stream = client.chat.completions.create(
    model="madhuram",
    messages=[{"role": "user", "content": "Write a haiku about servers."}],
    stream=True
)

for chunk in stream:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="", flush=True)

Rate limits

Free-tier limits, applied per account:

LimitValueWindow
Requests per minute60Rolling
Requests per day1,000Resets 00:00 UTC
Tokens per day200,000Resets 00:00 UTC
Max tokens per request4,096Per request
Context window16,384Prompt + completion

Responses carry X-RateLimit-Remaining-Requests and X-RateLimit-Remaining-Tokens headers so clients can self-throttle. Building something that needs more? Get in touch, higher limits are available on request.

Errors

StatusMeaningWhat to do
400 Malformed request Check that messages is present and well-formed, and that the prompt fits the context window.
401 Missing, invalid, or revoked key Verify the Authorization header. If the key was regenerated, update it.
429 Rate limit or daily quota exceeded Back off and retry. The Retry-After header gives the wait in seconds.
503 Inference backend unavailable Transient. Retry with exponential backoff.

Data & privacy

Requests and responses are recorded for usage metering, debugging, and abuse investigation. They are used to train future models only if you opt in, the setting is off by default and can be changed at any time under Settings → API in the chat interface.

The API is free for Madhuram-v0.6. We will give notice before introducing pricing.

Start building

Create a key in under a minute. No card, no waitlist.