The API follows the OpenAI chat completions specification. If your code already talks to OpenAI, it talks to us after changing the base URL.
Install the OpenAI client for your language, point it at our base URL, and pass the API key we issued you. Nothing else in your integration changes.
pip install openai from openai import OpenAI client = OpenAI( base_url="https://api.aiqre.com/v1", api_key="aiq-...", ) resp = client.chat.completions.create( model="your-model", messages=[{"role": "user", "content": "Explain quantisation in one sentence."}], ) print(resp.choices[0].message.content)
Replace your-model with an id from the
model catalogue. Model ids are stable —
we do not silently repoint an id at different weights.
Pass your key as a bearer token on every request. Keys are issued to a named contact on request; there is no self-service sign-up.
Authorization: Bearer aiq-...
Keep the key server-side. Anything holding it can spend against your account. If a key is exposed, tell us and we will revoke and reissue immediately.
https://api.aiqre.com/v1
All endpoints are relative to this. TLS is required; plaintext HTTP is refused.
POST/chat/completions
Generates a response for a conversation.
{
"model": "your-model",
"messages": [
{"role": "system", "content": "You are concise."},
{"role": "user", "content": "Hello"}
],
"temperature": 0.7,
"max_tokens": 512
}
{
"id": "chatcmpl-...",
"object": "chat.completion",
"created": 1767225600,
"model": "your-model",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "Hello."},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 18,
"completion_tokens": 2,
"total_tokens": 20
}
}
Set "stream": true to receive tokens as they are generated, over server-sent
events. Each event is a JSON chunk; the stream ends with data: [DONE].
data: {"id":"chatcmpl-...","choices":[{"delta":{"content":"Hel"},"index":0}]}
data: {"id":"chatcmpl-...","choices":[{"delta":{"content":"lo"},"index":0}]}
data: {"id":"chatcmpl-...","choices":[{"delta":{},"index":0,"finish_reason":"stop"}]}
data: [DONE]
Long prompts take time to process before the first token appears. We send SSE keep-alive comments during that window, so do not treat a quiet period as a dropped connection.
Token usage is returned on streaming responses too, in the final chunk.
GET/models
Returns everything currently available, with pricing and capabilities. This endpoint is public and needs no authentication.
curl https://api.aiqre.com/v1/models
Each entry includes the id you call, the upstream source repository, context length, supported parameters and per-token pricing. The source repository is listed so you can verify exactly which weights are behind an id, and check the model's own licence.
| Parameter | Type | Description |
|---|---|---|
| model | string | Required. An id from the catalogue. |
| messages | array | Required. Objects with role and content. |
| stream | boolean | Stream the response over SSE. Defaults to false. |
| max_tokens | integer | Upper bound on generated tokens. |
| temperature | number | Higher is more random, lower more deterministic. |
| top_p | number | Nucleus sampling threshold. |
| top_k | integer | Restrict sampling to the k most likely tokens. |
| stop | string / array | Sequences that end generation. |
| seed | integer | Best-effort reproducibility across identical requests. |
| frequency_penalty | number | Discourage repeated tokens. |
| presence_penalty | number | Discourage repeating topics already present. |
| response_format | object | Request JSON output where the model supports it. |
Not every model accepts every parameter. The supported_parameters field in the
catalogue lists what each one takes; unsupported parameters are ignored rather than rejected.
Every response carries a usage object with prompt_tokens,
completion_tokens and total_tokens. Billing is based on these,
and they are the same numbers that appear on your invoice.
Input and output are priced separately, so a long prompt with a short answer costs differently from the reverse. Per-model rates are in the catalogue.
Errors use standard HTTP status codes with a JSON body.
{
"error": {
"message": "Model not found: typo-model",
"type": "invalid_request_error",
"code": "model_not_found"
}
}
| Status | Meaning | What to do |
|---|---|---|
| 400 | Malformed request | Check the body against the parameter table. |
| 401 | Missing or invalid key | Check the Authorization header. |
| 404 | Unknown model id | Check against the catalogue. |
| 413 | Prompt exceeds context | Shorten the prompt or use a longer-context model. |
| 429 | Rate limited | Back off and retry; see below. |
| 500 | Error on our side | Safe to retry. Tell us if it persists. |
| 503 | Model loading or capacity reached | Retry shortly. |
Retry 429, 500 and 503 with exponential backoff and jitter. Do not retry 400, 401 or 404 — they will fail identically.
Limits are set per account, sized to the volume you told us about, and we will raise them on request rather than leave you throttled. Exceeding a limit returns 429.
A model that has not been called recently may need loading before it answers, which shows up as a slower first request or a brief 503. Frequently used models stay resident.
from openai import OpenAI client = OpenAI(base_url="https://api.aiqre.com/v1", api_key="aiq-...") stream = client.chat.completions.create( model="your-model", messages=[{"role": "user", "content": "Hi"}], stream=True, ) for chunk in stream: print(chunk.choices[0].delta.content or "", end="")
import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.aiqre.com/v1", apiKey: process.env.AIQRE_API_KEY, }); const stream = await client.chat.completions.create({ model: "your-model", messages: [{ role: "user", content: "Hi" }], stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); }
curl https://api.aiqre.com/v1/chat/completions \ -H "Authorization: Bearer $AIQRE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "your-model", "messages": [{"role": "user", "content": "Hello"}], "stream": true }'
Something missing or wrong here? Tell us at hello@aiqre.com and we will fix it.