Skip to content
TukaiDevelopers

Search the documentation

Console
Documentation menu

Get started

First call

Create a key on your Tukai account, keep it in an environment variable, and send a first text request in a few minutes.

Verified on 4 October 2026Markdown versionReport a problem on this page

Expected result: a reply of a few words, generated by a model from the Tukai catalog, from your own terminal or your own code.

What you need: a Tukai account with an active subscription or credits, and one of these tools: curl (macOS, Linux), PowerShell (Windows), or Node.js / Python with the official openai SDK installed.

1. Create a key

  1. Open chat.tuk-ai.com and sign in.
  2. Open the settings, group Fournisseurs (Providers), tab Clés API (API keys).
  3. Give the key a name (for example essai-local) and tick the model chat-aion-labs-aion-3-0-mini, used in the examples below. If you wish, set a monthly cap in dinars.
  4. Create the key and copy it immediately: it starts with tuk_sk_ and will never be shown again. Only its beginning (prefix) remains visible afterwards.

A key can only call the models ticked when it was created: any other model is refused (403), never silently replaced.

2. Keep the key out of your code

Put the key in an environment variable for your session. Do not paste it into a version-controlled file.

export TUKAI_API_KEY="collez-votre-cle-ici"

3. Send the request

The base URL is https://chat.tuk-ai.com/v1. The key goes in the Authorization: Bearer header.

curl https://chat.tuk-ai.com/v1/chat/completions \
  -H "Authorization: Bearer $TUKAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "chat-aion-labs-aion-3-0-mini",
    "max_tokens": 100,
    "messages": [{ "role": "user", "content": "Donne en une phrase la capitale de la Tunisie." }]
  }'

On Windows, use the PowerShell tab: in Windows PowerShell 5.1, curl refers to a different command and the curl example fails.

The model in these examples is the default model of the public catalog at the time of verification. Any identifier from the Models (French) page that is ticked on your key works the same way.

4. Read the response

A successful response looks like this. The generated text varies from one call to the next.

Réponse
{
  "id": "…",
  "object": "chat.completion",
  "created": 1790000000,
  "model": "chat-aion-labs-aion-3-0-mini",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "La capitale de la Tunisie est Tunis." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 18, "completion_tokens": 9, "total_tokens": 27 }
}

Every response, successful or not, carries an x-request-id header. Write it down: it is what support will ask you for.

If it does not work

What you seeLikely causeWhat to do
401 authentication_errorKey missing, miscopied, revoked or expiredCheck the environment variable; create a new key if needed
402 insufficient_quotaNo subscription and no credits on the accountTop up, then retry
403 permission_errorMost often, the model is not ticked on this keyEdit the key or change the model; see Errors for other causes
429 rate_limit_errorKey rate limit, key monthly cap, or your plan's usage limitsWait for the window to end (retry-after and ratelimit-reset headers); see Errors

Read the error's type field, not its message: depending on the cause, the message is in English or in French.

Next steps