API Reference

CAP Computation Primitives

Base URL

https://api.abel.ai

Auth Header

Authorization: Bearer sk-...
POST/cap/v1/predict#

predict()

Forecast a variable using its causal Markov blanket. More robust than statistical models because it only uses causally relevant predictors.

Parameters

NameTypeDescription
targetstringVariable to predict (e.g. "BTCUSD_close")
horizonintPrediction steps ahead (1-30)

Example

client.predict("BTCUSD_close", horizon=48)

Response

{ "value": 63420, "ci_lower": 61800, "ci_upper": 65100,
  "mb_variables": ["ETHUSD_close", "DXY", "SP500"] }
POST/cap/v1/explain#

explain()

Extract the minimal causal explanation set for a variable — its parents, children, and cross-domain causal chains.

Parameters

NameTypeDescription
variablestringVariable to explain
depthintChain depth (1-5, default 2)
cross_domainboolInclude cross-domain chains (default true)

Example

client.explain("BTCUSD_close", depth=2, cross_domain=True)

Response

{ "parents": [{ "name": "DXY", "influence": "MODERATE_NEGATIVE" }],
  "cross_domain_chains": ["Fed_Rate → DXY → BTC"] }
POST/cap/v1/intervene#

intervene()

Compute P(Y|do(X=x)) — the causal effect of intervening on X. Uses do-calculus, not correlation.

Parameters

NameTypeDescription
treatmentstringVariable to intervene on
outcomestringVariable to measure effect on
treatment_valuefloatIntervention magnitude

Example

client.intervene("Fed_Funds_Rate", "BTCUSD_close", treatment_value=0.5)

Response

{ "effect": -0.042, "ci": [-0.021, -0.068],
  "causal_chain": "Fed →[τ=5h]→ DXY →[τ=2h]→ BTC" }
POST/cap/v1/discover#

discover()

Learn causal structure from data. Automatically selects the best algorithm from 39 options based on data characteristics.

Parameters

NameTypeDescription
database64CSV data (base64 encoded)
querystringAnalysis goal in natural language

Example

client.discover(data=my_csv, query="What causes customer churn?")

Response

{ "graph": { "nodes": [...], "edges": [...] },
  "algorithm_used": "PC", "confidence": 0.87 }
POST/cap/v1/counterfactual#

counterfactual()

What would have happened if…? Computes P(Y_{x'} | X=x, Y=y) using structural causal models.

Parameters

NameTypeDescription
intervene_nodestringVariable that would have been different
observe_nodestringVariable to observe counterfactual outcome
intervene_valuefloatCounterfactual value

Example

client.counterfactual("NVDA_close", "AMD_close", intervene_value=0.01)

Response

{ "counterfactual_value": 0.008, "actual_value": 0.012,
  "difference": -0.004 }
POST/cap/v1/validate#

validate()

Test whether a causal graph is consistent with new data. Bootstrap confidence intervals and edge stability.

Parameters

NameTypeDescription
graph_idstringGraph to validate
test_database64New data to test against

Example

client.validate(graph_id="g-123", test_data=new_csv)

Response

{ "consistent": true, "edge_stability": 0.91,
  "unstable_edges": [] }
POST/cap/v1/detect-regime#

detect-regime()

Detect whether the causal structure has changed — G_t ≠ G_{t-1}. Identifies structural breaks and regime shifts in the underlying causal graph.

Parameters

NameTypeDescription
graph_idstringGraph to monitor for regime changes
windowintLookback window in time steps (default 30)

Example

client.detect_regime(graph_id="g-123", window=30)

Response

{ "regime_changed": true, "change_point": "2026-02-14",
  "changed_edges": [{ "from": "DXY", "to": "BTC", "old_weight": -0.42, "new_weight": -0.11 }],
  "confidence": 0.93 }
POST/cap/v1/check-reflexivity#

check-reflexivity()

Test whether Abel's own output has become a causal variable in the graph — Soros-style reflexivity detection. Guards against self-fulfilling predictions.

Parameters

NameTypeDescription
graph_idstringGraph to check
output_variablestringAbel's prediction variable to test

Example

client.check_reflexivity(graph_id="g-123", output_variable="BTCUSD_prediction")

Response

{ "reflexive": false, "feedback_strength": 0.02,
  "threshold": 0.15, "safe": true }