DocumentationThe assistant endpoint

Your assistants

The assistant endpoint

A single request in the OpenAI format. Your assistant answers with its instructions and memory, streamed.

On this page
  1. Call the assistant
  2. The response
  3. How it differs from a model on its own

Call the assistant

POST /v1/agents/chat/completions A complete conversation turn.

Identify the assistant with assistantId. To continue the same conversation, send threadId instead.

curl -N https://api.learnya.ai/v1/agents/chat/completions \
  -H "Authorization: Bearer $LEARNYA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "assistantId": "ASSISTANT_ID",
    "stream": true,
    "messages": [
      {"role": "user", "content": "Where is my invoice?"}
    ]
  }'

The response

ModeWhat you get
StreamingOpenAI-format chat.completion.chunk events, then [DONE]
Without streamingAn immediate response with no text, with finish_reason set to queued and the thread, message and run IDs to track

How it differs from a model on its own

SubjectWith an assistant
The model fieldIt picks the model for this response, not the assistant
tool messages and imagesRejected: the assistant calls its own tools
Token countAn estimate, and completion_tokens is 0
AccessA user’s access token, not an API key

For a model without an assistant, stick to the plain chat endpoint with an API key.