OpenAI format

Point any OpenAI-compatible client at MafiaLLM and keep the rest of its configuration. The key, the balance and the model ids are the same as everywhere else on the site.

SettingValue
Base URLhttps://api.mafiallm.com/v1
Aliashttps://api.mafiallm.com/openai/v1
ChatPOST /chat/completions
ModelsGET /models
KeyAuthorization: Bearer sk-mf-…
StreamingYes, stream: true

Both base URLs reach the same endpoint. Use /v1 when a client expects to append the path itself, and /openai/v1 when you want the format to be explicit.

With the OpenAI SDK

python:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.mafiallm.com/v1",
    api_key=os.environ["MAFIA_KEY"],
)

reply = client.chat.completions.create(
    model="glm-5.3-uncensored",
    messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)

node:

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.mafiallm.com/v1",
  apiKey: process.env.MAFIA_KEY,
});

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

With curl

curl https://api.mafiallm.com/v1/chat/completions \
  -H "Authorization: Bearer $MAFIA_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"glm-5.3-uncensored","messages":[{"role":"user","content":"Hello"}]}'

What is supported

Responses API

POST /v1/responses is served for clients that require it, including Codex. It accepts input as a string or as message, function_call and function_call_output items; instructions; flat function tools; max_output_tokens; and stream: true with the usual response.* events. State is not stored: send the full conversation in input on every turn.

Errors follow the usual OpenAI shape: {"error":{"message":"…"}}. Status codes are listed in Errors.