Your first audited inference¶
A complete worked example. Same shape as OpenAI Chat Completions, with a flat vetted block carrying the per-query environmental receipt.
The minimal call¶
from openai import OpenAI
client = OpenAI(
base_url="https://api.vettedinference.com/v1",
api_key=VETTED_API_KEY,
)
response = client.chat.completions.create(
model="mistral-medium-3",
messages=[
{"role": "user", "content": "Explain CSRD double materiality in two sentences."}
],
)
print(response.choices[0].message.content)
What you get back¶
{
"id": "chatcmpl-vi-9f3c2e",
"object": "chat.completion",
"created": 1746604320,
"model": "mistral-medium-3",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "CSRD double materiality requires reporting on..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 78,
"total_tokens": 102
},
"routing_trace": {
"route_policy": "lowest_carbon",
"decision_mode": "degraded",
"decision_reason": "degraded_no_operational_live_signal",
"operational_signal": {
"source": "energinet_forecast_live",
"signal_kind": "forecast",
"gco2_per_kwh": 46.0,
"observed_at": "2026-05-19T12:00:00Z",
"requested_at": "2026-05-19T12:05:00Z",
"age_minutes": 5.0,
"temporal_match": "live_window",
"live_eligible": true
},
"receipt_signal": {
"source": "ember",
"signal_kind": "fallback",
"gco2_per_kwh": 270.0,
"observed_at": "2026-01-01T00:00:00Z",
"requested_at": "2026-05-19T12:05:00Z",
"age_minutes": 200736.0,
"temporal_match": "annual_fallback",
"live_eligible": false
}
},
"vetted": {
"query_id": "4c1d4f4d-7fb6-47f7-9d80-a9c2b149c7f6",
"tier": "parametric",
"gco2e": 0.21,
"gco2e_ci90_lo": 0.15,
"gco2e_ci90_hi": 0.31,
"ml_water": 8.4,
"ml_water_ci90_lo": 6.1,
"ml_water_ci90_hi": 11.8,
"methodology_version": "0.1.0",
"methodology_hash": "abc123def4567890",
"pedigree_score": 2.5,
"route_taken": "scaleway:fr-par-1",
"grid_zone": "fr-par-1",
"grid_intensity_gco2_per_kwh": 58.0,
"grid_intensity_source": "entsoe_derived_live",
"grid_intensity_observed_at": "2026-05-17T12:00:00Z",
"grid_intensity_requested_at": "2026-05-17T12:07:00Z",
"grid_intensity_age_minutes": 7.0,
"grid_temporal_match": "live_window",
"audit_missing": false
}
}
Reading the receipt¶
| Field | Meaning |
|---|---|
query_id |
Stable ID for the receipt and audit-ledger record. |
tier |
One of proxy, parametric, telemetry, audited. |
gco2e / gco2e_ci90_* |
Best estimate and 90% interval for climate impact. |
ml_water / ml_water_ci90_* |
Best estimate and 90% interval for water impact. |
pedigree_score |
Composite data-quality score used by the methodology. |
grid_intensity_gco2_per_kwh |
Grid intensity value actually used in the calculation. |
grid_intensity_source |
Machine-readable provenance label, for example entsoe_derived_live, entsoe_derived_prev_week, neefe, ipcc_default, or native. |
grid_intensity_observed_at |
Timestamp of the source observation used. |
grid_intensity_requested_at |
Timestamp of the inference we were trying to match. |
grid_intensity_age_minutes |
Absolute difference between requested and observed timestamps. |
grid_temporal_match |
Match class such as live_window, prev_week_fallback, annual_fallback, or default_fallback. |
audit_missing |
true only when the response succeeded but the ledger write had to be queued for retry. |
Reading the routing trace¶
The additive routing_trace block is operational, not receipt-grade. It tells you what the control plane used for routing and whether the request had to degrade out of strict carbon-aware routing.
| Field | Meaning |
|---|---|
decision_mode |
normal when routing used a fresh operational live signal, degraded when it had to fall back to the standard provider-preference path. |
decision_reason |
Machine-readable reason such as operational_live_signal or degraded_no_operational_live_signal. |
operational_signal.signal_kind |
One of measured, forecast, provisional, or fallback. |
receipt_signal.* |
Conservative signal that actually fed the receipt calculation. This can be weaker than the operational signal. |
Temporal integrity¶
For ENTSO-E receipts, entsoe_derived_live means the source timestamp was within +/-15 minutes of the inference timestamp. If that is not true, the system falls back and the receipt tells you so.
This is deliberate. We would rather return a clearly-labeled fallback than pretend an older source point was live.
Streaming¶
Streaming responses include the vetted block in the final SSE event: