Skip to content

Quickstart

Create an API key, send your first chat completion and check what it cost, in under five minutes.

This guide takes you from a new account to a working request. You need a Promptix account, a few dinars of credit and a terminal. If you already use the OpenAI SDK, the only changes are the base URL and the key.

Steps

Add credits

Sign in, open Billing and top up your balance with Flouci. Credits are in dinars (1 credit = 1 TND); the minimum top-up is 5 TND. VAT (19%) and the platform fee (10%) are added to the amount you pay and are shown before you confirm. See Billing and credits.

Create an API key

In API keys, click Create key, give it a name (for example the project it belongs to) and, optionally, a monthly spend limit in TND. Copy the key: it starts with sk_ and is shown only once.

terminalbash
export PROMPTIX_API_KEY="sk_your_key_here"

Keep your key on the server

Anyone with the key can spend your credits. Never ship it in browser or mobile code, and never commit it to a repository. Call Promptix from your backend.

Install an SDK (optional)

Promptix speaks the OpenAI format, so the official OpenAI SDKs work as they are. You can also use plain HTTP with curl or any HTTP client.

pip install openai

Send your first request

Send a chat completion to POST /chat/completions. The model field takes any id from the model catalog.

curl https://promptix.tn/api/v1/chat/completions \  -H "Authorization: Bearer $PROMPTIX_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "openai/gpt-4o-mini",    "messages": [      { "role": "system", "content": "You are a concise assistant." },      { "role": "user", "content": "Give me three names for a café in Sidi Bou Said." }    ]  }'

You get a standard OpenAI chat completion back:

200 OKJSON
{  "id": "gen-1758880023-kQ3vX8mZpL2nR7tW",  "object": "chat.completion",  "created": 1758880023,  "model": "openai/gpt-4o-mini",  "provider": "OpenAI",  "choices": [    {      "index": 0,      "finish_reason": "stop",      "message": {        "role": "assistant",        "content": "1. Café Bleu Jasmin\n2. Dar Nour\n3. Les Terrasses du Cap"      }    }  ],  "usage": {    "prompt_tokens": 31,    "completion_tokens": 22,    "total_tokens": 53  }}

Check what it cost

Billing runs right after the response is sent. A few seconds later, look up the request by its id to see the tokens used and the amount deducted from your balance in TND (native_cost.total).

curl "https://promptix.tn/api/v1/generation?id=gen-1758880023-kQ3vX8mZpL2nR7tW" \  -H "Authorization: Bearer $PROMPTIX_API_KEY"
200 OKJSON
{  "data": {    "id": "gen-1758880023-kQ3vX8mZpL2nR7tW",    "model": "openai/gpt-4o-mini",    "created_at": "2026-09-26T09:47:03.512Z",    "usage": {      "prompt_tokens": 31,      "completion_tokens": 22,      "total_tokens": 53    },    "native_cost": {      "prompt": 0.0000404,      "completion": 0.0000287,      "total": 0.0000691    },    "total_cost": 0.00001785,    "metadata": {      "referrer": null,      "site_title": null    }  }}

The same information appears in the Usage page of your dashboard.

Next steps