Repository navigation
Expand file tree
/
Copy pathconfig.schema.json
More file actions
491 lines (491 loc) · 14.9 KB
/
Copy pathconfig.schema.json
File metadata and controls
491 lines (491 loc) · 14.9 KB
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
{
"$defs": {
"BudgetsConfig": {
"additionalProperties": false,
"description": "Where the `Budget` store (`inferrail.budgets.store.BudgetStore`)\nlives, and whether the gateway actually enforces it.\n\n`enabled` defaults to `False` so an operator who hasn't configured\nany budgets never pays for the enforcement path (and, more\nimportantly, so `inferrail serve`/`create_app` never touches\n`path` on disk at all unless budgets are explicitly turned on \u2014 see\ndocs/adr/0015-budget-enforcement.md). `inferrail budget set|list|rm`\nmanage the store's contents independently of this flag (via their\nown `--db`), so budgets can be authored before enforcement is\nswitched on.",
"properties": {
"allow_declared_budgets": {
"default": true,
"title": "Allow Declared Budgets",
"type": "boolean"
},
"enabled": {
"default": false,
"title": "Enabled",
"type": "boolean"
},
"path": {
"default": "./inferrail-budgets.db",
"title": "Path",
"type": "string"
},
"per_work_default_usd": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Per Work Default Usd"
},
"per_work_max_usd": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Per Work Max Usd"
}
},
"title": "BudgetsConfig",
"type": "object"
},
"LongContextPrice": {
"additionalProperties": false,
"description": "Rates for a request whose input tokens exceed `above_input_tokens`.\nThey replace the base rates for the whole request, not only for the\ntokens past the threshold.",
"properties": {
"above_input_tokens": {
"exclusiveMinimum": 0,
"title": "Above Input Tokens",
"type": "integer"
},
"cache_read_usd_per_million": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Cache Read Usd Per Million"
},
"input_usd_per_million": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"type": "string"
}
],
"title": "Input Usd Per Million"
},
"output_usd_per_million": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"type": "string"
}
],
"title": "Output Usd Per Million"
}
},
"required": [
"above_input_tokens",
"input_usd_per_million",
"output_usd_per_million"
],
"title": "LongContextPrice",
"type": "object"
},
"PriceEntry": {
"additionalProperties": false,
"description": "A verified per-model price, with the provenance to audit it later.\n\nUsed both for the built-in catalog (`inferrail.pricing.builtin`) and\nfor operator overrides (`InferrailConfig.pricing`). `source` and\n`verified_date` are mandatory in both cases \u2014 Inferrail never persists\na price it can't explain the origin of. Values are `Decimal`, not\n`float`: money is never computed with binary floating point here.",
"properties": {
"cache_read_usd_per_million": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Cache Read Usd Per Million"
},
"cache_write_1h_usd_per_million": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Cache Write 1H Usd Per Million"
},
"cache_write_5m_usd_per_million": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Cache Write 5M Usd Per Million"
},
"input_usd_per_million": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"type": "string"
}
],
"title": "Input Usd Per Million"
},
"long_context": {
"anyOf": [
{
"$ref": "#/$defs/LongContextPrice"
},
{
"type": "null"
}
],
"default": null
},
"output_usd_per_million": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"type": "string"
}
],
"title": "Output Usd Per Million"
},
"source": {
"title": "Source",
"type": "string"
},
"verified_date": {
"format": "date",
"title": "Verified Date",
"type": "string"
}
},
"required": [
"input_usd_per_million",
"output_usd_per_million",
"source",
"verified_date"
],
"title": "PriceEntry",
"type": "object"
},
"ProviderConfig": {
"additionalProperties": false,
"description": "A named upstream inference provider.\n\n``type: openai`` and ``type: openai_compatible`` currently resolve to\nthe same adapter (:class:`inferrail.providers.openai.OpenAIProvider`);\nlikewise ``type: anthropic``/``anthropic_compatible`` both resolve to\n:class:`inferrail.providers.anthropic.AnthropicProvider` (see\ndocs/adr/0014-anthropic-messages-passthrough.md). The ``_compatible``\nvariants exist so config reads clearly and so a self-hosted or\nthird-party endpoint that merely shares a wire format is never\nconflated with the real, verifiably-operated vendor API for pricing\npurposes (see ``pricing.resolver.PricingResolver``).",
"properties": {
"api_key_env": {
"title": "Api Key Env",
"type": "string"
},
"base_url": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Base Url"
},
"price_as": {
"anyOf": [
{
"enum": [
"openai",
"anthropic"
],
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Price As"
},
"request_stream_usage": {
"default": false,
"title": "Request Stream Usage",
"type": "boolean"
},
"type": {
"enum": [
"openai",
"openai_compatible",
"anthropic",
"anthropic_compatible"
],
"title": "Type",
"type": "string"
}
},
"required": [
"type",
"api_key_env"
],
"title": "ProviderConfig",
"type": "object"
},
"ReceiptsConfig": {
"additionalProperties": false,
"description": "Where :class:`inferrail.receipts.schema.InferenceReceipt` records go.\n\nUnlike telemetry (default: console), receipts default to a local JSONL\nfile: the whole point of a receipt is to be aggregated later by\n``inferrail report``, and console-only receipts can't be read back. See\ndocs/adr/0005-privacy-preserving-economic-receipts.md.\n\n``sqlite`` (see docs/adr/0013-sqlite-receipts-store.md) is a first-class\nalternative to ``jsonl``, not a replacement for it \u2014 indexed queries and\na bounded file per receipt (vs. an ever-growing text file) at the cost\nof needing ``inferrail receipts export`` to get a plain-text copy back.\n``inferrail report``/``transaction``/``work`` work unchanged against\neither: they detect which one a given path actually is.",
"properties": {
"path": {
"default": "./inferrail-receipts.jsonl",
"title": "Path",
"type": "string"
},
"sink": {
"default": "jsonl",
"enum": [
"jsonl",
"sqlite",
"none"
],
"title": "Sink",
"type": "string"
}
},
"title": "ReceiptsConfig",
"type": "object"
},
"RouteConfig": {
"additionalProperties": false,
"description": "A named route: what a client selects via the request's ``model`` field.",
"properties": {
"max_retries": {
"default": 0,
"maximum": 5,
"minimum": 0,
"title": "Max Retries",
"type": "integer"
},
"model": {
"title": "Model",
"type": "string"
},
"provider": {
"title": "Provider",
"type": "string"
},
"timeout_seconds": {
"default": 30.0,
"exclusiveMinimum": 0,
"maximum": 600,
"title": "Timeout Seconds",
"type": "number"
}
},
"required": [
"provider",
"model"
],
"title": "RouteConfig",
"type": "object"
},
"ServerConfig": {
"additionalProperties": false,
"properties": {
"host": {
"default": "127.0.0.1",
"title": "Host",
"type": "string"
},
"port": {
"default": 8000,
"exclusiveMinimum": 0,
"maximum": 65535,
"title": "Port",
"type": "integer"
}
},
"title": "ServerConfig",
"type": "object"
},
"TelemetryConfig": {
"additionalProperties": false,
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"sink": {
"default": "console",
"enum": [
"console",
"jsonl",
"none"
],
"title": "Sink",
"type": "string"
}
},
"title": "TelemetryConfig",
"type": "object"
},
"UsagePingConfig": {
"additionalProperties": false,
"description": "The anonymous usage/presence beacon\n(docs/adr/0020-quickstart-both-sdks-and-payload-free-verification.md,\nsuperseding docs/adr/0019-opt-in-usage-ping.md's \"default off\").\n\n**Opt-out by default** (`enabled: bool = True`) \u2014 a deliberate,\nexplicit reversal of ADR-0019's original \"default off\" decision, at\nthe founder's direction, recorded in ADR-0020 rather than silently\nchanged. Still fully inert with no `endpoint` configured regardless\nof `enabled` \u2014 there is no built-in default endpoint baked into this\npackage; an operator (or, for the desktop dashboard's toggle, the\nperson running `inferrail serve` on their own machine) must\nexplicitly point this at a real collector before anything can ever be\nsent. The payload is fixed and minimal (see\n`usage_ping.payload.build_payload`): a locally-generated random\ninstall id, event name, Inferrail version, OS, Python major.minor \u2014\nnever a prompt, response, model name, cost, work_id, project name,\nIP address, or anything about the traffic this install actually\nhandles. See `docs/privacy/usage-ping.md` for the full disclosure,\nand `INFERRAIL_TELEMETRY=0` / `--no-telemetry` / `DO_NOT_TRACK=1` /\nrunning under CI or the test suite for how to turn it off.\n\n`enabled` here is only the *config-file* default. Once\n`inferrail serve` has run once, the dashboard's Settings toggle (and\n`inferrail telemetry enable|disable`) control a separate, mutable\non/off state under the OS app-data directory that takes over from\nthis default \u2014 the same \"config seeds it, a store owns it after\nthat\" pattern `budgets`/`receipts` already use under `--app-mode`.",
"properties": {
"enabled": {
"default": true,
"title": "Enabled",
"type": "boolean"
},
"endpoint": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Endpoint"
}
},
"title": "UsagePingConfig",
"type": "object"
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"budgets": {
"$ref": "#/$defs/BudgetsConfig"
},
"default_anthropic_provider": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Default Anthropic Provider"
},
"default_provider": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Default Provider"
},
"pricing": {
"additionalProperties": {
"additionalProperties": {
"$ref": "#/$defs/PriceEntry"
},
"type": "object"
},
"title": "Pricing",
"type": "object"
},
"providers": {
"additionalProperties": {
"$ref": "#/$defs/ProviderConfig"
},
"title": "Providers",
"type": "object"
},
"receipts": {
"$ref": "#/$defs/ReceiptsConfig"
},
"routes": {
"additionalProperties": {
"$ref": "#/$defs/RouteConfig"
},
"title": "Routes",
"type": "object"
},
"server": {
"$ref": "#/$defs/ServerConfig"
},
"telemetry": {
"$ref": "#/$defs/TelemetryConfig"
},
"usage_ping": {
"$ref": "#/$defs/UsagePingConfig"
},
"work_id_headers": {
"items": {
"type": "string"
},
"title": "Work Id Headers",
"type": "array"
}
},
"required": [
"providers"
],
"title": "Inferrail configuration (inferrail.yaml)",
"type": "object"
}