AgentStack Docs

REST API: chat

Request synchronous or streaming chat responses from a backend service.

The Chat API has two endpoints: a regular response endpoint and a streaming endpoint. Use the regular endpoint when your backend can wait for a complete response. Use the streaming endpoint when your backend can forward progressive output to an authorized client and manage disconnects and backpressure. In both cases, keep the AgentStack API key on the server. Before you send a model-backed request, validate the caller.

A chat request is billable, stateful work, not a harmless probe. Limit user input. Set a timeout in your own service. If your workflow cannot tolerate a second response, do not replay a request automatically after an ambiguous network failure. If you expose streaming to a browser, proxy the stream through your backend. Do not give the browser direct access to the key.

See the generated reference for the exact message and agent parameters. For an embedded visitor experience, use the supported widget. For an internal tooling workflow, use the REST envelope, rate-limit headers, and error codes in the REST guides.