Aiqre

API documentation

The API follows the OpenAI chat completions specification. If your code already talks to OpenAI, it talks to us after changing the base URL.

Quickstart

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.

Authentication

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.

Base URL

https://api.aiqre.com/v1

All endpoints are relative to this. TLS is required; plaintext HTTP is refused.

Chat completions

POST/chat/completions

Generates a response for a conversation.

Request

{
  "model": "your-model",
  "messages": [
    {"role": "system", "content": "You are concise."},
    {"role": "user", "content": "Hello"}
  ],
  "temperature": 0.7,
  "max_tokens": 512
}

Response

{
  "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
  }
}

Streaming

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.

Models

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.

Parameters

ParameterTypeDescription
modelstringRequired. An id from the catalogue.
messagesarrayRequired. Objects with role and content.
streambooleanStream the response over SSE. Defaults to false.
max_tokensintegerUpper bound on generated tokens.
temperaturenumberHigher is more random, lower more deterministic.
top_pnumberNucleus sampling threshold.
top_kintegerRestrict sampling to the k most likely tokens.
stopstring / arraySequences that end generation.
seedintegerBest-effort reproducibility across identical requests.
frequency_penaltynumberDiscourage repeated tokens.
presence_penaltynumberDiscourage repeating topics already present.
response_formatobjectRequest 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.

Token usage

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

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"
  }
}
StatusMeaningWhat to do
400Malformed requestCheck the body against the parameter table.
401Missing or invalid keyCheck the Authorization header.
404Unknown model idCheck against the catalogue.
413Prompt exceeds contextShorten the prompt or use a longer-context model.
429Rate limitedBack off and retry; see below.
500Error on our sideSafe to retry. Tell us if it persists.
503Model loading or capacity reachedRetry shortly.

Retry 429, 500 and 503 with exponential backoff and jitter. Do not retry 400, 401 or 404 — they will fail identically.

Rate limits

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.

Python

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="")

Node.js

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

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.