from anthropic import Anthropic
import os
# π₯ Create an Anthropic client, pointed at Muna
anthropic = Anthropic(
api_key=os.environ["MUNA_API_KEY"],
base_url="https://inference.muna.ai"
)
# π₯ Create a message
message = anthropic.messages.create(
model="@qwen/qwen-3.8-27b",
max_tokens=1024,
messages=[{ "role": "user", "content": "What is the capital of France?" }]
)
# π Print the result
print(message.content[0].text)
import Anthropic from "@anthropic-ai/sdk"
// π₯ Create an Anthropic client, pointed at Muna
const anthropic = new Anthropic({
apiKey: process.env.MUNA_API_KEY,
baseURL: "https://inference.muna.ai"
});
// π₯ Create a message
const message = await anthropic.messages.create({
model: "@qwen/qwen-3.8-27b",
max_tokens: 1024,
messages: [{ role: "user", content: "What is the capital of France?" }]
});
// π Print the result
console.log(message.content[0].text);
# π₯ Stream a message
with anthropic.messages.stream(
model="@qwen/qwen-3.8-27b",
max_tokens=1024,
messages=[{ "role": "user", "content": "What is life?" }]
) as stream:
# π Use text deltas
for text in stream.text_stream:
...
curl https://inference.muna.ai/v1/messages \
-H "x-api-key: $MUNA_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "@qwen/qwen-3.8-27b",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "What is the capital of France?" }]
}'
{
"id": "msg_6f1c2b9e4d3a4b8e9c1f2a7d",
"type": "message",
"role": "assistant",
"model": "@qwen/qwen-3.8-27b",
"content": [
{ "type": "text", "text": "The capital of France is Paris." }
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 16,
"output_tokens": 8,
"cache_read_input_tokens": 0
}
}
Anthropic
Create a Message
POST
/
v1
/
messages
from anthropic import Anthropic
import os
# π₯ Create an Anthropic client, pointed at Muna
anthropic = Anthropic(
api_key=os.environ["MUNA_API_KEY"],
base_url="https://inference.muna.ai"
)
# π₯ Create a message
message = anthropic.messages.create(
model="@qwen/qwen-3.8-27b",
max_tokens=1024,
messages=[{ "role": "user", "content": "What is the capital of France?" }]
)
# π Print the result
print(message.content[0].text)
import Anthropic from "@anthropic-ai/sdk"
// π₯ Create an Anthropic client, pointed at Muna
const anthropic = new Anthropic({
apiKey: process.env.MUNA_API_KEY,
baseURL: "https://inference.muna.ai"
});
// π₯ Create a message
const message = await anthropic.messages.create({
model: "@qwen/qwen-3.8-27b",
max_tokens: 1024,
messages: [{ role: "user", content: "What is the capital of France?" }]
});
// π Print the result
console.log(message.content[0].text);
# π₯ Stream a message
with anthropic.messages.stream(
model="@qwen/qwen-3.8-27b",
max_tokens=1024,
messages=[{ "role": "user", "content": "What is life?" }]
) as stream:
# π Use text deltas
for text in stream.text_stream:
...
curl https://inference.muna.ai/v1/messages \
-H "x-api-key: $MUNA_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "@qwen/qwen-3.8-27b",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "What is the capital of France?" }]
}'
{
"id": "msg_6f1c2b9e4d3a4b8e9c1f2a7d",
"type": "message",
"role": "assistant",
"model": "@qwen/qwen-3.8-27b",
"content": [
{ "type": "text", "text": "The capital of France is Paris." }
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 16,
"output_tokens": 8,
"cache_read_input_tokens": 0
}
}
Creates a message. Pass
stream: true to stream the message as server-sent events.
from anthropic import Anthropic
import os
# π₯ Create an Anthropic client, pointed at Muna
anthropic = Anthropic(
api_key=os.environ["MUNA_API_KEY"],
base_url="https://inference.muna.ai"
)
# π₯ Create a message
message = anthropic.messages.create(
model="@qwen/qwen-3.8-27b",
max_tokens=1024,
messages=[{ "role": "user", "content": "What is the capital of France?" }]
)
# π Print the result
print(message.content[0].text)
import Anthropic from "@anthropic-ai/sdk"
// π₯ Create an Anthropic client, pointed at Muna
const anthropic = new Anthropic({
apiKey: process.env.MUNA_API_KEY,
baseURL: "https://inference.muna.ai"
});
// π₯ Create a message
const message = await anthropic.messages.create({
model: "@qwen/qwen-3.8-27b",
max_tokens: 1024,
messages: [{ role: "user", content: "What is the capital of France?" }]
});
// π Print the result
console.log(message.content[0].text);
# π₯ Stream a message
with anthropic.messages.stream(
model="@qwen/qwen-3.8-27b",
max_tokens=1024,
messages=[{ "role": "user", "content": "What is life?" }]
) as stream:
# π Use text deltas
for text in stream.text_stream:
...
curl https://inference.muna.ai/v1/messages \
-H "x-api-key: $MUNA_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "@qwen/qwen-3.8-27b",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "What is the capital of France?" }]
}'
{
"id": "msg_6f1c2b9e4d3a4b8e9c1f2a7d",
"type": "message",
"role": "assistant",
"model": "@qwen/qwen-3.8-27b",
"content": [
{ "type": "text", "text": "The capital of France is Paris." }
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 16,
"output_tokens": 8,
"cache_read_input_tokens": 0
}
}
Body
Extended thinking configuration:
{ "type": "disabled" }, { "type": "enabled", "budget_tokens": N },
or { "type": "adaptive" }. Mapped onto the modelβs reasoning effort.