# AI agent chat — streams a Vercel AI SDK UI message stream

`POST /api/ai-chat`

Authentication: no security requirement declared for this operation.

Parameters:

- `language` (header, string, required)
  Type: string

Responses:

- 200: UI message stream (text/event-stream).

- 400: Invalid messages payload.

- 503: AI chat is not configured (no provider credentials).

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/ai-chat' \
  -H 'language: string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:3000/api/ai-chat', {
  method: 'POST',
  headers: {
    'language': 'string',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.post(
    'http://localhost:3000/api/ai-chat',
    headers={
        'language': 'string',
    },
)
print(response.text)
```
