Chat
The Chat API is how your users interact with thinnestAI agents. Send a message, get a response — it’s that simple. Under the hood, you get streaming, session persistence, and intelligent rate limiting.Quick Start
Send a message to your agent:Chat API Endpoint
POST /chat
Send a message to an agent and receive a response. Request Body:
Example Request:
Streaming Responses (SSE)
By default, the Chat API streams responses using Server-Sent Events (SSE). This gives your users a real-time typing experience instead of waiting for the full response.How SSE Works
Whenstream: true (the default), the response is delivered as a series of events:
Consuming SSE in JavaScript
Consuming SSE in Python
Session Management
Sessions maintain conversation history so your agent remembers previous messages.How Sessions Work
- New conversation: Omit
session_id— the API creates a new session and returns its ID. - Continue conversation: Include the
session_idfrom a previous response. - Session storage: Conversation history is stored in PostgreSQL and persists across requests.
- Session expiry: Sessions remain active for 24 hours of inactivity by default.
Managing Sessions
Session Metadata
You can pass metadata with each message to provide additional context:Rate Limiting
The Chat API enforces rate limits to ensure fair usage and platform stability.Default Limits
Rate Limit Headers
Every response includes rate limit information:Handling Rate Limits
When you exceed the limit, you receive a429 Too Many Requests response:
Error Handling
Next Steps
- Embed Widget — Add chat to your website with zero code.
- Agents — Configure the agents behind your chat.
- Knowledge Sources — Give your agent information to draw from.

