from openai import OpenAIimport os# 💥 Create an OpenAI client, pointed at Munaopenai = OpenAI( api_key=os.environ["MUNA_API_KEY"], base_url="https://inference.muna.ai/v1")# 🔥 Create a chat completioncompletion = openai.chat.completions.create( model="@qwen/qwen-3.8-27b", messages=[{ "role": "user", "content": "What is the capital of France?" }])# 🚀 Print the resultprint(completion.choices[0].message)
import OpenAI from "openai"// 💥 Create an OpenAI client, pointed at Munaconst openai = new OpenAI({ apiKey: process.env.MUNA_API_KEY, baseURL: "https://inference.muna.ai/v1"});// 🔥 Create a chat completionconst completion = await openai.chat.completions.create({ model: "@qwen/qwen-3.8-27b", messages: [{ role: "user", content: "What is the capital of France?" }]});// 🚀 Print the resultconsole.log(completion.choices[0]);
# 🔥 Stream a chat completionstream = openai.chat.completions.create( model="@qwen/qwen-3.8-27b", messages=[{ "role": "user", "content": "What is life?" }], stream=True)# 🚀 Use completion chunksfor chunk in stream: ...
curl https://inference.muna.ai/v1/chat/completions \ -H "Authorization: Bearer $MUNA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "@qwen/qwen-3.8-27b", "messages": [{ "role": "user", "content": "What is the capital of France?" }] }'
{ "id": "chatcmpl-6f1c2b9e-4d3a-4b8e-9c1f-2a7d5e8b0c34", "object": "chat.completion", "created": 1791516000, "model": "@qwen/qwen-3.8-27b", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The capital of France is Paris." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 16, "completion_tokens": 8, "total_tokens": 24, "prompt_tokens_details": { "cached_tokens": 0 } }}
OpenAI
Create a Chat Completion
POST
/
v1
/
chat
/
completions
from openai import OpenAIimport os# 💥 Create an OpenAI client, pointed at Munaopenai = OpenAI( api_key=os.environ["MUNA_API_KEY"], base_url="https://inference.muna.ai/v1")# 🔥 Create a chat completioncompletion = openai.chat.completions.create( model="@qwen/qwen-3.8-27b", messages=[{ "role": "user", "content": "What is the capital of France?" }])# 🚀 Print the resultprint(completion.choices[0].message)
import OpenAI from "openai"// 💥 Create an OpenAI client, pointed at Munaconst openai = new OpenAI({ apiKey: process.env.MUNA_API_KEY, baseURL: "https://inference.muna.ai/v1"});// 🔥 Create a chat completionconst completion = await openai.chat.completions.create({ model: "@qwen/qwen-3.8-27b", messages: [{ role: "user", content: "What is the capital of France?" }]});// 🚀 Print the resultconsole.log(completion.choices[0]);
# 🔥 Stream a chat completionstream = openai.chat.completions.create( model="@qwen/qwen-3.8-27b", messages=[{ "role": "user", "content": "What is life?" }], stream=True)# 🚀 Use completion chunksfor chunk in stream: ...
curl https://inference.muna.ai/v1/chat/completions \ -H "Authorization: Bearer $MUNA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "@qwen/qwen-3.8-27b", "messages": [{ "role": "user", "content": "What is the capital of France?" }] }'
{ "id": "chatcmpl-6f1c2b9e-4d3a-4b8e-9c1f-2a7d5e8b0c34", "object": "chat.completion", "created": 1791516000, "model": "@qwen/qwen-3.8-27b", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The capital of France is Paris." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 16, "completion_tokens": 8, "total_tokens": 24, "prompt_tokens_details": { "cached_tokens": 0 } }}
Creates a chat completion. Pass stream: true to stream the completion as server-sent events.
from openai import OpenAIimport os# 💥 Create an OpenAI client, pointed at Munaopenai = OpenAI( api_key=os.environ["MUNA_API_KEY"], base_url="https://inference.muna.ai/v1")# 🔥 Create a chat completioncompletion = openai.chat.completions.create( model="@qwen/qwen-3.8-27b", messages=[{ "role": "user", "content": "What is the capital of France?" }])# 🚀 Print the resultprint(completion.choices[0].message)
import OpenAI from "openai"// 💥 Create an OpenAI client, pointed at Munaconst openai = new OpenAI({ apiKey: process.env.MUNA_API_KEY, baseURL: "https://inference.muna.ai/v1"});// 🔥 Create a chat completionconst completion = await openai.chat.completions.create({ model: "@qwen/qwen-3.8-27b", messages: [{ role: "user", content: "What is the capital of France?" }]});// 🚀 Print the resultconsole.log(completion.choices[0]);
# 🔥 Stream a chat completionstream = openai.chat.completions.create( model="@qwen/qwen-3.8-27b", messages=[{ "role": "user", "content": "What is life?" }], stream=True)# 🚀 Use completion chunksfor chunk in stream: ...
curl https://inference.muna.ai/v1/chat/completions \ -H "Authorization: Bearer $MUNA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "@qwen/qwen-3.8-27b", "messages": [{ "role": "user", "content": "What is the capital of France?" }] }'
{ "id": "chatcmpl-6f1c2b9e-4d3a-4b8e-9c1f-2a7d5e8b0c34", "object": "chat.completion", "created": 1791516000, "model": "@qwen/qwen-3.8-27b", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The capital of France is Paris." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 16, "completion_tokens": 8, "total_tokens": 24, "prompt_tokens_details": { "cached_tokens": 0 } }}