File size: 5,431 Bytes
1e3bc19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
{
  "$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}$"
    }
  }
}