docket-ai 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docket/__init__.py +43 -0
- docket/__main__.py +6 -0
- docket/_vendor/vectors/cache-digest.json +12 -0
- docket/_vendor/vectors/cache.json +464 -0
- docket/_vendor/vectors/canonical.json +44 -0
- docket/_vendor/vectors/generate.py +291 -0
- docket/_vendor/vectors/invalid/01-format-unknown.expected.json +10 -0
- docket/_vendor/vectors/invalid/01-format-unknown.json +515 -0
- docket/_vendor/vectors/invalid/02-totals-not-object.expected.json +10 -0
- docket/_vendor/vectors/invalid/02-totals-not-object.json +475 -0
- docket/_vendor/vectors/invalid/03-nan-in-totals.expected.json +15 -0
- docket/_vendor/vectors/invalid/03-nan-in-totals.json +1 -0
- docket/_vendor/vectors/invalid/04-infinity-in-totals.expected.json +15 -0
- docket/_vendor/vectors/invalid/04-infinity-in-totals.json +1 -0
- docket/_vendor/vectors/invalid/05-duplicate-member.expected.json +15 -0
- docket/_vendor/vectors/invalid/05-duplicate-member.json +1 -0
- docket/_vendor/vectors/invalid/06-top-level-list.expected.json +10 -0
- docket/_vendor/vectors/invalid/06-top-level-list.json +517 -0
- docket/_vendor/vectors/invalid/07-chain-edited-event.expected.json +10 -0
- docket/_vendor/vectors/invalid/07-chain-edited-event.json +515 -0
- docket/_vendor/vectors/invalid/08-head-mismatch.expected.json +10 -0
- docket/_vendor/vectors/invalid/08-head-mismatch.json +515 -0
- docket/_vendor/vectors/invalid/09-event-count-mismatch.expected.json +10 -0
- docket/_vendor/vectors/invalid/09-event-count-mismatch.json +515 -0
- docket/_vendor/vectors/invalid/10-merkle-root-mismatch.expected.json +10 -0
- docket/_vendor/vectors/invalid/10-merkle-root-mismatch.json +515 -0
- docket/_vendor/vectors/invalid/11-ledger-trailing-byte.expected.json +10 -0
- docket/_vendor/vectors/invalid/11-ledger-trailing-byte.json +515 -0
- docket/_vendor/vectors/invalid/12-event-with-float.expected.json +10 -0
- docket/_vendor/vectors/invalid/12-event-with-float.json +515 -0
- docket/_vendor/vectors/invalid/13-usage-proof-tampered.expected.json +10 -0
- docket/_vendor/vectors/invalid/13-usage-proof-tampered.json +515 -0
- docket/_vendor/vectors/invalid/14-usage-row-without-proof.expected.json +10 -0
- docket/_vendor/vectors/invalid/14-usage-row-without-proof.json +497 -0
- docket/_vendor/vectors/invalid/15-usage-row-rebound.expected.json +10 -0
- docket/_vendor/vectors/invalid/15-usage-row-rebound.json +515 -0
- docket/_vendor/vectors/invalid/16-usage-seq-outside.expected.json +10 -0
- docket/_vendor/vectors/invalid/16-usage-seq-outside.json +515 -0
- docket/_vendor/vectors/invalid/17-cost-row-mismatch.expected.json +10 -0
- docket/_vendor/vectors/invalid/17-cost-row-mismatch.json +515 -0
- docket/_vendor/vectors/invalid/18-totals-mismatch.expected.json +10 -0
- docket/_vendor/vectors/invalid/18-totals-mismatch.json +515 -0
- docket/_vendor/vectors/invalid/19-token-totals-mismatch.expected.json +10 -0
- docket/_vendor/vectors/invalid/19-token-totals-mismatch.json +515 -0
- docket/_vendor/vectors/invalid/20-latency-summary-mismatch.expected.json +10 -0
- docket/_vendor/vectors/invalid/20-latency-summary-mismatch.json +515 -0
- docket/_vendor/vectors/invalid/21-usage-source-unknown.expected.json +10 -0
- docket/_vendor/vectors/invalid/21-usage-source-unknown.json +515 -0
- docket/_vendor/vectors/invalid/22-limits-disclosure-missing.expected.json +10 -0
- docket/_vendor/vectors/invalid/22-limits-disclosure-missing.json +481 -0
- docket/_vendor/vectors/invalid/23-cache-saved-mismatch.expected.json +10 -0
- docket/_vendor/vectors/invalid/23-cache-saved-mismatch.json +464 -0
- docket/_vendor/vectors/invalid/24-cache-origin-wrong.expected.json +10 -0
- docket/_vendor/vectors/invalid/24-cache-origin-wrong.json +464 -0
- docket/_vendor/vectors/invalid/25-cache-proof-tampered.expected.json +10 -0
- docket/_vendor/vectors/invalid/25-cache-proof-tampered.json +464 -0
- docket/_vendor/vectors/invalid/26-cache-hits-mismatch.expected.json +10 -0
- docket/_vendor/vectors/invalid/26-cache-hits-mismatch.json +464 -0
- docket/_vendor/vectors/invalid/27-assumed-price-undisclosed.expected.json +10 -0
- docket/_vendor/vectors/invalid/27-assumed-price-undisclosed.json +512 -0
- docket/_vendor/vectors/invalid/28-totals-call-count.expected.json +10 -0
- docket/_vendor/vectors/invalid/28-totals-call-count.json +515 -0
- docket/_vendor/vectors/invalid/29-totals-input-tokens.expected.json +10 -0
- docket/_vendor/vectors/invalid/29-totals-input-tokens.json +515 -0
- docket/_vendor/vectors/invalid/30-totals-token-split.expected.json +10 -0
- docket/_vendor/vectors/invalid/30-totals-token-split.json +515 -0
- docket/_vendor/vectors/invalid/31-utf8-bom.expected.json +13 -0
- docket/_vendor/vectors/invalid/31-utf8-bom.json +1 -0
- docket/_vendor/vectors/invalid/32-trailing-bytes.expected.json +13 -0
- docket/_vendor/vectors/invalid/32-trailing-bytes.json +2 -0
- docket/_vendor/vectors/invalid/33-invalid-utf8.expected.json +13 -0
- docket/_vendor/vectors/invalid/33-invalid-utf8.json +1 -0
- docket/_vendor/vectors/invalid/34-integral-float-accepted.expected.json +10 -0
- docket/_vendor/vectors/invalid/34-integral-float-accepted.json +1 -0
- docket/_vendor/vectors/invalid/35-negative-zero-accepted.expected.json +10 -0
- docket/_vendor/vectors/invalid/35-negative-zero-accepted.json +1 -0
- docket/_vendor/vectors/invalid/36-non-nfc-accepted.expected.json +10 -0
- docket/_vendor/vectors/invalid/36-non-nfc-accepted.json +1 -0
- docket/_vendor/vectors/invalid/37-ledger-duplicate-name.expected.json +15 -0
- docket/_vendor/vectors/invalid/37-ledger-duplicate-name.json +515 -0
- docket/_vendor/vectors/invalid/38-ledger-truncated-line.expected.json +13 -0
- docket/_vendor/vectors/invalid/38-ledger-truncated-line.json +515 -0
- docket/_vendor/vectors/invalid/39-by-model-invents-a-model.expected.json +10 -0
- docket/_vendor/vectors/invalid/39-by-model-invents-a-model.json +515 -0
- docket/_vendor/vectors/invalid/40-usage-counts-say-reported.expected.json +10 -0
- docket/_vendor/vectors/invalid/40-usage-counts-say-reported.json +515 -0
- docket/_vendor/vectors/invalid/41-cost-basis-is-a-contradiction.expected.json +10 -0
- docket/_vendor/vectors/invalid/41-cost-basis-is-a-contradiction.json +515 -0
- docket/_vendor/vectors/invalid/42-quota-mode-basis-is-accepted.expected.json +10 -0
- docket/_vendor/vectors/invalid/42-quota-mode-basis-is-accepted.json +515 -0
- docket/_vendor/vectors/invalid/base.ledger.jsonl +12 -0
- docket/_vendor/vectors/invalid/build.py +944 -0
- docket/_vendor/vectors/invalid/ledgers/07-chain-edited-event.jsonl +12 -0
- docket/_vendor/vectors/invalid/ledgers/11-ledger-trailing-byte.jsonl +13 -0
- docket/_vendor/vectors/invalid/ledgers/12-event-with-float.jsonl +12 -0
- docket/_vendor/vectors/invalid/ledgers/37-ledger-duplicate-name.jsonl +1 -0
- docket/_vendor/vectors/invalid/ledgers/38-ledger-truncated-line.jsonl +13 -0
- docket/_vendor/vectors/ledger.json +271 -0
- docket/_vendor/vectors/merkle.json +134 -0
- docket/_vendor/vectors/receipt-digest.json +5 -0
- docket/_vendor/vectors/receipt.json +515 -0
- docket/_vendor/verify.mjs +1222 -0
- docket/cache.py +518 -0
- docket/canon.py +240 -0
- docket/chaos.py +1207 -0
- docket/cli.py +1469 -0
- docket/demo.py +348 -0
- docket/diagnostics.py +726 -0
- docket/events.py +133 -0
- docket/explain.py +353 -0
- docket/fakeupstream.py +402 -0
- docket/fsdiff.py +140 -0
- docket/latency.py +124 -0
- docket/ledger.py +781 -0
- docket/loaddriver.py +364 -0
- docket/policy.py +774 -0
- docket/prices.json +145 -0
- docket/pricing.py +469 -0
- docket/proxy.py +1842 -0
- docket/receipt.py +417 -0
- docket/report.py +425 -0
- docket/resilience.py +681 -0
- docket/scriptagent.py +233 -0
- docket/sdk.py +375 -0
- docket/signing.py +178 -0
- docket/snapshot.py +607 -0
- docket/supervisor.py +844 -0
- docket/util.py +375 -0
- docket/verify.py +1297 -0
- docket_ai-0.1.0.dist-info/METADATA +408 -0
- docket_ai-0.1.0.dist-info/RECORD +134 -0
- docket_ai-0.1.0.dist-info/WHEEL +4 -0
- docket_ai-0.1.0.dist-info/entry_points.txt +2 -0
- docket_ai-0.1.0.dist-info/licenses/LICENSE +216 -0
docket/__init__.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Docket — every agent run gets a docket number.
|
|
2
|
+
|
|
3
|
+
Docket is a local-first supervisor and evidence layer for AI agents:
|
|
4
|
+
|
|
5
|
+
* **Bounded** — it enforces hard caps (USD, tokens, wall-clock, call counts) at the
|
|
6
|
+
boundary and stops the process when a cap is crossed.
|
|
7
|
+
* **Legible** — it records model traffic, tool calls, filesystem changes, egress
|
|
8
|
+
decisions and process lifecycle into an append-only, hash-chained ledger.
|
|
9
|
+
* **Provable** — it emits a *receipt* whose integrity can be checked offline by a
|
|
10
|
+
third party who trusts neither the operator nor this tool, and whose cost totals
|
|
11
|
+
can be recomputed from raw usage numbers.
|
|
12
|
+
|
|
13
|
+
The public API is intentionally small. Most users want the CLI (``docket run``);
|
|
14
|
+
library users want :func:`record`, :class:`Session` and :func:`verify_receipt`.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from .ledger import Event, Ledger
|
|
20
|
+
from .policy import Caps, Policy
|
|
21
|
+
from .receipt import build_receipt, load_receipt, write_receipt
|
|
22
|
+
from .sdk import Session, record_model_call, record_note, record_tool
|
|
23
|
+
from .verify import VerifyResult, verify_receipt
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
"Ledger",
|
|
27
|
+
"Event",
|
|
28
|
+
"Policy",
|
|
29
|
+
"Caps",
|
|
30
|
+
"build_receipt",
|
|
31
|
+
"write_receipt",
|
|
32
|
+
"load_receipt",
|
|
33
|
+
"verify_receipt",
|
|
34
|
+
"VerifyResult",
|
|
35
|
+
"Session",
|
|
36
|
+
"record_model_call",
|
|
37
|
+
"record_note",
|
|
38
|
+
"record_tool",
|
|
39
|
+
"__version__",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
__version__ = "0.1.0"
|
|
43
|
+
FORMAT_VERSION = "docket/receipt/v1"
|
docket/__main__.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "docket/vectors/cache-digest/v1",
|
|
3
|
+
"note": "sha256 of the canonical JSON of the cached receipt with seal and signature removed",
|
|
4
|
+
"receipt_core_sha256": "bbdd545947b40d1e5f489bf7b62ee05201328adda8f9c9b6715184ed923a8639",
|
|
5
|
+
"expected": {
|
|
6
|
+
"hits": 2,
|
|
7
|
+
"saved_usd": "0.012000",
|
|
8
|
+
"avoided_tokens": 2400,
|
|
9
|
+
"spend_usd": "0.006000",
|
|
10
|
+
"metered_calls": 1
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "docket/receipt/v1",
|
|
3
|
+
"docket_number": "DKT-20260102-VECHC1",
|
|
4
|
+
"label": null,
|
|
5
|
+
"created_at": "2026-01-02T03:04:05Z",
|
|
6
|
+
"tool": {
|
|
7
|
+
"name": "docket",
|
|
8
|
+
"version": "0.1.0",
|
|
9
|
+
"format": "docket/receipt/v1"
|
|
10
|
+
},
|
|
11
|
+
"session": {
|
|
12
|
+
"id": "vectorcache",
|
|
13
|
+
"argv": [
|
|
14
|
+
"agent",
|
|
15
|
+
"--task",
|
|
16
|
+
"cache-vector"
|
|
17
|
+
],
|
|
18
|
+
"cwd": "/srv/vectors",
|
|
19
|
+
"exit_code": 0,
|
|
20
|
+
"duration_seconds": "1.250",
|
|
21
|
+
"breached": null,
|
|
22
|
+
"interrupted": false,
|
|
23
|
+
"host": {
|
|
24
|
+
"platform": "vector",
|
|
25
|
+
"python": "3.13.0",
|
|
26
|
+
"machine": "x86_64"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"policy": {
|
|
30
|
+
"name": "vector-cache",
|
|
31
|
+
"digest": "9573b27fbc78682d0ff5d75c8e5b9e609bbd11b3c66fa6a091eb91eebb69a7ee",
|
|
32
|
+
"document": {
|
|
33
|
+
"name": "vector-cache",
|
|
34
|
+
"caps": {
|
|
35
|
+
"max_usd": "5.00",
|
|
36
|
+
"max_tokens": null,
|
|
37
|
+
"max_model_calls": null,
|
|
38
|
+
"max_wall_seconds": null,
|
|
39
|
+
"warn_at": "0.8",
|
|
40
|
+
"on_breach": "kill",
|
|
41
|
+
"grace_seconds": 5
|
|
42
|
+
},
|
|
43
|
+
"models": {
|
|
44
|
+
"allow": [],
|
|
45
|
+
"deny": []
|
|
46
|
+
},
|
|
47
|
+
"egress": {
|
|
48
|
+
"mode": "deny",
|
|
49
|
+
"allow": [
|
|
50
|
+
"api.anthropic.com",
|
|
51
|
+
"api.openai.com",
|
|
52
|
+
"generativelanguage.googleapis.com",
|
|
53
|
+
"api.deepseek.com",
|
|
54
|
+
"api.mistral.ai",
|
|
55
|
+
"openrouter.ai",
|
|
56
|
+
"api.groq.com",
|
|
57
|
+
"localhost",
|
|
58
|
+
"127.0.0.1"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"files": {
|
|
62
|
+
"watch": [
|
|
63
|
+
"."
|
|
64
|
+
],
|
|
65
|
+
"ignore": [],
|
|
66
|
+
"deny_write": []
|
|
67
|
+
},
|
|
68
|
+
"budget": {
|
|
69
|
+
"mode": "usd"
|
|
70
|
+
},
|
|
71
|
+
"resilience": {
|
|
72
|
+
"breaker_threshold": 5,
|
|
73
|
+
"breaker_cooldown_seconds": 30,
|
|
74
|
+
"breaker_max_cooldown_seconds": 300,
|
|
75
|
+
"max_calls_per_minute": null,
|
|
76
|
+
"max_calls_per_second": null,
|
|
77
|
+
"max_events": null,
|
|
78
|
+
"max_ledger_bytes": 268435456,
|
|
79
|
+
"fail_fast_evidence": false,
|
|
80
|
+
"min_free_bytes": 16777216
|
|
81
|
+
},
|
|
82
|
+
"cache": {
|
|
83
|
+
"enabled": true,
|
|
84
|
+
"ttl_seconds": 60,
|
|
85
|
+
"max_entries": 8,
|
|
86
|
+
"max_hits": 3
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"source": null
|
|
90
|
+
},
|
|
91
|
+
"totals": {
|
|
92
|
+
"calls": 1,
|
|
93
|
+
"input_tokens": 1000,
|
|
94
|
+
"cached_input_tokens": 0,
|
|
95
|
+
"output_tokens": 200,
|
|
96
|
+
"total_tokens": 1200,
|
|
97
|
+
"cost_usd": "0.006000",
|
|
98
|
+
"cost_basis": "reported: provider usage fields",
|
|
99
|
+
"usage_reported_calls": 1,
|
|
100
|
+
"usage_estimated_calls": 0,
|
|
101
|
+
"asserted_calls": 0,
|
|
102
|
+
"assumed_price_models": [],
|
|
103
|
+
"by_model": [
|
|
104
|
+
{
|
|
105
|
+
"model": "claude-sonnet-5",
|
|
106
|
+
"calls": 1,
|
|
107
|
+
"input_tokens": 1000,
|
|
108
|
+
"cached_input_tokens": 0,
|
|
109
|
+
"output_tokens": 200,
|
|
110
|
+
"cost_usd": "0.006000"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"model_calls": {
|
|
115
|
+
"count": 1,
|
|
116
|
+
"by_provider": {
|
|
117
|
+
"vector": 1
|
|
118
|
+
},
|
|
119
|
+
"denied": 0,
|
|
120
|
+
"errors": 0
|
|
121
|
+
},
|
|
122
|
+
"tools": {
|
|
123
|
+
"calls": 0,
|
|
124
|
+
"names": [],
|
|
125
|
+
"failures": 0
|
|
126
|
+
},
|
|
127
|
+
"files": {
|
|
128
|
+
"changed": 0,
|
|
129
|
+
"added": 0,
|
|
130
|
+
"modified": 0,
|
|
131
|
+
"removed": 0,
|
|
132
|
+
"violations": 0,
|
|
133
|
+
"top_paths": []
|
|
134
|
+
},
|
|
135
|
+
"network": {
|
|
136
|
+
"tunnels_allowed": 0,
|
|
137
|
+
"tunnels_denied": 0
|
|
138
|
+
},
|
|
139
|
+
"caps": {
|
|
140
|
+
"exceeded": 0,
|
|
141
|
+
"warnings": 0
|
|
142
|
+
},
|
|
143
|
+
"event_counts": {
|
|
144
|
+
"session.start": 1,
|
|
145
|
+
"policy.applied": 1,
|
|
146
|
+
"model.request": 1,
|
|
147
|
+
"model.response": 1,
|
|
148
|
+
"model.cache_hit": 2,
|
|
149
|
+
"note": 1,
|
|
150
|
+
"session.end": 1
|
|
151
|
+
},
|
|
152
|
+
"ledger": {
|
|
153
|
+
"format": "docket/ledger/v1",
|
|
154
|
+
"events": 8,
|
|
155
|
+
"head": "6c8fbba672c5886065598a4d52f040232c1d4728eb4ecc09a5905d73ce5c5ab3",
|
|
156
|
+
"genesis": "adf41ffdf0fd9128f8f4fe88fa09fba359e27453b02be87886b621a2c2b0f7dc",
|
|
157
|
+
"merkle_root": "bb98a9fb04ba75b1dbf44c75d97affcf0d884505447738db9c5d2bcd42afd9bc",
|
|
158
|
+
"file_sha256": "00fed5bc26d0d3b268516fd0f6f5f593266a656befe53f27501b324fa0965a57",
|
|
159
|
+
"chain": "sha256(prev + canonical_json(event))"
|
|
160
|
+
},
|
|
161
|
+
"price_table": {
|
|
162
|
+
"schema": "docket/prices/v1",
|
|
163
|
+
"as_of": "2026-10-13",
|
|
164
|
+
"digest": "61cd61c7fe295ef1e93b41907c0d73c5075aa63c6d730c325c4e9def95cc53f0",
|
|
165
|
+
"document": {
|
|
166
|
+
"_meta": {
|
|
167
|
+
"schema": "docket/prices/v1",
|
|
168
|
+
"as_of": "2026-10-13",
|
|
169
|
+
"currency": "USD",
|
|
170
|
+
"unit": "per_million_tokens",
|
|
171
|
+
"note": "List prices for public APIs, used to ESTIMATE cost from token counts reported by the provider. Docket never bills anyone and never claims these are the prices you pay: negotiated, regional, batch, flex, priority and subscription pricing all differ. Amounts are strings to keep verification reproducible across languages.",
|
|
172
|
+
"sources": [
|
|
173
|
+
"https://developers.openai.com/api/docs/pricing",
|
|
174
|
+
"https://www.anthropic.com/pricing",
|
|
175
|
+
"https://ai.google.dev/gemini-api/docs/pricing",
|
|
176
|
+
"https://api-docs.deepseek.com/quick_start/pricing"
|
|
177
|
+
],
|
|
178
|
+
"matched_by": "fnmatch-style glob, case-insensitive, FIRST MATCH IN FILE ORDER WINS, so narrower families must be listed before wider ones (see gpt-6-luna* before gpt-6*)"
|
|
179
|
+
},
|
|
180
|
+
"families": [
|
|
181
|
+
{
|
|
182
|
+
"pattern": "gpt-6-luna*",
|
|
183
|
+
"input": "0.10",
|
|
184
|
+
"cached_input": "0.01",
|
|
185
|
+
"output": "0.50",
|
|
186
|
+
"source": "OpenAI, standard tier, smallest of the gpt-6 family (must precede gpt-6*)"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"pattern": "gpt-6.1*",
|
|
190
|
+
"input": "2.00",
|
|
191
|
+
"cached_input": "0.10",
|
|
192
|
+
"output": "10.00",
|
|
193
|
+
"source": "OpenAI, standard tier, short context"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"pattern": "gpt-6*",
|
|
197
|
+
"input": "10.00",
|
|
198
|
+
"cached_input": "1.00",
|
|
199
|
+
"output": "50.00",
|
|
200
|
+
"source": "OpenAI, standard tier, short context (flagship tier)"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"pattern": "gpt-5.6*",
|
|
204
|
+
"input": "4.00",
|
|
205
|
+
"cached_input": "0.40",
|
|
206
|
+
"output": "20.00",
|
|
207
|
+
"source": "OpenAI, standard tier, short context"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"pattern": "gpt-5*",
|
|
211
|
+
"input": "1.25",
|
|
212
|
+
"cached_input": "0.125",
|
|
213
|
+
"output": "10.00",
|
|
214
|
+
"source": "OpenAI, standard tier, short context"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"pattern": "gpt-4.1*",
|
|
218
|
+
"input": "2.00",
|
|
219
|
+
"cached_input": "0.50",
|
|
220
|
+
"output": "8.00",
|
|
221
|
+
"source": "OpenAI, standard tier"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"pattern": "o4* / o3*",
|
|
225
|
+
"input": "2.00",
|
|
226
|
+
"cached_input": "0.50",
|
|
227
|
+
"output": "8.00",
|
|
228
|
+
"source": "OpenAI, standard tier (reasoning)"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"pattern": "*opus*",
|
|
232
|
+
"input": "5.00",
|
|
233
|
+
"cached_input": "0.50",
|
|
234
|
+
"output": "25.00",
|
|
235
|
+
"source": "Anthropic listed API pricing, Claude Opus tier"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"pattern": "*sonnet*",
|
|
239
|
+
"input": "3.00",
|
|
240
|
+
"cached_input": "0.30",
|
|
241
|
+
"output": "15.00",
|
|
242
|
+
"source": "Anthropic listed API pricing, Claude Sonnet tier"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"pattern": "*haiku*",
|
|
246
|
+
"input": "1.00",
|
|
247
|
+
"cached_input": "0.10",
|
|
248
|
+
"output": "5.00",
|
|
249
|
+
"source": "Anthropic listed API pricing, Claude Haiku tier"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"pattern": "gemini-*-pro*",
|
|
253
|
+
"input": "2.00",
|
|
254
|
+
"cached_input": "0.20",
|
|
255
|
+
"output": "12.00",
|
|
256
|
+
"source": "Google Gemini API pricing"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"pattern": "gemini-*-flash*",
|
|
260
|
+
"input": "0.30",
|
|
261
|
+
"cached_input": "0.03",
|
|
262
|
+
"output": "2.50",
|
|
263
|
+
"source": "Google Gemini API pricing"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"pattern": "deepseek-*pro*",
|
|
267
|
+
"input": "0.44",
|
|
268
|
+
"cached_input": "0.004",
|
|
269
|
+
"output": "0.87",
|
|
270
|
+
"source": "DeepSeek API pricing"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"pattern": "deepseek-*",
|
|
274
|
+
"input": "0.14",
|
|
275
|
+
"cached_input": "0.003",
|
|
276
|
+
"output": "0.28",
|
|
277
|
+
"source": "DeepSeek API pricing"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"pattern": "*mini*",
|
|
281
|
+
"input": "0.25",
|
|
282
|
+
"cached_input": "0.025",
|
|
283
|
+
"output": "2.00",
|
|
284
|
+
"source": "OpenAI, standard tier (small model)"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"pattern": "*nano*",
|
|
288
|
+
"input": "0.05",
|
|
289
|
+
"cached_input": "0.005",
|
|
290
|
+
"output": "0.40",
|
|
291
|
+
"source": "OpenAI, standard tier (smallest model)"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"pattern": "llama-*",
|
|
295
|
+
"input": "0.00",
|
|
296
|
+
"cached_input": "0.00",
|
|
297
|
+
"output": "0.00",
|
|
298
|
+
"source": "self-hosted/open-weight: zero marginal list price"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"pattern": "*",
|
|
302
|
+
"input": "1.25",
|
|
303
|
+
"cached_input": "0.125",
|
|
304
|
+
"output": "10.00",
|
|
305
|
+
"source": "fallback: mid-tier assumption, flagged as 'assumed' in the receipt"
|
|
306
|
+
}
|
|
307
|
+
],
|
|
308
|
+
"fallback_marker": "assumed"
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
"appendix": {
|
|
312
|
+
"usage": [
|
|
313
|
+
{
|
|
314
|
+
"seq": 3,
|
|
315
|
+
"model": "claude-sonnet-5",
|
|
316
|
+
"provider": "vector",
|
|
317
|
+
"input_tokens": 1000,
|
|
318
|
+
"cached_input_tokens": 0,
|
|
319
|
+
"output_tokens": 200,
|
|
320
|
+
"usage_source": "reported",
|
|
321
|
+
"cost_usd": "0.006000",
|
|
322
|
+
"event_hash": "fac008628bf2556b5c6257738441832d5f3168d7d9fe9fc6c64c6f60a98e1312",
|
|
323
|
+
"latency_ms": 90,
|
|
324
|
+
"cache_key": "383e1c577a213bf192032b1824f60401af1476b62d9c59de7285071eca837fc0",
|
|
325
|
+
"merkle_path": [
|
|
326
|
+
{
|
|
327
|
+
"side": "left",
|
|
328
|
+
"hash": "29ff725536b477060b4c71197f7a68ded5e7f4f4da3a3ebf05c30780c2a2d1f2"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"side": "left",
|
|
332
|
+
"hash": "bac8435c7a5a92e95664b40a646891b320563d07cadb894ba45891bfc121095e"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"side": "right",
|
|
336
|
+
"hash": "1c7a0c931c0fe07be172d5cacd849610d2c7f4c18188f86430c6df3ae9454718"
|
|
337
|
+
}
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
"proof_included": true,
|
|
342
|
+
"note": "Each usage row carries the hash of its ledger event and a Merkle inclusion proof against ledger.merkle_root. Recompute cost from these rows using the embedded price_table to check this receipt without trusting docket."
|
|
343
|
+
},
|
|
344
|
+
"evidence": {
|
|
345
|
+
"ledger_complete": true,
|
|
346
|
+
"unwritten_events": 0,
|
|
347
|
+
"first_failing_seq": null,
|
|
348
|
+
"write_failures": 0,
|
|
349
|
+
"fail_fast": false,
|
|
350
|
+
"policy_limits": {
|
|
351
|
+
"max_events": null,
|
|
352
|
+
"max_ledger_bytes": 268435456
|
|
353
|
+
},
|
|
354
|
+
"note": "every event reached the ledger file"
|
|
355
|
+
},
|
|
356
|
+
"ops": {
|
|
357
|
+
"circuit_breaker": null,
|
|
358
|
+
"rate_limiter": null,
|
|
359
|
+
"health": null,
|
|
360
|
+
"proxy": null,
|
|
361
|
+
"fault_injection": null,
|
|
362
|
+
"chaos_run": false,
|
|
363
|
+
"snapshot": null,
|
|
364
|
+
"rollback": null
|
|
365
|
+
},
|
|
366
|
+
"findings": [],
|
|
367
|
+
"limits_disclosure": {
|
|
368
|
+
"enforced_before_send": [
|
|
369
|
+
"per-session USD ceiling (where usage is reported or estimated)",
|
|
370
|
+
"per-session token ceiling",
|
|
371
|
+
"per-session model-call ceiling",
|
|
372
|
+
"model allow/deny rules",
|
|
373
|
+
"wall-clock ceiling (by terminating the supervised process)",
|
|
374
|
+
"call-rate ceiling, when resilience.max_calls_per_minute or max_calls_per_second is set",
|
|
375
|
+
"requests to an upstream whose circuit breaker is open",
|
|
376
|
+
"any further model call once the ledger has reached its configured limit"
|
|
377
|
+
],
|
|
378
|
+
"cache_behaviour": [
|
|
379
|
+
"when cache.enabled is set, an identical request (same upstream path and same",
|
|
380
|
+
"canonical body) is answered from the response cache instead of the provider:",
|
|
381
|
+
"the provider never sees it, and it is recorded as model.cache_hit",
|
|
382
|
+
"the saving is reported beside the spend, never inside it"
|
|
383
|
+
],
|
|
384
|
+
"recorded_not_enforced": [
|
|
385
|
+
"filesystem changes under watched paths (detected by snapshot diffing)",
|
|
386
|
+
"writes to deny_write paths (proven after the fact, flagged as violations)",
|
|
387
|
+
"process spawn/exit of the supervised child only, not its descendants' syscalls"
|
|
388
|
+
],
|
|
389
|
+
"not_observed": [
|
|
390
|
+
"traffic that does not pass through the Docket boundary (e.g. an agent configured with a direct provider URL, or HTTPS tunnels when egress.mode = tunnel)",
|
|
391
|
+
"prompts, completions or file contents unless --record-bodies is enabled",
|
|
392
|
+
"actions taken by processes outside the supervised process tree"
|
|
393
|
+
],
|
|
394
|
+
"failure_behaviour": [
|
|
395
|
+
"upstream failures are counted per provider; a circuit breaker stops sending after the configured threshold and records every state change",
|
|
396
|
+
"when the ledger cannot be written, the run continues by default and the receipt declares the gap (resilience.fail_fast_evidence = true stops it instead)",
|
|
397
|
+
"a torn final line in a ledger is reported, never silently repaired; `docket doctor --quarantine-torn-tail` moves the bytes aside and keeps them"
|
|
398
|
+
],
|
|
399
|
+
"trust_assumptions": [
|
|
400
|
+
"the operator ran Docket honestly; the chain proves what was written, not that nothing else happened",
|
|
401
|
+
"reported token usage is the provider's own count; estimated usage is marked as estimated"
|
|
402
|
+
]
|
|
403
|
+
},
|
|
404
|
+
"latency": {
|
|
405
|
+
"method": "nearest-rank",
|
|
406
|
+
"measured_calls": 1,
|
|
407
|
+
"total_rows": 1,
|
|
408
|
+
"total_ms": 90,
|
|
409
|
+
"max_ms": 90,
|
|
410
|
+
"p50_ms": 90,
|
|
411
|
+
"p95_ms": 90,
|
|
412
|
+
"p99_ms": 90
|
|
413
|
+
},
|
|
414
|
+
"cache": {
|
|
415
|
+
"enabled": true,
|
|
416
|
+
"policy": {
|
|
417
|
+
"enabled": true,
|
|
418
|
+
"ttl_seconds": 60,
|
|
419
|
+
"max_entries": 8,
|
|
420
|
+
"max_hits": 3
|
|
421
|
+
},
|
|
422
|
+
"hits": 2,
|
|
423
|
+
"saved_usd": "0.012000",
|
|
424
|
+
"avoided_tokens": 2400,
|
|
425
|
+
"by_origin": [
|
|
426
|
+
{
|
|
427
|
+
"key": "383e1c577a213bf192032b1824f60401af1476b62d9c59de7285071eca837fc0",
|
|
428
|
+
"origin_seq": 3,
|
|
429
|
+
"origin_hash": "fac008628bf2556b5c6257738441832d5f3168d7d9fe9fc6c64c6f60a98e1312",
|
|
430
|
+
"model": "claude-sonnet-5",
|
|
431
|
+
"usage": {
|
|
432
|
+
"input_tokens": 1000,
|
|
433
|
+
"cached_input_tokens": 0,
|
|
434
|
+
"output_tokens": 200
|
|
435
|
+
},
|
|
436
|
+
"avoided_usd_per_hit": "0.006000",
|
|
437
|
+
"usage_source": "reported",
|
|
438
|
+
"hits": 2,
|
|
439
|
+
"first_seq": 4,
|
|
440
|
+
"last_seq": 5,
|
|
441
|
+
"event_hash": "4cd45271c0ca690bd869487a539813f781d73a1d81695180406e425ed74ad2f6",
|
|
442
|
+
"merkle_path": [
|
|
443
|
+
{
|
|
444
|
+
"side": "right",
|
|
445
|
+
"hash": "4e501e8e1c5c000f1f1de5fa74f814c81d029fc20ed49df165224453f74c70c2"
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
"side": "right",
|
|
449
|
+
"hash": "36d99f40b9a2610fb8d069ddc738569f9a93332e405d4cef7aebc79e5c9e56fd"
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"side": "left",
|
|
453
|
+
"hash": "75c6a31cd783facf87645ab169be7fd0aa53782ce04d9a81c8372a9b21a323b7"
|
|
454
|
+
}
|
|
455
|
+
],
|
|
456
|
+
"avoided_usd_total": "0.012000"
|
|
457
|
+
}
|
|
458
|
+
],
|
|
459
|
+
"hits_ceiling_reached": true,
|
|
460
|
+
"note": "Every hit is a model.cache_hit event in the ledger; the saved amount is recomputed by docket verify from appendix.usage and the embedded price table, and each group below pins one of its hits to ledger.merkle_root with an inclusion proof. The saving is reported beside the spend, never inside it: totals.cost_usd remains money that was actually spent."
|
|
461
|
+
},
|
|
462
|
+
"seal": null,
|
|
463
|
+
"signature": null
|
|
464
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "docket/vectors/canonical/v1",
|
|
3
|
+
"cases": [
|
|
4
|
+
{
|
|
5
|
+
"input": {
|
|
6
|
+
"b": 1,
|
|
7
|
+
"a": 2
|
|
8
|
+
},
|
|
9
|
+
"canonical": "{\"a\":2,\"b\":1}",
|
|
10
|
+
"sha256": "d3626ac30a87e6f7a6428233b3c68299976865fa5508e4267c5415c76af7a772"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"input": {
|
|
14
|
+
"z": [
|
|
15
|
+
3,
|
|
16
|
+
2,
|
|
17
|
+
1
|
|
18
|
+
],
|
|
19
|
+
"a": {
|
|
20
|
+
"y": true,
|
|
21
|
+
"x": null
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"canonical": "{\"a\":{\"x\":null,\"y\":true},\"z\":[3,2,1]}",
|
|
25
|
+
"sha256": "ac47b872b8fce6af8630603275aeec6362f52f9feeafd9ea4de2c83b0599cbbe"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"input": {
|
|
29
|
+
"s": "café — ☕",
|
|
30
|
+
"n": 0
|
|
31
|
+
},
|
|
32
|
+
"canonical": "{\"n\":0,\"s\":\"café — ☕\"}",
|
|
33
|
+
"sha256": "0023c4d2b3bfa3b45d9a5c0ee0f55e18f838ebb9667b15eecdd9b113307409d7"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"input": {
|
|
37
|
+
"price": "0.018000",
|
|
38
|
+
"tokens": 1200
|
|
39
|
+
},
|
|
40
|
+
"canonical": "{\"price\":\"0.018000\",\"tokens\":1200}",
|
|
41
|
+
"sha256": "537699969ddf8b13cdc9a5fc59eb3b70b15d25cfbc3a9a378d10b60b748398da"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|