Skip to content

Quickstart

  1. Sign up at console.siema-ai.pl and confirm your email. Verified accounts receive a small trial balance (see Billing).
  2. Open Keys, click Create key, name it, and copy the value. It starts with sk-siema- and is shown once.
  3. Export it in your shell:
Terminal window
export SIEMA_API_KEY="sk-siema-EXAMPLEKEYDONOTUSE0000000000000000000000"

All three examples stream from polish-pro and print token usage at the end.

Terminal window
pip install openai
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.siema-ai.pl/v1",
api_key=os.environ["SIEMA_API_KEY"],
)
stream = client.chat.completions.create(
model="polish-pro",
messages=[
{"role": "system", "content": "Jesteś pomocnym asystentem. Odpowiadaj zwięźle po polsku."},
{"role": "user", "content": "Wyjaśnij w trzech zdaniach, czym jest podatek VAT."},
],
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices: # the final usage chunk has no choices
print(chunk.choices[0].delta.content or "", end="", flush=True)
elif chunk.usage:
print(f"\n\ntokens: {chunk.usage.prompt_tokens} in, {chunk.usage.completion_tokens} out")
Terminal window
npm install openai

Save this as quickstart.mjs — it uses import and top-level await, so it needs the .mjs extension to run as an ES module without a package.json:

import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.siema-ai.pl/v1",
apiKey: process.env.SIEMA_API_KEY,
});
const stream = await client.chat.completions.create({
model: "polish-pro",
messages: [
{ role: "system", content: "Jesteś pomocnym asystentem. Odpowiadaj zwięźle po polsku." },
{ role: "user", content: "Wyjaśnij w trzech zdaniach, czym jest podatek VAT." },
],
stream: true,
stream_options: { include_usage: true },
});
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta?.content; // optional chaining: last chunk has no choices
if (delta) process.stdout.write(delta);
if (chunk.usage) console.log(`\n\ntokens: ${chunk.usage.prompt_tokens} in, ${chunk.usage.completion_tokens} out`);
}

Run this on a server or in a script, never in a browser. See Authentication.

Terminal window
curl -N https://api.siema-ai.pl/v1/chat/completions \
-H "Authorization: Bearer $SIEMA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "polish-pro",
"stream": true,
"stream_options": {"include_usage": true},
"messages": [{"role": "user", "content": "Cześć! Kim jesteś?"}]
}'

-N disables curl’s buffering so you see chunks as they arrive.

A stream of data: events, each with a few characters of Polish text, then a chunk with an empty choices array carrying usage, then data: [DONE]. Every response also carries an X-Request-Id header; keep it if you need to ask support about a request.

Open Usage in the console: the request appears within a few seconds with its token counts and cost in PLN.

  • Pick the right alias for your task in Models and pricing.
  • Read Streaming before shipping a streaming UI.
  • Read Errors, especially what happens when the balance hits zero.