{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "model-execution-receipt.schema.json", "title": "ModelExecutionReceipt", "description": "One physical execution of a model or deterministic component. A provider's model id does not prove the exact weights: an unobserved revision is 'unknown'. Unobserved usage is 'unknown', never zero. environment='fake' marks a test double. R4 (OPS request of R3, compatible): the gateway, which is the source of the receipt, may add cost (with its status: zero_fixture, known, upper_bound or unknown, and unknown is never zero, so its usd is null), latency_ms and what the provider SAID it ran (model_observed, revision_observed). A receipt without them is still valid; a reader that does not know them may ignore them.", "type": "object", "additionalProperties": false, "required": [ "schema_version", "execution_id", "attempt_id", "environment", "provider", "model_id", "revision", "prompt_hash", "template_hash", "schema_hash", "adapter_hash", "started_at", "completed_at", "attempts", "usage", "output_hash", "error_class" ], "properties": { "schema_version": { "$ref": "common.schema.json#/$defs/schema_version" }, "execution_id": { "$ref": "common.schema.json#/$defs/id" }, "attempt_id": { "type": [ "string", "null" ], "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$" }, "environment": { "$ref": "common.schema.json#/$defs/environment" }, "provider": { "type": "string", "minLength": 1, "maxLength": 80 }, "model_id": { "type": "string", "minLength": 1, "maxLength": 200 }, "revision": { "type": "string", "pattern": "^(unknown|[0-9a-f]{7,64}|[A-Za-z0-9._-]{1,64})$" }, "prompt_hash": { "type": [ "string", "null" ], "pattern": "^[0-9a-f]{64}$" }, "template_hash": { "type": [ "string", "null" ], "pattern": "^[0-9a-f]{64}$" }, "schema_hash": { "type": [ "string", "null" ], "pattern": "^[0-9a-f]{64}$" }, "adapter_hash": { "type": [ "string", "null" ], "pattern": "^[0-9a-f]{64}$" }, "started_at": { "$ref": "common.schema.json#/$defs/utc" }, "completed_at": { "type": [ "string", "null" ], "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|\\+00:00)$" }, "attempts": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, "usage": { "type": "object", "additionalProperties": false, "required": [ "status" ], "properties": { "status": { "enum": [ "known", "unknown" ] }, "input_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "output_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "hardware_seconds": { "type": "number", "minimum": 0, "maximum": 9007199254740991 } } }, "output_hash": { "type": [ "string", "null" ], "pattern": "^[0-9a-f]{64}$" }, "error_class": { "type": [ "string", "null" ], "enum": [ null, "timeout", "rate_limited", "provider_error", "schema_refused", "rights_refused", "cancelled", "late" ] }, "cost": { "description": "What the attempt cost. unknown means no price or no usage was recorded and carries usd null; upper_bound is endpoint hot time x hourly price.", "type": "object", "additionalProperties": false, "required": [ "usd", "status", "basis" ], "properties": { "usd": { "type": [ "number", "null" ], "minimum": 0, "maximum": 1000000 }, "status": { "enum": [ "zero_fixture", "known", "upper_bound", "unknown" ] }, "basis": { "type": "string", "minLength": 1, "maxLength": 300 }, "budget_ref": { "type": [ "string", "null" ], "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]{0,119}$" } } }, "latency_ms": { "description": "Wall time of the attempt as the gateway measured it.", "type": [ "number", "null" ], "minimum": 0, "maximum": 86400000 }, "model_observed": { "description": "The model id the provider said answered (a vendor id or an endpoint repository); null when it said nothing.", "type": [ "string", "null" ], "minLength": 1, "maxLength": 200 }, "revision_observed": { "description": "The revision the endpoint said it served; null when not reported.", "type": [ "string", "null" ], "pattern": "^[A-Za-z0-9._-]{1,64}$" } } }