Overview
One API key gives you Qwen, DeepSeek and GLM models through OpenAI-compatible endpoints. Requests and responses use JSON; streaming uses server-sent events. All traffic is over HTTPS.
| Endpoint | Method | Purpose |
|---|---|---|
/v1/chat/completions | POST | Chat and reasoning, with optional streaming |
/v1/models | GET | Models enabled for your key |
/v1/embeddings | POST | Vector embeddings for search and RAG |
Quickstart
Install the official OpenAI SDK for your language (pip install openai or npm install openai), set AAX_API_KEY, and send your first request.
curl https://api.aaronalphax.com/v1/chat/completions \
-H "Authorization: Bearer $AAX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-plus",
"messages": [
{"role": "system", "content": "Be concise."},
{"role": "user", "content": "Summarise Q3 in Arabic."}
]
}'# pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://api.aaronalphax.com/v1",
api_key="YOUR_AAX_API_KEY",
)
resp = client.chat.completions.create(
model="qwen-plus", # switch models by changing one parameter
messages=[{"role": "user", "content": "Hello from Dubai"}],
)
print(resp.choices[0].message.content)// npm install openai
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.aaronalphax.com/v1",
apiKey: process.env.AAX_API_KEY,
});
const resp = await client.chat.completions.create({
model: "qwen-plus",
messages: [{ role: "user", content: "Hello from Singapore" }],
});
console.log(resp.choices[0].message.content);Authentication
Authenticate every request with your API key as a Bearer token. Keys are issued per team or application so usage can be metered and reported per key. Keep keys server-side; never ship them in browser or mobile code.
curl https://api.aaronalphax.com/v1/models \
-H "Authorization: Bearer $AAX_API_KEY"import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.aaronalphax.com/v1",
api_key=os.environ["AAX_API_KEY"],
)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.aaronalphax.com/v1",
apiKey: process.env.AAX_API_KEY,
});Chat completions
Generates a model response for a conversation. Switch providers by changing the model field only.
Request body
| Field | Type | Description |
|---|---|---|
model | string, required | Model ID from the catalog, e.g. qwen-plus. |
messages | array, required | Conversation turns: objects with role (system, user, assistant, tool) and content. |
stream | boolean | If true, tokens are sent as server-sent events ending with data: [DONE]. |
temperature | number | Sampling temperature. Lower is more deterministic. |
top_p | number | Nucleus sampling cut-off. |
max_tokens | integer | Upper bound on generated tokens. |
stop | string | array | Sequences where generation stops. |
tools, tool_choice | array, string | object | Function calling, on models that list it in the catalog. |
response_format | object | {"type": "json_object"} for JSON output, on models that support structured output. |
Parameter support varies by upstream model; unsupported parameters return 400.
Example
curl https://api.aaronalphax.com/v1/chat/completions \
-H "Authorization: Bearer $AAX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-plus",
"messages": [
{"role": "system", "content": "Be concise."},
{"role": "user", "content": "Summarise Q3 in Arabic."}
]
}'# pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://api.aaronalphax.com/v1",
api_key="YOUR_AAX_API_KEY",
)
resp = client.chat.completions.create(
model="qwen-plus", # switch models by changing one parameter
messages=[{"role": "user", "content": "Hello from Dubai"}],
)
print(resp.choices[0].message.content)// npm install openai
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.aaronalphax.com/v1",
apiKey: process.env.AAX_API_KEY,
});
const resp = await client.chat.completions.create({
model: "qwen-plus",
messages: [{ role: "user", content: "Hello from Singapore" }],
});
console.log(resp.choices[0].message.content);Response
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1793500000,
"model": "qwen-plus",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Here is a summary…" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 42, "completion_tokens": 128, "total_tokens": 170 }
}Streaming
Set "stream": true to receive tokens as they are generated. Each event is a chat.completion.chunk object on a data: line; the stream ends with data: [DONE].
curl -N https://api.aaronalphax.com/v1/chat/completions \
-H "Authorization: Bearer $AAX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek-v4-pro", "stream": true,
"messages": [{"role": "user", "content": "Explain token metering"}]}'stream = client.chat.completions.create(
model="deepseek-v4-pro",
messages=[{"role": "user", "content": "Explain token metering"}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)const stream = await client.chat.completions.create({
model: "deepseek-v4-pro",
messages: [{ role: "user", content: "Explain token metering" }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}Event stream
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","model":"deepseek-v4-pro","choices":[{"index":0,"delta":{"role":"assistant","content":"Token"},"finish_reason":null}]}
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","model":"deepseek-v4-pro","choices":[{"index":0,"delta":{"content":" metering"},"finish_reason":null}]}
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","model":"deepseek-v4-pro","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]List models
Returns the models enabled for your key. Use these IDs in the model field.
curl https://api.aaronalphax.com/v1/models \
-H "Authorization: Bearer $AAX_API_KEY"for m in client.models.list():
print(m.id)const list = await client.models.list();
for (const m of list.data) console.log(m.id);{
"object": "list",
"data": [
{ "id": "qwen-plus", "object": "model", "owned_by": "..." },
{ "id": "deepseek-v4-pro", "object": "model", "owned_by": "..." },
{ "id": "glm-5.3", "object": "model", "owned_by": "..." }
]
}Embeddings
Converts text into vectors for semantic search, clustering and retrieval-augmented generation. input accepts a string or an array of strings.
curl https://api.aaronalphax.com/v1/embeddings \
-H "Authorization: Bearer $AAX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "text-embedding-v4",
"input": ["Dubai logistics FAQ", "Singapore returns policy"]}'resp = client.embeddings.create(
model="text-embedding-v4",
input=["Dubai logistics FAQ", "Singapore returns policy"],
)
vectors = [d.embedding for d in resp.data]const resp = await client.embeddings.create({
model: "text-embedding-v4",
input: ["Dubai logistics FAQ", "Singapore returns policy"],
});
const vectors = resp.data.map((d) => d.embedding);Errors
Errors use standard HTTP status codes and an OpenAI-style JSON body, so the official SDKs raise their usual exception types.
{
"error": {
"message": "Invalid API key provided.",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}| HTTP | Meaning | What to do |
|---|---|---|
| 400 | Malformed request or unsupported parameter for this model | Fix the request body; check the model's capabilities. |
| 401 | Missing or invalid API key | Send Authorization: Bearer <key> with an active key. |
| 403 | Key not permitted for this model, or balance/quota exhausted | Contact us to enable the model or top up. |
| 404 | Unknown model or path | Check the model ID with GET /v1/models. |
| 429 | Rate limit or concurrency limit reached | Back off and retry with jitter. |
| 500 / 502 / 503 | Gateway or upstream provider error | Retry with exponential backoff; persistent errors go to sales@aaronalphax.com. |
Rate limits
Limits are applied per API key — requests per minute and concurrent requests — and are set in your contract to match your reserved capacity. When a limit is reached the gateway returns 429. Retry with exponential backoff and jitter, and contact us before a planned traffic spike so capacity can be reserved.
import time, random
from openai import OpenAI, RateLimitError, APIStatusError
def complete_with_retry(client, **kwargs):
for attempt in range(5):
try:
return client.chat.completions.create(**kwargs)
except RateLimitError:
time.sleep(min(2 ** attempt + random.random(), 30)) # back off on 429
except APIStatusError as e:
if e.status_code < 500:
raise
time.sleep(min(2 ** attempt + random.random(), 30)) # retry 5xx
raise RuntimeError("gateway unavailable after retries")Support
Integration questions, limit increases and new model requests: sales@aaronalphax.com. The strategy desk responds within 24 hours. Multilingual onboarding is available.