# AI chat

> Eto API reference for `POST /api/v1/ai/chat`. Base URL `https://eto.tools/api/v1/`. Authenticate with the `X-Eto-API-Key` header.

Part of the [Eto API reference](https://eto.tools/dev/docs/). The full reference in one file is at [llms-full.txt](https://eto.tools/dev/docs/llms-full.txt); the machine-readable schema is at [openapi.json](https://eto.tools/dev/docs/openapi.json).

## POST /api/v1/ai/chat

AI chat

- Operation ID: `ai_chat`
- Slug: `ai-chat`
- Category: AI Studio
- Authentication: API key only. Reads or writes data Eto holds for your own account.
- HTML: https://eto.tools/dev/docs/#ep-ai-chat
- Markdown: https://eto.tools/dev/docs/ai-studio/ai-chat.md

Free-form AI chat using your configured Gemini credentials. Requires AI credentials configured in Eto settings.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `message` | body | `string` | yes | The user message / prompt |
| `context` | body | `object` | no | Optional context object merged into the prompt |

### Request

```bash
curl -X POST "https://eto.tools/api/v1/ai/chat" \
  -H "X-Eto-API-Key: eto_your_key" \
  -H "Content-Type: application/json" \
  -d '{
  "message": "Suggest three tag ideas for a leather wallet listing."
}'
```

```python
import requests

url = "https://eto.tools/api/v1/ai/chat"
headers = {"X-Eto-API-Key": "eto_your_key"}
payload = {
    "message": "Suggest three tag ideas for a leather wallet listing."
}

response = requests.post(url, headers=headers, json=payload, timeout=120)
response.raise_for_status()
print(response.json())
```

```javascript
const url = "https://eto.tools/api/v1/ai/chat";
const payload = {
  "message": "Suggest three tag ideas for a leather wallet listing."
};

const response = await fetch(url, {
  method: "POST",
  body: JSON.stringify(payload),
  headers: {
    "X-Eto-API-Key": "eto_your_key",
    "Content-Type": "application/json",
  },
});
if (!response.ok) throw new Error(`Eto API ${response.status}`);
const data = await response.json();
```

### Response

`application/json`. This endpoint has no worked response example in the registry yet; the [HTML reference](https://eto.tools/dev/docs/#ep-ai-chat) shows the fields it returns.

### Errors

Failures answer with the shared error body described in the Errors section: `{"error": {"code", "status", "message", "hint", "docs"}}`. Branch on `code`, not on the message.
