Text
OpenAI-compatible chat completions, completions, and responses, with streaming. Embeddings on their own page.
Last reviewed 2026-08-25
Create a chat completion
Use the OpenAI SDK with base_url set to https://api.mserve.ai/openai/v1.
from openai import OpenAI
client = OpenAI(base_url="https://api.mserve.ai/openai/v1", api_key="ms_live_your_key")
response = client.chat.completions.create(
model="qwen3.8-27b",
messages=[
{"role": "system", "content": "Be brief."},
{"role": "user", "content": "Write one sentence about GPUs."},
],
temperature=0.2,
max_tokens=64,
)
print(response.choices[0].message.content)Stream tokens
Set stream to true. Chunks arrive as server-sent events. With stream_options.include_usage, the final chunk carries usage and an empty choices list.
stream = client.chat.completions.create(
model="qwen3.8-27b",
messages=[{"role": "user", "content": "Count to five."}],
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices:
print(chunk.choices[0].delta.content or "", end="")
if chunk.usage:
print("\ntokens:", chunk.usage.total_tokens)Thinking
qwen3.8-27b thinks by default. Reasoning tokens are billed as output tokens. Turn thinking off for latency with reasoning_effort: "minimal", the same field the Realtime API uses.
response = client.chat.completions.create(model="qwen3.8-27b", messages=msgs, reasoning_effort="minimal")Completions and responses
POST /openai/v1/completions and POST /openai/v1/responses work the same way. Responses covers text in, text out, and streaming. Stateful features return 400 (see Compatibility).
r = client.responses.create(model="qwen3.8-27b", input="Write one sentence about GPUs.")
print(r.output_text)Models
GET /openai/v1/models lists the text and embedding models. With xi-api-key auth the same path returns the ElevenLabs models list.
Supported parameters
Rejected parameters per route are on Compatibility.
Prop
Type
Capacity errors
Pricing
| Model | Model id | Input per 1M tokens | Output per 1M tokens |
|---|---|---|---|
| Qwen3.8 27B | qwen3.8-27b | $0.30 | $2.50 |