---
title: "Send a message to an AI agent or collection."
method: POST
path: "/chat"
---

# Send a message to an AI agent or collection.

`POST /chat`

## Request body

- ChatRequest
  - `chatId` string — Enter null to create a new conversation or an existing chatId to continue a conversation
  - `agentId` string
  - `collectionId` string
  - `message` string
  - `streaming` boolean
  - `tools` Tool[]
    - `id` string
    - `checked` boolean — Set to true if you want to include the tool as a plugin to the LLM call
  - `model` 'gpt-3.5-turbo' | 'gpt-3.5-turbo-16k' | 'gpt-4' | 'palm-2' | 'llama-2-13b-chat' | 'llama-2-70b-chat' | 'codellama-13b-instruct' | 'codellama-13b-python' | 'mistral-7b' | 'zephyr-7b' | 'mistrallite-7b' | 'llava-13b' | 'fuyu-8b' | 'causallm-14b' — Name of the LLM model to use.
  - `lastUploadedFile` string — Publicly accessible URL of the last uploaded file. Typically used to feed an image to a multi-modal model.
  - `language` string — 2-letter ISO code of the language the model should use to reply.

## Response `200`

The response to the message from the language model.

- ChatResponse
  - `ok` boolean
  - `message` string
  - `error` string
  - `sources` string[]
  - `followup` object
  - `context` object
  - `chatId` string
  - `agentId` string
  - `collectionId` string

## Other responses

- `403` — Exceeded daily chat allowance.
- `500` — Error running the language model.

---

[API](https://skmtc.net/openindex/apis/openindex-ai-api.md) · [All operations](https://skmtc.net/openindex/apis/openindex-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openindex/openindex-ai-api/versions/c3a8b22ba407/schema)
