Artfical AI / API
Get an API key Open tAI
Getting started

Chat completions

POST /v1/chat/completions is the one endpoint that does everything: single-turn questions, multi-turn conversations, tool calling, and image input, blocking or streamed.

Request

POST https://api.artfical.com/v1/chat/completions
Authorization: Bearer tai-sk-...
Content-Type: application/json
FieldTypeRequiredDescription
modelstringYesOne of the model IDs listed on the Models page, e.g. "tai-4.1". An unrecognized value is rejected with a 400 before any generation happens.
messagesarrayYesThe conversation so far, oldest first. See Messages below for the shape of each entry.
streambooleanNoDefaults to false. When true, the response is a server-sent-events stream instead of a single JSON body; see Streaming.
toolsarrayNoOpenAI-shaped function tool definitions the model may choose to call. See Tool calling.
temperature, top_p, presence_penalty, frequency_penalty, seed, stopvariousNoSampling controls, forwarded as sent. See Sampling parameters for accepted ranges.

Messages

Each entry in messages has a role and a content. Four roles are recognized:

RoleMeaning
systemBackground instructions for the conversation. If more than one system message is present, they're folded together in order. A system message never overrides tAI's own core identity and behavior rules; it adds to the conversation's context, not to what tAI fundamentally is.
userSomething the person (or your application, on their behalf) is saying.
assistantA previous model reply. Include prior assistant messages when sending conversation history so the model has the full back-and-forth, not just the latest user message. An assistant message can also carry tool_calls; see Tool calling.
toolThe result of a tool call your own code executed, tied back to the call via tool_call_id. See Tool calling.

For a plain text turn, content is just a string:

{"role": "user", "content": "İstanbul'da bugün hava nasıl olur sence?"}

To include an image alongside text, content becomes an array of typed parts instead of a plain string; see Images for the exact shape and which models accept it.

Response (non-streaming)

With "stream": false (the default), the response is a single JSON object, returned once generation is complete:

{
  "id": "chatcmpl-817c002145ac47feb83a0006c58ff43b",
  "object": "chat.completion",
  "created": 1788961617,
  "model": "tai-4.1",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Merhaba! Ben tAI, size nasıl yardımcı olabilirim?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 1303,
    "completion_tokens": 232,
    "total_tokens": 1535
  }
}
FieldDescription
idA unique identifier for this completion, prefixed chatcmpl-.
choicesAlways exactly one entry (index 0). tAI does not support requesting multiple candidate completions from a single request.
choices[].finish_reason"stop" for a normal completed reply, or "tool_calls" when the model is asking to call one or more tools instead of replying directly. See Tool calling.
usageToken counts for this request. completion_tokens reflects what the model actually generated regardless of any max_tokens-style ceiling.

A full conversation

Include the whole history on every request; the API is stateless and holds no memory of previous calls on its own. Each request stands alone with exactly the context you send it.

{
  "model": "tai-4.1",
  "messages": [
    {"role": "system", "content": "Kısa ve net cevaplar ver."},
    {"role": "user", "content": "3 çarpı 4 kaç eder?"},
    {"role": "assistant", "content": "12."},
    {"role": "user", "content": "Peki onu 2'ye böl."}
  ]
}

Response length

There is currently no client-settable ceiling on how many tokens a response can contain; each model has its own internal ceiling tuned for that model. If you need a request to fail fast rather than run long, the most reliable lever is stop sequences (see Sampling parameters) or simply asking for brevity in the prompt itself.