XenWayAI gateway
Reference

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.

Base URL
https://xenway.axtra.tech/v1
OpenAI · ends with /v1
https://xenway.axtra.tech
Anthropic · no /v1
Auth
Bearer xw_…
Authorization header
x-api-key: ***
Anthropic style
Models
5
see table below
Rate limit
20
requests / min / key

Quickstart

Keep the key in an environment variable. Never hardcode it in code that goes to a public repository.

Shell
export XENWAY_API_KEY="xw_xxxxxxxx"
cURL · first request
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
  }'
Python
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)
JavaScript · streaming
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.

Python · SDK Anthropic
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)
JavaScript · SDK Anthropic
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 · x-api-key
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!"}]
  }'
Text blocks only. Image, tool_use, and tool_result blocks are rejected with a clear error instead of being half-forwarded. /v1/messages/count_tokens exists but returns an estimate (roughly 4 characters per token).

Endpoint

What you need day to day. /v1/models needs no key, so it is handy for checking what is available.

MethodPathPurpose
GET/v1/modelsAvailable models
POST/v1/chat/completionsFull or streamed answer (OpenAI)
POST/v1/messagesFull or streamed answer (Anthropic)
POST/v1/messages/count_tokensEstimated prompt tokens
GET/api/keysYour key: prefix, usage, remaining rate

Models

Use the ID column exactly as written.

NameIDContextMax output
GLM 5.3 Flashglm-5.3-flash1,048,576128,000
DeepSeek V4.1 Flashdeepseek-v4.1-flash1,048,576384,000
DeepSeek V4.1 Flash 1017deepseek-v4.1-flash-10171,048,576384,000
Qwen3.8 27B FP8qwen3.8-27b-fp8262,144262,143
Nemotron 3.5 Super VL 120Bnemotron-3.5-super-vl-120b1,048,576128,000

Rate limits & errors

Each key allows 20 requests per minute. Past that, the server answers 429.

StatusMeaningWhat to do
401Key is invalid or revokedIssue a new key from the panel
400Body is not JSON, messages is empty, or the model is unknownFix the request body
429Per-minute limit reachedWait for Retry-After
502Provider did not answer, or sent broken dataRetry after a short backoff
503No provider key is ready (pool empty or all cooling down)Wait out the rotation window (about 90s), then retry
Every 200 carries x-ratelimit-limit, x-ratelimit-used, x-ratelimit-remaining, and x-ratelimit-reset (epoch seconds). Use them to pace yourself before hitting 429.

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.