Guides

Streaming

Set stream: true on either protocol for server-sent events.

Chat Completions

Set "stream": true for server-sent events. The first token arrives in 100–300 ms instead of waiting for the full response.

shell
curl https://api.prismma.ai/v1/chat/completions \
  -H "Authorization: Bearer $PRISMMA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-opus-4-7","messages":[{"role":"user","content":"Write a haiku"}],"stream":true}'

Prismma relays the standard OpenAI-compatible SSE chunk shape verbatim on /v1/chat/completions — this is not a Prismma-specific format, it's what any OpenAI SDK already parses:

response (SSE)
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","model":"claude-opus-4-7","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}

data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","model":"claude-opus-4-7","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}

data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","model":"claude-opus-4-7","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]

Messages

Same idea on the Anthropic-format endpoint — set stream: true and read the SSE event stream (message_start, content_block_delta, message_stop, etc.), same as calling Anthropic directly.

shell
curl https://api.prismma.ai/v1/messages \
  -H "x-api-key: $PRISMMA_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-opus-4-7","max_tokens":1024,"stream":true,"messages":[{"role":"user","content":"Write a haiku"}]}'