Create a key and send your first request to an open model on Munito AI, with cURL, Python or TypeScript.
- Open API keys in the console.
- Create a key with the Inference permission, and copy it. The console shows it one time only.
- Run one of the scripts below. Put your key in place of
munitoai_....
OpenAI Chat Completions API
Each tab is a complete script for an empty folder. It installs the client, sends one request and prints the answer.
# Needs curl. Create the key at https://console.munito.ai/keys.
export MUNITO_API_KEY="munitoai_..."
curl -sS --fail-with-body https://api.munito.ai/inference/v1/chat/completions \
-H "Authorization: Bearer $MUNITO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen/qwen3.8-27b",
"messages": [{"role": "user", "content": "Say hello in one sentence."}],
"max_tokens": 1024
}'# Needs Python 3.9 or later. Make a project and install the OpenAI client.
mkdir munito-quickstart && cd munito-quickstart
python3 -m venv .venv && . .venv/bin/activate
pip install --quiet openai
# Create the key at https://console.munito.ai/keys.
export MUNITO_API_KEY="munitoai_..."
cat > main.py <<'EOF'
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.munito.ai/inference/v1",
api_key=os.environ["MUNITO_API_KEY"],
)
response = client.chat.completions.create(
model="qwen/qwen3.8-27b",
messages=[{"role": "user", "content": "Say hello in one sentence."}],
max_tokens=1024,
)
print(response.choices[0].message.content)
EOF
python main.py# Needs Node.js 22.18 or later, which runs TypeScript files. Make a project and install the OpenAI client.
mkdir munito-quickstart && cd munito-quickstart
npm init -y --silent >/dev/null && npm pkg set type=module
npm install --silent openai
# Create the key at https://console.munito.ai/keys.
export MUNITO_API_KEY="munitoai_..."
cat > main.ts <<'EOF'
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.munito.ai/inference/v1",
apiKey: process.env.MUNITO_API_KEY,
});
const response = await client.chat.completions.create({
model: "qwen/qwen3.8-27b",
messages: [{ role: "user", content: "Say hello in one sentence." }],
max_tokens: 1024,
});
console.log(response.choices[0].message.content);
EOF
node main.tsExpected output
The script prints the answer of the model, such as Hello! It is nice to meet you. The cURL script prints the JSON body, with the answer in choices[0].message.content.
Anthropic Messages API
The same key works with the Anthropic API. The Anthropic client adds /v1/messages itself, so its base URL ends with /inference.
# Needs curl. Create the key at https://console.munito.ai/keys.
export MUNITO_API_KEY="munitoai_..."
curl -sS --fail-with-body https://api.munito.ai/inference/v1/messages \
-H "X-API-Key: $MUNITO_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen/qwen3.8-27b",
"messages": [{"role": "user", "content": "Say hello in one sentence."}],
"max_tokens": 1024
}'# Needs Python 3.9 or later. Make a project and install the Anthropic client.
mkdir munito-quickstart && cd munito-quickstart
python3 -m venv .venv && . .venv/bin/activate
pip install --quiet anthropic
# Create the key at https://console.munito.ai/keys.
export MUNITO_API_KEY="munitoai_..."
cat > main.py <<'EOF'
import os
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.munito.ai/inference",
api_key=os.environ["MUNITO_API_KEY"],
)
response = client.messages.create(
model="qwen/qwen3.8-27b",
messages=[{"role": "user", "content": "Say hello in one sentence."}],
max_tokens=1024,
)
print("".join(block.text for block in response.content if block.type == "text"))
EOF
python main.py# Needs Node.js 22.18 or later, which runs TypeScript files. Make a project and install the Anthropic client.
mkdir munito-quickstart && cd munito-quickstart
npm init -y --silent >/dev/null && npm pkg set type=module
npm install --silent @anthropic-ai/sdk
# Create the key at https://console.munito.ai/keys.
export MUNITO_API_KEY="munitoai_..."
cat > main.ts <<'EOF'
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.munito.ai/inference",
apiKey: process.env.MUNITO_API_KEY,
});
const response = await client.messages.create({
model: "qwen/qwen3.8-27b",
messages: [{ role: "user", content: "Say hello in one sentence." }],
max_tokens: 1024,
});
console.log(response.content.map((block) => (block.type === "text" ? block.text : "")).join(""));
EOF
node main.tsExpected output
The script prints the answer of the model. The cURL script prints the JSON body, with the answer in the text block of content.
Next
- Models: choose a model, and put its ID in place of
qwen/qwen3.8-27b. - Compatibility: move an app from the OpenAI or Anthropic SDK.
- Regions: keep processing in the EU or the US.
- Errors and rate limits: what to do when a request fails.