Skip to main content
Send a causal question to the Wu-Weism reasoning engine. The response is streamed as a sequence of Server-Sent Events (SSE), allowing you to display incremental progress — domain classification, SCM loading, intervention evaluation, and answer text — as they complete.
This endpoint uses text/event-stream. You must read the response body as a stream and parse individual SSE frames. Standard fetch with a body reader works in all modern environments.

Endpoint

Authentication

Authentication is required on every request. Unauthenticated requests return 401 Unauthorized.
Include either a session cookie (set automatically after sign-in) or a Bearer token in the Authorization header:

Request

Content-Type: application/json

Headers

string
required
Bearer token for API authentication. Format: Bearer <token>.
string
required
Must be application/json.
string
Bring-your-own-key: pass your own API key for the selected AI provider. When present, this key is forwarded to the upstream provider instead of Wu-Weism’s managed key. Required if your account is configured for BYOK mode.

Body parameters

string
required
The causal question to analyze. Should be phrased as a causal query — for example, “Does X causally affect Y?” or “What would happen if we intervene on Z?”. Cannot be empty.
object[]
Previous conversation turns for multi-turn sessions. Each element must include role and content.
string
UUID identifying a persistent session. When provided, the server associates this request with the session’s stored history and SCM context. If omitted, the request is treated as stateless.
object
Do-calculus intervention specification for Rung 2 (interventional) analysis. Requires operatorMode to be set to "intervene".
string
default:"anthropic"
AI provider to use for language model inference. Accepted values: "anthropic", "openai", "gemini". Defaults to "anthropic" when omitted.
string
Specific model ID within the selected provider — for example, "claude-opus-4-5" or "gpt-4o". When omitted, the provider’s default model is used. Must be a valid model for the chosen providerId; mismatches return a 400 error.
string
Activates Rung 2 analysis mode. Accepted values:
  • "intervene" — evaluate the causal effect of a do(·) intervention.
  • "audit" — audit the causal graph for identifiability and policy compliance without applying an intervention.
object[]
PDF documents to include as context for the analysis. Each attachment is base64-encoded.
string
Override the automatic domain classifier and load a specific SCM model by its key. Useful when you know exactly which causal model applies to your question. When omitted, the domain is classified automatically from question.
string
Trace identifier for counterfactual provenance. Associates this request with a prior causal trace for counterfactual reasoning or audit replay.

Response

Content-Type: text/event-stream The response body is a stream of SSE frames. Each frame has the form:
Events arrive in roughly the order listed below, though not all events are emitted on every request — for example, intervention_gate and intervention_effect only appear when an intervention is specified.

SSE events

object
Emitted periodically during processing to indicate progress. Display to users as a loading indicator.
object
The domain classifier has identified the subject area of the question.
object
The Structural Causal Model for the identified domain has been loaded.
object
Gate evaluation result for the requested intervention. Only emitted when operatorMode is "intervene" or "audit".
object
The computed causal effect of the intervention. Only emitted when operatorMode is "intervene" and the gate allows the operation.
object
A chunk of the generated answer text. These events are emitted incrementally — concatenate text values in order to reconstruct the full response.
object
The requested model was unavailable and a substitute was used.
object
Web sources were retrieved and used to ground the causal analysis.
object
Safety policy evaluation result.
object
Final event indicating the stream has ended successfully.

Error responses

Errors are returned as standard JSON responses before the stream is opened.

Examples

Basic question

Do-calculus intervention

Use operatorMode: "intervene" together with the intervention object to evaluate a causal effect under a hypothetical manipulation.

Parsing SSE events

A minimal parser for the SSE stream in JavaScript:
SSE frames are separated by a blank line (\n\n). A single read() call may return multiple frames or a partial frame depending on network conditions. For production use, buffer incoming chunks and split on \n\n before parsing.