Mume Ai Gateway Api
29 Nov 2025🚀 Mume Gateway API Documentation
Your unified gateway to the world’s most powerful AI models
Mume Gateway provides a single, elegant API to access AI from OpenAI, Anthropic, Google, Mistral, and more — all through the familiar OpenAI SDK interface you already know and love.
📑 Table of Contents
- 🎯 Getting Started
- 💬 Chat Completions
- ⚡ Responses API
- 🌊 Streaming
- 🔧 Function Calling / Tools
- 🌐 Web Search
- 🤖 Available Models
- ⚠️ Error Handling
- 🔑 Generating an API Key
- 💡 Support
🎯 Getting Started
Installation
Get up and running in seconds with your preferred language:
Python
pip install openai
JavaScript/Node.js
npm install openai
Configuration
Point the OpenAI SDK to Mume Gateway by setting the base URL to https://mume.ai/api/v1. That’s it!
cURL
# Set your API key as an environment variable
export MUME_API_KEY="your-api-key"
# All requests should use the base URL: https://mume.ai/api/v1
Python
import openai
# Synchronous client
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
# Asynchronous client
async_client = openai.AsyncOpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://mume.ai/api/v1",
});
💬 Chat Completions
The Chat Completions API is the standard endpoint for conversational AI interactions. It supports multi-turn conversations, system prompts, and all the features you’d expect.
Basic Request
cURL
curl https://mume.ai/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MUME_API_KEY" \
-d '{
"model": "openai/gpt-4.1-mini",
"messages": [
{"role": "user", "content": "2+2="}
]
}'
Python
import openai
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
response = client.chat.completions.create(
model="openai/gpt-4.1-mini",
messages=[{"role": "user", "content": "2+2="}],
)
print(response.choices[0].message.content)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://mume.ai/api/v1",
});
const response = await client.chat.completions.create({
model: "openai/gpt-4.1-mini",
messages: [{role: "user", content: "2+2="}],
});
console.log(response.choices[0].message.content);
Streaming Chat Completions
Get responses token-by-token for a real-time experience:
cURL
curl https://mume.ai/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MUME_API_KEY" \
-d '{
"model": "openai/gpt-4.1-mini",
"messages": [
{"role": "user", "content": "Write a poem about the moon."}
],
"stream": true
}'
Python
import openai
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
response = client.chat.completions.create(
model="openai/gpt-4.1-mini",
messages=[{"role": "user", "content": "Write a poem about the moon."}],
stream=True,
)
for chunk in response:
content = getattr(chunk.choices[0].delta, "content", None)
if content is not None:
print(content, end="", flush=True)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://mume.ai/api/v1",
});
const stream = await client.chat.completions.create({
model: "openai/gpt-4.1-mini",
messages: [{role: "user", content: "Write a poem about the moon."}],
stream: true,
});
for await (const chunk of stream) {
const content = chunk.choices[0]?.delta?.content;
if (content) {
process.stdout.write(content);
}
}
Async Streaming (Python)
For high-performance async applications:
import openai
import asyncio
async_client = openai.AsyncOpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
async def main():
async with async_client.chat.completions.stream(
model="openai/gpt-4.1-mini",
messages=[{"role": "user", "content": "Write a poem about the moon."}],
) as stream:
async for chunk in stream:
if chunk.type == "content.delta":
print(chunk.delta, end="", flush=True)
asyncio.run(main())
⚡ Responses API
The Responses API offers a streamlined interface for single-turn interactions — perfect for quick queries and simple use cases.
Basic Request
cURL
curl https://mume.ai/api/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MUME_API_KEY" \
-d '{
"model": "openai/gpt-4.1-nano",
"input": [
{"type": "message", "content": "Write a poem about the moon.", "role": "user"}
]
}'
Python
import openai
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
response = client.responses.create(
model="openai/gpt-4.1-nano",
input=[
{"type": "message", "content": "Write a poem about the moon.", "role": "user"}
],
)
print(response.output_text.strip())
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://mume.ai/api/v1",
});
const response = await client.responses.create({
model: "openai/gpt-4.1-nano",
input: [
{type: "message", content: "Write a poem about the moon.", role: "user"},
],
});
console.log(response.output_text.trim());
Simple String Input
For the simplest use cases, just pass a string:
cURL
curl https://mume.ai/api/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MUME_API_KEY" \
-d '{
"model": "openai/gpt-4.1-mini",
"input": "Write a poem about the moon."
}'
Python
import openai
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
response = client.responses.create(
model="openai/gpt-4.1-mini",
input="Write a poem about the moon.",
)
print(response.output_text)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://mume.ai/api/v1",
});
const response = await client.responses.create({
model: "openai/gpt-4.1-mini",
input: "Write a poem about the moon.",
});
console.log(response.output_text);
Streaming Responses
cURL
curl https://mume.ai/api/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MUME_API_KEY" \
-d '{
"model": "openai/gpt-4.1-nano",
"input": [
{"type": "message", "content": "Write a poem about the moon.", "role": "user"}
],
"stream": true
}'
Python
import openai
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
response = client.responses.create(
model="openai/gpt-4.1-nano",
input=[
{"type": "message", "content": "Write a poem about the moon.", "role": "user"}
],
stream=True,
)
for chunk in response:
if chunk.type == "response.output_text.delta":
print(chunk.delta, end="", flush=True)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://mume.ai/api/v1",
});
const stream = await client.responses.create({
model: "openai/gpt-4.1-nano",
input: [
{type: "message", content: "Write a poem about the moon.", role: "user"},
],
stream: true,
});
for await (const chunk of stream) {
if (chunk.type === "response.output_text.delta") {
process.stdout.write(chunk.delta);
}
}
Async Streaming Responses (Python)
import openai
import asyncio
async_client = openai.AsyncOpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
async def main():
async with async_client.responses.stream(
model="openai/gpt-4.1-mini",
input="Write a poem about the moon.",
) as stream:
async for chunk in stream:
if chunk.type == "response.output_text.delta":
print(chunk.delta, end="", flush=True)
asyncio.run(main())
🔧 Function Calling / Tools
Extend AI capabilities by letting models call your custom functions. This powerful feature enables dynamic interactions with external systems, databases, APIs, and more.
How It Works
- Define your tools — Describe the functions the model can call
- Make the initial request — The model decides if it needs to call a function
- Execute the function — Run your code with the provided arguments
- Return results — Send the function output back to get the final response
Complete Example
cURL
Step 1: Initial request with tools defined
curl https://mume.ai/api/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MUME_API_KEY" \
-d '{
"model": "openai/gpt-4.1-mini",
"tools": [
{
"type": "function",
"name": "get_horoscope",
"description": "Get today'\''s horoscope for an astrological sign.",
"parameters": {
"type": "object",
"properties": {
"sign": {
"type": "string",
"description": "An astrological sign like Taurus or Aquarius"
}
},
"required": ["sign"]
}
}
],
"input": [
{
"type": "message",
"role": "user",
"content": "What is my horoscope? I am a Capricorn."
}
]
}'
Step 2: Send function results back
curl https://mume.ai/api/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MUME_API_KEY" \
-d '{
"model": "openai/gpt-4.1-mini",
"input": [
{
"type": "message",
"role": "user",
"content": "What is my horoscope? I am a Capricorn."
},
{
"type": "function_call",
"id": "call_abc123",
"callId": "call_abc123",
"name": "get_horoscope",
"arguments": "{\"sign\": \"Capricorn\"}"
},
{
"type": "function_call_output",
"callId": "call_abc123",
"id": "call_abc123",
"output": "{\"horoscope\": \"Capricorn: Next Tuesday you will befriend a baby otter.\"}"
}
]
}'
Python
import openai
import json
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
# 1. Define a list of callable tools for the model
tools = [
{
"type": "function",
"name": "get_horoscope",
"description": "Get today's horoscope for an astrological sign.",
"parameters": {
"type": "object",
"properties": {
"sign": {
"type": "string",
"description": "An astrological sign like Taurus or Aquarius",
},
},
"required": ["sign"],
},
},
]
def get_horoscope(sign):
return f"{sign}: Next Tuesday you will befriend a baby otter."
# Create a running input list we will add to over time
input_list = [
{
"type": "message",
"role": "user",
"content": "What is my horoscope? I am a Capricorn.",
}
]
# 2. Prompt the model with tools defined
response = client.responses.create(
model="gpt-4.1-mini",
tools=tools,
input=input_list,
stream=True,
)
final_tool_calls = {}
for chunk in response:
if chunk.type == "response.output_text.delta":
print(chunk.delta, end="", flush=True)
if chunk.type == "response.completed":
final_tool_calls = chunk.response.output
for item in final_tool_calls:
if item.type == "function_call":
# 1. Get the ID safely
# The SDK object usually has 'id' or 'call_id'
current_call_id = getattr(item, "id", None) or getattr(item, "call_id", None)
# 2. Construct function_call item
# CRITICAL FIX: Use 'call_id' (snake_case) as the key
i = {
"type": "function_call",
"call_id": current_call_id,
"name": item.name,
"arguments": item.arguments,
}
input_list.append(i)
if item.name == "get_horoscope":
# 3. Execute the function logic
# Fix: Extract 'sign' from the arguments dict
args = json.loads(item.arguments)
horoscope = get_horoscope(args.get("sign"))
# 4. Construct function_call_output item
# CRITICAL FIX: Use 'call_id' (snake_case) as the key
i = {
"type": "function_call_output",
"call_id": current_call_id,
"output": json.dumps({"horoscope": horoscope}),
}
input_list.append(i)
print("Final input:")
print(input_list)
print("\n\n")
response = client.responses.create(
model="gpt-4.1-mini",
# tools=tools,
input=input_list,
stream=True,
)
for chunk in response:
if chunk.type == "response.output_text.delta":
print(chunk.delta, end="", flush=True)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://mume.ai/api/v1",
});
// 1. Define callable tools
const tools = [
{
type: "function",
name: "get_horoscope",
description: "Get today's horoscope for an astrological sign.",
parameters: {
type: "object",
properties: {
sign: {
type: "string",
description: "An astrological sign like Taurus or Aquarius",
},
},
required: ["sign"],
},
},
];
// Your function implementation
function getHoroscope(sign) {
return `${sign}: Next Tuesday you will befriend a baby otter.`;
}
// Create input list
const inputList = [
{
type: "message",
role: "user",
content: "What is my horoscope? I am a Capricorn.",
},
];
// 2. Make initial request with tools
const stream = await client.responses.create({
model: "openai/gpt-4.1-mini",
tools: tools,
input: inputList,
stream: true,
});
let finalToolCalls = [];
for await (const chunk of stream) {
if (chunk.type === "response.output_text.delta") {
process.stdout.write(chunk.delta);
}
if (chunk.type === "response.completed") {
finalToolCalls = chunk.response.output;
}
}
// 3. Process function calls and execute functions
for (const item of finalToolCalls) {
if (item.type === "function_call") {
const callId = item.id || item.callId || item.call_id;
// Add the function call to input
inputList.push({
type: "function_call",
id: callId,
callId: callId,
name: item.name,
arguments: item.arguments,
});
// Execute the function
if (item.name === "get_horoscope") {
const args = JSON.parse(item.arguments);
const horoscope = getHoroscope(args.sign);
// 4. Add function result to input
inputList.push({
type: "function_call_output",
callId: callId,
id: callId,
output: JSON.stringify({horoscope: horoscope}),
});
}
}
}
// 5. Get final response with function results
const finalStream = await client.responses.create({
model: "openai/gpt-4.1-mini",
input: inputList,
stream: true,
});
for await (const chunk of finalStream) {
if (chunk.type === "response.output_text.delta") {
process.stdout.write(chunk.delta);
}
}
🌐 Web Search
Give your AI the power to search the web with the built-in web_search tool. Get real-time information, current events, and up-to-date data.
cURL
curl https://mume.ai/api/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MUME_API_KEY" \
-d '{
"model": "openai/gpt-4.1-mini",
"tools": [{"type": "web_search"}],
"input": "news story india today"
}'
Python
import openai
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
response = client.responses.create(
model="openai/gpt-4.1-mini",
tools=[{"type": "web_search"}],
input="news story india today",
)
print(response.output_text)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://mume.ai/api/v1",
});
const response = await client.responses.create({
model: "openai/gpt-4.1-mini",
tools: [{type: "web_search"}],
input: "news story india today",
});
console.log(response.output_text);
🤖 Available Models
Mume Gateway gives you access to models from the world’s leading AI providers. Simply use the provider/model format when specifying models.
| Provider | Example Models |
|---|---|
| OpenAI | openai/gpt-4.1-mini, openai/gpt-4.1-nano, openai/gpt-5.1 |
| Anthropic | anthropic/claude-opus-4.5 |
google/gemini-3-pro-preview |
|
| Mistral | mistralai/voxtral-small-24b-2507 |
| Moonshot | moonshotai/kimi-k2-thinking |
📖 Explore the full catalog: Mume AI Model Catalog
⚠️ Error Handling
Build robust applications with proper error handling:
Python
import openai
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
try:
response = client.chat.completions.create(
model="openai/gpt-4.1-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
except openai.APIConnectionError as e:
print(f"Connection error: {e}")
except openai.RateLimitError as e:
print(f"Rate limit exceeded: {e}")
except openai.APIStatusError as e:
print(f"API error: {e.status_code} - {e.message}")
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://mume.ai/api/v1",
});
try {
const response = await client.chat.completions.create({
model: "openai/gpt-4.1-mini",
messages: [{role: "user", content: "Hello!"}],
});
console.log(response.choices[0].message.content);
} catch (error) {
if (error instanceof OpenAI.APIConnectionError) {
console.error("Connection error:", error.message);
} else if (error instanceof OpenAI.RateLimitError) {
console.error("Rate limit exceeded:", error.message);
} else if (error instanceof OpenAI.APIError) {
console.error(`API error: ${error.status} - ${error.message}`);
} else {
throw error;
}
}
🔑 Generating an API Key
To use Mume Gateway, you’ll need an API key. Here’s how to get one:
Steps to Generate Your API Key
| Step | Action |
|---|---|
| 1 | Navigate to https://mume.ai/api |
| 2 | Sign in to your Mume account (or create one) |
| 3 | Click the “Generate API Key” button |
| 4 | Copy your key immediately and store it securely |
⚠️ Important Security Notes
- 🚫 Never share your API key publicly or commit it to version control
- 🚫 Never expose your API key in client-side code
- ✅ Store your API key in environment variables or a secure secrets manager
- 🔄 If you suspect your key has been compromised, revoke it immediately and generate a new one
Setting Up Your Environment Variable
Linux/macOS
export MUME_API_KEY="your-api-key-here"
To make it permanent, add to your shell configuration:
echo 'export MUME_API_KEY="your-api-key-here"' >> ~/.bashrc
source ~/.bashrc
Windows (Command Prompt)
set MUME_API_KEY=your-api-key-here
To make it permanent:
setx MUME_API_KEY "your-api-key-here"
Windows (PowerShell)
$env:MUME_API_KEY = "your-api-key-here"
To make it permanent:
[System.Environment]::SetEnvironmentVariable('MUME_API_KEY', 'your-api-key-here', 'User')
Using a .env File
Create a .env file in your project root:
MUME_API_KEY=your-api-key-here
Load it in Python (using python-dotenv):
from dotenv import load_dotenv
import os
load_dotenv()
api_key = os.getenv("MUME_API_KEY")
Load it in JavaScript (using dotenv):
import "dotenv/config";
const apiKey = process.env.MUME_API_KEY;
💡 Pro tip: Add
.envto your.gitignoreto prevent accidentally committing your API key!
Using the Environment Variable
Python
import os
import openai
client = openai.OpenAI(
api_key=os.environ.get("MUME_API_KEY"),
base_url="https://mume.ai/api/v1",
)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.MUME_API_KEY,
baseURL: "https://mume.ai/api/v1",
});
cURL
curl https://mume.ai/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MUME_API_KEY" \
-d '{
"model": "openai/gpt-4.1-mini",
"messages": [{"role": "user", "content": "Hello!"}]
}'
💡 Support
| Resource | Link |
|---|---|
| 📚 Model Catalog | https://mume.ai/chat_models |
| 🔗 API Base URL | https://mume.ai/api/v1 |
| 🔑 Get API Key | https://mume.ai/api |
Built with ❤️ by the Mume team
One API. Every model. Unlimited possibilities.
