> For the complete documentation index, see [llms.txt](https://ottodata.gitbook.io/ottodata-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ottodata.gitbook.io/ottodata-docs/api-reference/otto-ai-chat.md).

# Otto AI chat

## Otto AI chat

A chat endpoint that answers natural-language questions about Hood using the live catalog as tools. This is the only place an LLM appears in Otto — and it sits *on top of* the data, never in the collection path.

### `POST /v1/ai/chat`

Server-Sent Events (SSE) stream.

**Request body**

```json
{
  "message": "Which token has the biggest overnight premium right now?",
  "history": [
    { "role": "user", "content": "…" },
    { "role": "assistant", "content": "…" }
  ]
}
```

`history` is optional (previous turns, for follow-up questions).

**Response**: `text/event-stream` with JSON-encoded events:

| Event   | Payload                   | Meaning                          |
| ------- | ------------------------- | -------------------------------- |
| `tool`  | `{ "name": "gaps_live" }` | the agent is calling a data tool |
| `token` | `{ "text": "NVDA is…" }`  | streamed answer text             |
| `done`  | `{}`                      | stream complete                  |
| `error` | `{ "message": "…" }`      | something failed                 |

**Example**

```bash
curl -N https://api.ottodata.app/v1/ai/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Any stablecoin depeg risk right now?"}'
```

### Limits and behavior

* Rate limited to **10 requests / minute / IP**.
* The agent makes at most 3 tool calls per question and answers only from live data — if the data doesn't exist, it says so instead of inventing numbers.
* Not financial advice. It is a data analyst over the Otto catalog, nothing more.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ottodata.gitbook.io/ottodata-docs/api-reference/otto-ai-chat.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
