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.Documentation Index
Fetch the complete documentation index at: https://wuweism.com/llms.txt
Use this file to discover all available pages before exploring further.
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
Include either a session cookie (set automatically after sign-in) or a Bearer token in theAuthorization header:
Request
Content-Type:application/json
Headers
Bearer token for API authentication. Format:
Bearer <token>.Must be
application/json.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
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.
Previous conversation turns for multi-turn sessions. Each element must include
role and content.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.
Do-calculus intervention specification for Rung 2 (interventional) analysis. Requires
operatorMode to be set to "intervene".AI provider to use for language model inference. Accepted values:
"anthropic", "openai", "gemini". Defaults to "anthropic" when omitted.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.Activates Rung 2 analysis mode. Accepted values:
"intervene"— evaluate the causal effect of ado(·)intervention."audit"— audit the causal graph for identifiability and policy compliance without applying an intervention.
PDF documents to include as context for the analysis. Each attachment is base64-encoded.
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.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:
intervention_gate and intervention_effect only appear when an intervention is specified.
SSE events
Emitted periodically during processing to indicate progress. Display to users as a loading indicator.
The domain classifier has identified the subject area of the question.
The Structural Causal Model for the identified domain has been loaded.
Gate evaluation result for the requested intervention. Only emitted when
operatorMode is "intervene" or "audit".The computed causal effect of the intervention. Only emitted when
operatorMode is "intervene" and the gate allows the operation.A chunk of the generated answer text. These events are emitted incrementally — concatenate
text values in order to reconstruct the full response.The requested model was unavailable and a substitute was used.
Web sources were retrieved and used to ground the causal analysis.
Safety policy evaluation result.
Final event indicating the stream has ended successfully.
Error responses
Errors are returned as standard JSON responses before the stream is opened.| Status | Body | Description |
|---|---|---|
401 | — | Missing or invalid authentication credentials. |
400 | {"error": "Question is required"} | The question field was empty or missing. |
400 | {"error": "Invalid providerId"} | providerId is not one of "anthropic", "openai", "gemini". |
400 | {"error": "Invalid model for selected provider"} | model is not valid for the specified providerId. |
500 | {"error": "Configuration Error: Missing API key for provider '...'"} | The selected provider has no configured API key. Pass your key via X-BYOK-Api-Key or contact support. |
Examples
Basic question
Do-calculus intervention
UseoperatorMode: "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.