# Chat API Documentation

## Overview

Creates a new assistant turn with an AI persona. Supports text or voice input and can stream
tokens via SSE. For WebSocket mode, connect to `/ws` and send the same payload as a message.


## Base URL
```
http://localhost:3001/api/v1
```

## Authentication

All API endpoints require authentication via JWT token:
```
Authorization: Bearer <your-jwt-token>
```

## Endpoints


### POST /v1/chat

Create or continue a chat turn

Creates a new assistant turn with an AI persona. Supports text or voice input and can stream
tokens via SSE. For WebSocket mode, connect to `/ws` and send the same payload as a message.


**Parameters:**
- `x-correlation-id` (header): Correlation identifier that is echoed on every response and propagated downstream for tracing.
- `x-idempotency-key` (header): Required to ensure non-stream JSON responses are cached and replayed deterministically across retries.

**Responses:**
- **200**: Streaming response (SSE) or immediate JSON when `stream=false`.
- **400**: No description
- **401**: No description
- **429**: No description
- **500**: No description

**Operation ID:** `chatCreate`


## Rate Limiting

All endpoints are subject to rate limiting:
- **Burst limit:** 100 requests per minute
- **Sustained rate:** 1000 requests per hour

## Error Handling

Standard error response format:
```json
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human readable error message",
    "details": {}
  }
}
```

---
*Generated automatically from OpenAPI specification*
