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.

8 min readPrivate beta

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.
FieldTypeRequiredRange / DefaultDescription
target_heat_duty_kwnumberYes5 to 5,000Target thermal duty in kW.
source_inlet_temp_cnumberYes15 to 110Heat-source inlet temperature in °C.
supply_temp_cnumberYes50 to 190 (> source + 5 °C)Required process supply temperature in °C.
lockout_duration_hoursnumberNo0 to 24 (default 2)Peak-tariff thermal-storage lockout duration in hours.
equipment_idstringNoAuto-selectedOptional fixed equipment model ID (discover via GET /api/v1/world-model).
electricity_price_per_kwhnumberNo> 0 to 2Electricity rate ($/kWh) for baseline comparisons.
natural_gas_price_per_kwhnumberNo> 0 to 2Natural gas rate ($/kWh) for baseline comparisons.
grid_carbon_kg_per_kwhnumberNo0 to 2Grid 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.

FieldTypeRequiredDefaultDescription
modelstringYes"ewm-1"ID of the model to use.
messagesarrayYes—Message objects: {role: system | user | assistant, content}.
streambooleanNofalseStream chat.completion.chunk SSE events ending with data: [DONE].
response_formatobjectNo{type: "text"}Set {type: "json_object"} to skip prose and return verified structured_output JSON in choices[0].message.content.
skip_composerbooleanNofalseSkip the prose composer stage for lower latency.
200 OK · json
{
  "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.

FieldTypeRequiredDefaultDescription
promptstringYes—Engineering problem statement, up to 60,000 characters.
streambooleanNofalseStream multi-stage SSE events (stage, solver_delta, code, exec_result, composer_delta, done).
skip_composerbooleanNofalseReturn immediately after sandbox verification, without the prose report.
include_codebooleanNotrueInclude the generated Python script in verification.code.
include_stdoutbooleanNotrueInclude raw sandbox stdout and stderr in verification.
200 OK · json
{
  "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).
Request body · json
{
  "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

GET/api/v1/world-model

Live discovery document, equipment models, and example payload on exergy-lab.com.

JSON discovery metadata (no auth required).

GET/api/v1/openapi.json

Live OpenAPI 3.1.0 specification for POST /api/v1/world-model on exergy-lab.com.

OpenAPI 3.1.0 JSON schema.

GET/v1/models

OpenAI-compatible list of available models.

data: [{id: "ewm-1", ...}]

GET/v1/models/ewm-1

Capability descriptor for ewm-1.

Model metadata object.

GET/v1/health

Service health (also /api/health).

{ok: true, status: "ok", uptime_s, endpoints}

GET/v1/usage

Active rate-limit settings and in-flight request count.

Per-client token and verified-solve counters.

GET/openapi.json

Full OpenAPI 3.1.0 specification (also /v1/openapi.json).

JSON spec for client generation.

GET/docs

Interactive API reference and live playground (also /v1/docs).

Browser UI.