Guides

Conversations

What it is for

Antarya does not remember earlier requests. A conversation is the messages list you send: every turn so far, oldest first. To continue, add the reply as an assistant message, add the next question as a user message and send the whole list again.

Send the history

curl https://antarya.ai/v1/chat \
  -H "Authorization: Bearer $ANTARYA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "Summarise this contract'"'"'s termination clause."},
      {"role": "assistant", "content": "Either side can end the agreement with 30 days of written notice."},
      {"role": "user", "content": "Draft a reply that accepts those terms."}
    ]
  }'
Output
{
  "id": "req_02",
  "content": [
    {"type": "text", "text": "Thank you for the summary. We accept the notice terms as written..."}
  ],
  "stop_reason": "end_turn",
  "usage": {"input_tokens": 71, "output_tokens": 48}
}

antarya chat keeps the history for you until you leave it with Ctrl+D.

Parameters

NameTypeRequiredDescription
messagesarrayYesRequiredThe conversation so far, oldest first. Each turn is sent again on every request.
roletextYesRequired"user" for your turns, "assistant" for replies you are passing back, "tool" for tool results.
contenttext or arrayYesRequiredThe turn as plain text, or a list of parts when it holds more than text.
modeltextNoWhich model answers. Leave it out to use the current default.

Limits

Every turn you send counts as input tokens, so a long conversation costs more with each request. Count a conversation before you send it with Counting tokens.

To keep a conversation for you, use a stored session (see sessions) and pass its session_id.

Next steps