---
title: "Stream an AI chat response with project context (ALL PLANS - aiCore)"
method: POST
path: "/ai/chat"
tags: ["ai"]
---

# Stream an AI chat response with project context (ALL PLANS - aiCore)

`POST /ai/chat`

## Request

- Base URL: `https://api.onplana.com/api`
- URL: `https://api.onplana.com/api/ai/chat`
- Auth: one of:
  - HTTP bearer
  - API key in header `Authorization`

Returns a Server-Sent Events stream. Each data event is a text chunk. Optionally provide `projectId` to give the AI context about a specific project.

## Headers

- `X-Organization-Id` string, required

## Request body

- object
  - `message` string, required
  - `projectId` string, uuid, nullable

## Response `200`

SSE stream of text chunks

## Other responses

- `400`: Validation error
- `401`: Unauthorized - missing or invalid JWT
- `402`: Plan gate - feature not available on current plan

---

[API](https://skmtc.dev/onplana/apis/onplana-api.md) · [All operations](https://skmtc.dev/onplana/apis/onplana-api/llms.txt) · [OpenAPI document](https://skmtc.dev/onplana/apis/onplana-api/revisions/c3d6c89e9dc8?raw)
