---
title: "Stream a plain-text cases chat completion as SSE"
method: POST
path: "/cases/chat/completion"
tags: ["cases"]
---

# Stream a plain-text cases chat completion as SSE

`POST /cases/chat/completion`

Generate a plain-text answer to the user's question with the LLM and
stream it as server-sent events. Unlike /cases/chat/stream, the stream
uses a minimal custom protocol (no Anthropic event objects, no tool use):

- event: delta / data: {"text": "<text chunk>"}
- event: done / data: {}
- event: error / data: {"message": "<error message>"}

## Request body

- object
  - `messages` object[], required — Conversation history as plain-text messages. Content is always a plain string (no tool_use / tool_result content blocks).
    - `content` string, required — Plain-text message content
    - `role` 'user' | 'assistant', required — Message role
  - `model` string — Optional LLM model override. Falls back to server default if not specified.
  - `notebook` object, required — The case notebook JSON object (.ipynb) the conversation is about.
  - `parameters` object[] — Definitions of the case parameters the user can change from the parameter form.
    - `choices` string[] — Allowed values, for a parameter of value_type "enum".
    - `default_value` string, required — Value the case defines for the parameter.
    - `description` string — Description of the parameter.
    - `label` string, required — Human-readable label of the parameter.
    - `max` number — Largest value allowed, for a parameter of value_type "number".
    - `min` number — Smallest value allowed, for a parameter of value_type "number".
    - `unit` string — Unit the value is given in, shown next to the label.
    - `value_type` 'number' | 'smiles' | 'string' | 'tuple' | 'array' | 'enum', required — Type the value must be written as. "tuple" and "array" keep the Python literal text, such as "(1, 1, 1)" or "[423, 523]".
    - `variable_name` string, required — Variable name of the case parameter.
  - `provider` 'anthropic' | 'bedrock' — LLM provider. "anthropic" for direct API, "bedrock" for AWS Bedrock. Defaults to "bedrock".

## Response `200`

SSE stream started successfully

## Other responses

- `400` — Bad request
- `default` — Other error

---

[API](https://skmtc.dev/matlantis/apis/matlantis-web-ui-backend-api.md) · [All operations](https://skmtc.dev/matlantis/apis/matlantis-web-ui-backend-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/matlantis/matlantis-web-ui-backend-api/revisions/b155f3a32673/schema)
