MODEL CAPABILITIES
Conversations
The API is stateless: you send the whole conversation with every request.
A chat request carries the conversation so far in messages, oldest first. Tessen does not keep a conversation between requests for the chat API: to continue one, append the model's reply and your next message, and send the whole list again.
role | Use |
|---|---|
system | Instructions that frame the whole conversation. Put it first. |
user | What the person said. |
assistant | What the model said earlier. May carry tool_calls. |
tool | The result of a function the model asked for. Carries tool_call_id. |
CONTINUE A CONVERSATION
curl https://api.tessen.ai/v1/chat/completions \ -H "Authorization: Bearer $TESSEN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "z1", "max_tokens": 256, "messages": [ {"role": "system", "content": "Answer in one short sentence."}, {"role": "user", "content": "Name a prime number greater than 10."}, {"role": "assistant", "content": "13 is a prime number greater than 10."}, {"role": "user", "content": "And the next prime after it?"} ] }'import osimport requests messages = [ {"role": "system", "content": "Answer in one short sentence."}, {"role": "user", "content": "Name a prime number greater than 10."},] def ask(messages): response = requests.post( "https://api.tessen.ai/v1/chat/completions", headers={"Authorization": f"Bearer {os.environ['TESSEN_API_KEY']}"}, json={"model": "z1", "max_tokens": 256, "messages": messages}, timeout=120, ) response.raise_for_status() return response.json()["choices"][0]["message"]["content"] reply = ask(messages)print(reply) messages.append({"role": "assistant", "content": reply})messages.append({"role": "user", "content": "And the next prime after it?"})print(ask(messages))const messages = [ { role: "system", content: "Answer in one short sentence." }, { role: "user", content: "Name a prime number greater than 10." },]; async function ask(messages) { const response = await fetch("https://api.tessen.ai/v1/chat/completions", { method: "POST", headers: { Authorization: `Bearer ${process.env.TESSEN_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ model: "z1", max_tokens: 256, messages }), }); if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`); return (await response.json()).choices[0].message.content;} const reply = await ask(messages);console.log(reply); messages.push({ role: "assistant", content: reply });messages.push({ role: "user", content: "And the next prime after it?" });console.log(await ask(messages));Things to plan for
- Every request is billed for all the input tokens you send, including the history. Long conversations cost more per turn; trim or summarise old turns.
- The context window is not published, so these docs state no number. Watch
usage.prompt_tokensand keep conversations comfortably short. - Keep any conversation you need to keep. The Console Playground does not store conversations.