API docs
One endpoint, two SDK shapes. Point the client you already use at a base URL below, swap in a XenWay key, pick a model.
Quickstart
Keep the key in an environment variable. Never hardcode it in code that goes to a public repository.
export XENWAY_API_KEY="xw_xxxxxxxx"
curl https://xenway.axtra.tech/v1/chat/completions \
-H "Authorization: Bearer $XENWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.3-flash",
"messages": [{"role": "user", "content": "Hi!"}],
"max_tokens": 1024
}'import os
from openai import OpenAI
client = OpenAI(
base_url="https://xenway.axtra.tech/v1",
api_key=os.environ["XENWAY_API_KEY"],
)
res = client.chat.completions.create(
model="deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Hi!"}],
max_tokens=1024,
)
print(res.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://xenway.axtra.tech/v1",
apiKey: process.env.XENWAY_API_KEY,
});
const stream = await client.chat.completions.create({
model: "glm-5.3-flash",
messages: [{ role: "user", content: "Hi!" }],
stream: true,
});
for await (const chunk of stream) {
const text = chunk.choices[0]?.delta?.content;
if (text) process.stdout.write(text);
}Anthropic compatible
XenWay also speaks the Anthropic Messages shape at /v1/messages. Point the Anthropic SDK at the bare origin, without /v1, since the SDK appends it.
import os
from anthropic import Anthropic
client = Anthropic(
base_url="https://xenway.axtra.tech",
api_key=os.environ["XENWAY_API_KEY"],
)
msg = client.messages.create(
model="glm-5.3-flash",
max_tokens=1024,
messages=[{"role": "user", "content": "Hi!"}],
)
print(msg.content[0].text)import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://xenway.axtra.tech",
apiKey: process.env.XENWAY_API_KEY,
});
const msg = await client.messages.create({
model: "glm-5.3-flash",
max_tokens: 1024,
messages: [{ role: "user", content: "Hi!" }],
});
console.log(msg.content[0].text);curl https://xenway.axtra.tech/v1/messages \
-H "x-api-key: ***" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.3-flash",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hi!"}]
}'Endpoint
What you need day to day. /v1/models needs no key, so it is handy for checking what is available.
| Method | Path | Purpose |
|---|---|---|
| GET | /v1/models | Available models |
| POST | /v1/chat/completions | Full or streamed answer (OpenAI) |
| POST | /v1/messages | Full or streamed answer (Anthropic) |
| POST | /v1/messages/count_tokens | Estimated prompt tokens |
| GET | /api/keys | Your key: prefix, usage, remaining rate |
Models
Use the ID column exactly as written.
| Name | ID | Context | Max output |
|---|---|---|---|
| GLM 5.3 Flash | glm-5.3-flash | 1,048,576 | 128,000 |
| DeepSeek V4.1 Flash | deepseek-v4.1-flash | 1,048,576 | 384,000 |
| DeepSeek V4.1 Flash 1017 | deepseek-v4.1-flash-1017 | 1,048,576 | 384,000 |
| Qwen3.8 27B FP8 | qwen3.8-27b-fp8 | 262,144 | 262,143 |
| Nemotron 3.5 Super VL 120B | nemotron-3.5-super-vl-120b | 1,048,576 | 128,000 |
Rate limits & errors
Each key allows 20 requests per minute. Past that, the server answers 429.
| Status | Meaning | What to do |
|---|---|---|
| 401 | Key is invalid or revoked | Issue a new key from the panel |
| 400 | Body is not JSON, messages is empty, or the model is unknown | Fix the request body |
| 429 | Per-minute limit reached | Wait for Retry-After |
| 502 | Provider did not answer, or sent broken data | Retry after a short backoff |
| 503 | No provider key is ready (pool empty or all cooling down) | Wait out the rotation window (about 90s), then retry |
Things to know
max_tokens is a budget
On reasoning models, thinking tokens count as output. Too small a budget gets spent on reasoning and the answer comes back empty.
Do not blind-retry
If the connection drops after the request went out, usage may still be recorded. Check remaining rate at /api/keys before sending again.
Availability is shared
Capacity is pooled. Handle errors on your side and do not put work that must never fail behind a single key.