1. Create a key
In the portal go to AI & Data, open your service and choose Keys, then New key. Give it a name, the public IP address of the server where your program runs, and confirm with your own portal password. You see the key only once: store it safely, for example in a password manager. Do not put it in code you share. See Keys and addresses.
2. Put the key in an environment variable
export ZETA_AI_KEY="zeta_..."
3. Ask your first question
curl https://ai.zeta.nl/v1/chat/completions \
-H "Authorization: Bearer $ZETA_AI_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "qwen3.6-35b-a3b", "messages": [{"role": "user", "content": "Say hello in one sentence."}]}'
Python, with the official OpenAI package (pip install openai):
import os
from openai import OpenAI
client = OpenAI(base_url="https://ai.zeta.nl/v1", api_key=os.environ["ZETA_AI_KEY"])
antwoord = client.chat.completions.create(
model="qwen3.6-35b-a3b",
messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(antwoord.choices[0].message.content)
JavaScript / Node.js (npm install openai):
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://ai.zeta.nl/v1", apiKey: process.env.ZETA_AI_KEY });
const antwoord = await client.chat.completions.create({
model: "qwen3.6-35b-a3b",
messages: [{ role: "user", content: "Say hello in one sentence." }],
});
console.log(antwoord.choices[0].message.content);
4. What you get back
{"id": "chatcmpl-...", "object": "chat.completion", "model": "qwen3.6-35b-a3b",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "Hello! Nice to meet you."}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 14, "completion_tokens": 9, "total_tokens": 23}}
Every response carries the header X-Request-Id. Mention it when you contact us about a request.
5. Next steps
Streaming (text appears word by word)
stroom = client.chat.completions.create(model="qwen3.6-35b-a3b", stream=True,
messages=[{"role": "user", "content": "Write a short poem."}])
for blok in stroom:
if blok.choices and blok.choices[0].delta.content:
print(blok.choices[0].delta.content, end="")
A photo or scan
Send the image inside the request as base64 (png, jpeg, webp or gif, at most 8 MB per image and 10 images per request). A link to an image on the internet is not accepted. The request goes to the vision model by itself; with vision-latest or qwen3.8-27b you choose it explicitly. With one of those names a question without an image also goes to the vision model, for instance a long assessment text.
import base64
foto = base64.b64encode(open("bon.jpg", "rb").read()).decode()
antwoord = client.chat.completions.create(model="qwen3.8-27b", messages=[{"role": "user", "content": [
{"type": "text", "text": "What is the total on this receipt?"},
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{foto}"}}]}])
Search by meaning (embeddings)
vectoren = client.embeddings.create(model="qwen3-embedding-0.6b", input=["How do I reset my password?"])
print(len(vectoren.data[0].embedding))
Speech to text
tekst = client.audio.transcriptions.create(model="whisper-1", file=open("opname.mp3", "rb"), language="nl")
print(tekst.text)
Handle errors well
Base your handling on the HTTP status. Retry 429 and 5xx after the number of seconds in Retry-After, with increasing waits; do not retry 400, 401, 403 and 404. The OpenAI package already retries twice by itself: do not add a second retry loop on top. See Errors.