Skip to main content

AI API

POST /api/v1/ai/ask is an application endpoint that runs one Coffee AI turn and returns a single JSON document. It is not currently exposed as a general third-party OAuth capability. For external integrations, use the authorized tools listed by MCP or the integration reference; do not reuse a browser session token. The behavior below describes clients that already have supported access.

Long-running turns​

A turn can take up to about 15 minutes when it runs tools. While it runs, Coffee keeps the connection open by sending whitespace. Parse the body only once the response completes, and set your client timeout to at least 16 minutes.

Request basics​

FieldRequiredNotes
chat_typeyesThe surface, for example assistant, task, meeting, project, note.
client_turn_idyesYour ID for this submit. Echoed back so concurrent turns do not mix.
agent_modenoplan or act.
module_hashnoThe item the turn is about.
agent_idnoRun the turn as a specific agent.

Retries​

The endpoint supports idempotent retries. Send an Idempotency-Key header, and reuse the same value when you retry a failed request, so the turn runs once.