Skip to content

Getting started

Quickstart

From your first key to your first answer, in five minutes.

Last updated: 2026-10-08

1. An account

Go to https://my.aitokens.ch/register and create your account.

2. A key

In the dashboard: API keys → Create. Copy the key straight away: it starts with sk-at- and it is shown only once.

bash
export API_KEY="sk-at-…"

3. The models you can use

bash
curl https://api.aitokens.ch/v1/models \
  -H "Authorization: Bearer $API_KEY"

The chat models are also in the Models catalogue, with the country where each one runs and what each one is for.

4. Your first answer

bash
curl -i https://api.aitokens.ch/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.8-27b",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user",   "content": "Explain data sovereignty in three bullet points."}
    ],
    "max_tokens": 4000
  }'

Some models think before they answer, and the thinking counts against this cap: see Every parameter.

The body has the OpenAI shape: { id, choices: [...], usage: {...} }. Among the headers, X-Zona says in which zone the request was processed.

5. Streaming

Add "stream": true. Every line starts with data: , and the last one is data: [DONE].

bash
curl -N https://api.aitokens.ch/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.8-27b",
    "stream": true,
    "messages": [{"role": "user", "content": "Write a haiku about mountains."}]
  }'

More in Streaming.

6. With the OpenAI SDK

If you already use openai-python or openai-node, three things change: base_url, the key and the model, one from the catalogue. The rest works if it uses only what AI Tokens supports: What works where has every endpoint, and OpenAI SDK migration lists the differences.

python
import os

from openai import OpenAI

client = OpenAI(
    base_url="https://api.aitokens.ch/v1",
    api_key=os.environ["API_KEY"],
)

resp = client.chat.completions.create(
    model="qwen3.8-27b",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)

LangChain, LlamaIndex and function calling are in OpenAI SDK migration.

Read next

Search the docs

Type to search…