Exergy World Model
Exergy World Model (EWM-1) API reference
Request and response shapes for POST /api/v1/world-model, /api/v1/openapi.json, and the EWM-1 preview endpoints.
POST /api/v1/world-model (live now)
Evaluates industrial heat recovery, steam upgrades, thermal storage buffering, and boiler-electrification trade-offs on exergy-lab.com. Authenticate with Authorization: Bearer <EXERGY_API_KEY> from /developers/portal. Full schema at GET /api/v1/openapi.json.
- exergy_ledger — closed 5-term exergy balance (service_duty_kw, exergy_in_total_kw, exergy_applied_kw, exergy_out_total_kw, exergy_destroyed_total_kw, closure_residual_kw, cop_heating, carnot_cop_limit, second_law_efficiency_pct).
- policy_verification — Policy v2 status, discharge temperature margin, worst-case power, and worst-case relative regret.
- thermal_storage & baseline_comparison — thermal buffer sizing plus cost/emissions comparisons against natural gas and electric resistance boilers.
| Field | Type | Required | Range / Default | Description |
|---|---|---|---|---|
| target_heat_duty_kw | number | Yes | 5 to 5,000 | Target thermal duty in kW. |
| source_inlet_temp_c | number | Yes | 15 to 110 | Heat-source inlet temperature in °C. |
| supply_temp_c | number | Yes | 50 to 190 (> source + 5 °C) | Required process supply temperature in °C. |
| lockout_duration_hours | number | No | 0 to 24 (default 2) | Peak-tariff thermal-storage lockout duration in hours. |
| equipment_id | string | No | Auto-selected | Optional fixed equipment model ID (discover via GET /api/v1/world-model). |
| electricity_price_per_kwh | number | No | > 0 to 2 | Electricity rate ($/kWh) for baseline comparisons. |
| natural_gas_price_per_kwh | number | No | > 0 to 2 | Natural gas rate ($/kWh) for baseline comparisons. |
| grid_carbon_kg_per_kwh | number | No | 0 to 2 | Grid emissions intensity (kg CO₂/kWh). |
POST /v1/chat/completions (EWM-1 preview)
Creates a model response for a chat conversation using the EWM-1 pipeline.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| model | string | Yes | "ewm-1" | ID of the model to use. |
| messages | array | Yes | — | Message objects: {role: system | user | assistant, content}. |
| stream | boolean | No | false | Stream chat.completion.chunk SSE events ending with data: [DONE]. |
| response_format | object | No | {type: "text"} | Set {type: "json_object"} to skip prose and return verified structured_output JSON in choices[0].message.content. |
| skip_composer | boolean | No | false | Skip the prose composer stage for lower latency. |
{
"id": "chatcmpl-ewm-9c41a0b28e11",
"object": "chat.completion",
"created": 1763059200,
"model": "ewm-1",
"system_id": "ewm-1-neuro-symbolic (ewm-1 + ewm_thermo_lib + sandbox)",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "### 1. Thermodynamic State & Cycle Verification\n...",
"structured_output": {
"T_sat_C": 179.88,
"h_g_kJ_kg": 2777.1,
"h_fg_kJ_kg": 2014.5,
"ef_g_kJ_kg": 830.6
}
},
"finish_reason": "stop"
}
],
"structured_output": {
"T_sat_C": 179.88,
"h_g_kJ_kg": 2777.1,
"h_fg_kJ_kg": 2014.5,
"ef_g_kJ_kg": 830.6
},
"ewm_verification": {
"verified": true,
"attempts": 1,
"exec_s": 0.34,
"code": "from ewm_thermo_lib import *\n...",
"stdout": "{\n \"T_sat_C\": 179.88,\n ...\n}"
},
"usage": {
"prompt_tokens": 2890,
"completion_tokens": 940
},
"latency_s": 14.21
}POST /v1/solve (native solver)
Native endpoint (also at POST /v1/thermo/solve) with direct control over code/stdout inclusion and multi-stage SSE streaming.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| prompt | string | Yes | — | Engineering problem statement, up to 60,000 characters. |
| stream | boolean | No | false | Stream multi-stage SSE events (stage, solver_delta, code, exec_result, composer_delta, done). |
| skip_composer | boolean | No | false | Return immediately after sandbox verification, without the prose report. |
| include_code | boolean | No | true | Include the generated Python script in verification.code. |
| include_stdout | boolean | No | true | Include raw sandbox stdout and stderr in verification. |
{
"id": "ewm-solve-4d819a2f7c03",
"object": "ewm.solution",
"created": 1763059260,
"model": "ewm-1",
"system_id": "ewm-1-neuro-symbolic (ewm-1 + ewm_thermo_lib + sandbox)",
"answer_markdown": "",
"structured_output": {
"T_sat_C": 179.88,
"h_g_kJ_kg": 2777.12,
"h_fg_kJ_kg": 2014.48,
"ef_g_kJ_kg": 830.62,
"w_comp_kJ_kg": 334.19
},
"verification": {
"verified": true,
"attempts": 1,
"exec_s": 0.391,
"history": [
{ "attempt": 1, "ok": true, "returncode": 0, "exec_s": 0.391, "ast_violation": null }
],
"code": "from ewm_thermo_lib import *\n...",
"stdout": "{\n \"T_sat_C\": 179.88,\n ...\n}",
"stderr": ""
},
"usage": {
"prompt_tokens": 2710,
"completion_tokens": 310
},
"latency_s": 13.1
}POST /v1/energy-decisions/evaluate
Evaluates plant commissioning telemetry residuals, maintenance-log extractions, 12-step coupled exergy and thermal/battery storage schedules, safety margins, and Pareto carbon-switching frontiers. Also available at POST /v1/energy-decisions/audit and GET /v1/energy-decisions/health.
- verification_certificate — {verified: true, ...}
- config_decision — selected plant configuration, commissioning residual checks, and fault isolation.
- plan_decision — selected dispatch plan, safety-margin audit, and cross-configuration robustness.
- pareto_frontier — non-dominated cost vs. CO₂ dispatch frontier and exact carbon switching prices.
- execution_receipt — tamper-evident SHA-256 reproducibility digest (receipt_sha256).
{
"root": {
"case_id": "PLANT-COMMISSIONING-01",
"commissioning": { "...": "..." },
"candidate_configs": [ "..." ],
"candidate_plans": [ "..." ]
},
"carbon_price_eur_per_t": 85.0,
"use_llm_log_extractor": true,
"simulate_from_raw_schedules": true,
"proposed_config_label": "B",
"proposed_plan_label": "B"
}Models, usage, health & OpenAPI
/api/v1/world-modelLive discovery document, equipment models, and example payload on exergy-lab.com.
JSON discovery metadata (no auth required).
/api/v1/openapi.jsonLive OpenAPI 3.1.0 specification for POST /api/v1/world-model on exergy-lab.com.
OpenAPI 3.1.0 JSON schema.
/v1/modelsOpenAI-compatible list of available models.
data: [{id: "ewm-1", ...}]
/v1/models/ewm-1Capability descriptor for ewm-1.
Model metadata object.
/v1/healthService health (also /api/health).
{ok: true, status: "ok", uptime_s, endpoints}
/v1/usageActive rate-limit settings and in-flight request count.
Per-client token and verified-solve counters.
/openapi.jsonFull OpenAPI 3.1.0 specification (also /v1/openapi.json).
JSON spec for client generation.
/docsInteractive API reference and live playground (also /v1/docs).
Browser UI.