@trazum/cli 1.40.0 → 1.42.0
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.
- package/README.md +2 -0
- package/dist/connect.d.ts +72 -0
- package/dist/connect.d.ts.map +1 -0
- package/dist/connect.js +204 -0
- package/dist/connect.js.map +1 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +99 -1
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +101 -1
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/types.d.ts +61 -1
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.js +379 -72
- package/dist/index.js.map +1 -1
- package/dist/store-fs.d.ts +59 -0
- package/dist/store-fs.d.ts.map +1 -0
- package/dist/store-fs.js +145 -0
- package/dist/store-fs.js.map +1 -0
- package/package.json +2 -2
- package/src/connect.ts +245 -0
- package/src/i18n/en.ts +125 -1
- package/src/i18n/es.ts +127 -1
- package/src/i18n/types.ts +63 -1
- package/src/index.ts +503 -67
- package/src/store-fs.ts +157 -0
package/README.md
CHANGED
|
@@ -26,6 +26,8 @@ npm install -g @trazum/cli
|
|
|
26
26
|
| `trazum plan <log\|dir>` | the findings as a ranked plan: what to do first, route+batch combined never summed, projections and money already spent totalled apart, every assumption named. `-o` saves it dated for a later verify; `--min-usd` names what it drops |
|
|
27
27
|
| `trazum verify <plan.json> --against <log>` | did the plan's savings arrive? Three outcomes, never two — arrived, did not, cannot be told — with the world's movement named beside each verdict. `--gate` fails CI on broken promises |
|
|
28
28
|
| `trazum history <dir>` | the long run: series from stored `--json` reports, the climbs and decays no pairwise comparison finds, and plans nobody is executing. Shapes named, nothing forecast |
|
|
29
|
+
| `trazum connect <provider>` | your bill read from the provider's usage API — no export by hand. The credential is borrowed from the environment and never stored; a connected report is restricted on purpose and names the findings a sum cannot support |
|
|
30
|
+
| `trazum store` | what the local store holds and what a prune would take. Re-pulls converge instead of doubling; records it cannot tell apart are kept as two and named; pruning refuses without a retention policy and says what went |
|
|
29
31
|
| `trazum doctor [dir]` | the whole workspace: what nothing is watching, and what fixing would be worth |
|
|
30
32
|
| `trazum rank <dir>` | of these forty prompts, which is worth an afternoon |
|
|
31
33
|
| `trazum prune <file> --cases <file>` | which few-shot examples earn their tokens — measured, and it asks before spending |
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fetch half of the connector: credentials, pagination, and what went
|
|
3
|
+
* missing.
|
|
4
|
+
*
|
|
5
|
+
* The transformation lives in `@trazum/core`, where it is testable without a
|
|
6
|
+
* network. This module does the part that touches the outside world, and it
|
|
7
|
+
* is written under three rules the rest of the product does not need:
|
|
8
|
+
*
|
|
9
|
+
* **A credential is borrowed, never held.** Keys are read from the environment
|
|
10
|
+
* at the moment of the call and never written to a config, a cache, a report
|
|
11
|
+
* or an error message. `redact` runs over everything that can reach a terminal
|
|
12
|
+
* — a key pasted into a CI log by an error handler is a key that has to be
|
|
13
|
+
* rotated, and the tool that leaked it is the tool that promised to save money.
|
|
14
|
+
*
|
|
15
|
+
* **The endpoint is not user-supplied.** Each provider has one fixed base URL
|
|
16
|
+
* compiled in. Trazum's SSRF story has been, since 1.14, that a request body
|
|
17
|
+
* must never *name* a host — it selects one. A usage connector that accepted
|
|
18
|
+
* `--base-url` would hand that property back for the convenience of a
|
|
19
|
+
* self-hosted proxy nobody has asked for yet.
|
|
20
|
+
*
|
|
21
|
+
* **A partial pull is a partial pull, out loud.** Rate limits, page caps and
|
|
22
|
+
* windows the provider has aged out all return what was gathered, with the
|
|
23
|
+
* gap named. A bill quietly short by an unknown amount is the failure this
|
|
24
|
+
* repository refuses everywhere it can occur, and a paginated API is exactly
|
|
25
|
+
* where it occurs.
|
|
26
|
+
*/
|
|
27
|
+
import type { ConnectorDescriptor, ConnectorPull } from '@trazum/core';
|
|
28
|
+
export interface CredentialSource {
|
|
29
|
+
/** The environment variable the key came from — the *name*, never the value. */
|
|
30
|
+
variable: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Finds the credential without ever returning it to a caller that might print
|
|
34
|
+
* it: the key stays inside this module, and the caller gets the variable name.
|
|
35
|
+
*/
|
|
36
|
+
export declare function findCredential(descriptor: ConnectorDescriptor, env: Record<string, string | undefined>): {
|
|
37
|
+
key: string;
|
|
38
|
+
source: CredentialSource;
|
|
39
|
+
} | null;
|
|
40
|
+
/**
|
|
41
|
+
* Removes credential material from anything on its way to a terminal.
|
|
42
|
+
*
|
|
43
|
+
* Two layers on purpose. The exact key is redacted because we hold it; the
|
|
44
|
+
* shapes are redacted because an error body may quote a *different* key —
|
|
45
|
+
* the one the caller mistyped, a key from a proxy's log line — and a leak
|
|
46
|
+
* through somebody else's error message is still a leak through Trazum's
|
|
47
|
+
* output.
|
|
48
|
+
*/
|
|
49
|
+
export declare function redact(text: string, key?: string): string;
|
|
50
|
+
export interface FetchUsageOptions {
|
|
51
|
+
descriptor: ConnectorDescriptor;
|
|
52
|
+
fromMs: number;
|
|
53
|
+
toMs: number;
|
|
54
|
+
env: Record<string, string | undefined>;
|
|
55
|
+
/** Injected so the whole path is testable without a network. */
|
|
56
|
+
fetchImpl?: typeof fetch;
|
|
57
|
+
}
|
|
58
|
+
export interface FetchUsageResult {
|
|
59
|
+
pull: ConnectorPull;
|
|
60
|
+
source: CredentialSource;
|
|
61
|
+
pages: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Pulls a window of usage, page by page, and reports what it could not get.
|
|
65
|
+
*
|
|
66
|
+
* Returns whatever was gathered when a page fails partway through: half a
|
|
67
|
+
* month with the gap named beats an exception that throws away the half that
|
|
68
|
+
* arrived, and beats a total that silently describes less traffic than the
|
|
69
|
+
* caller asked about.
|
|
70
|
+
*/
|
|
71
|
+
export declare function fetchProviderUsage(options: FetchUsageOptions): Promise<FetchUsageResult>;
|
|
72
|
+
//# sourceMappingURL=connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAW,MAAM,cAAc,CAAC;AAqBhF,MAAM,WAAW,gBAAgB;IAC/B,gFAAgF;IAChF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,mBAAmB,EAC/B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GACtC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,CAQlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CASzD;AA2BD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,mBAAmB,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,gEAAgE;IAChE,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwG9F"}
|
package/dist/connect.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fetch half of the connector: credentials, pagination, and what went
|
|
3
|
+
* missing.
|
|
4
|
+
*
|
|
5
|
+
* The transformation lives in `@trazum/core`, where it is testable without a
|
|
6
|
+
* network. This module does the part that touches the outside world, and it
|
|
7
|
+
* is written under three rules the rest of the product does not need:
|
|
8
|
+
*
|
|
9
|
+
* **A credential is borrowed, never held.** Keys are read from the environment
|
|
10
|
+
* at the moment of the call and never written to a config, a cache, a report
|
|
11
|
+
* or an error message. `redact` runs over everything that can reach a terminal
|
|
12
|
+
* — a key pasted into a CI log by an error handler is a key that has to be
|
|
13
|
+
* rotated, and the tool that leaked it is the tool that promised to save money.
|
|
14
|
+
*
|
|
15
|
+
* **The endpoint is not user-supplied.** Each provider has one fixed base URL
|
|
16
|
+
* compiled in. Trazum's SSRF story has been, since 1.14, that a request body
|
|
17
|
+
* must never *name* a host — it selects one. A usage connector that accepted
|
|
18
|
+
* `--base-url` would hand that property back for the convenience of a
|
|
19
|
+
* self-hosted proxy nobody has asked for yet.
|
|
20
|
+
*
|
|
21
|
+
* **A partial pull is a partial pull, out loud.** Rate limits, page caps and
|
|
22
|
+
* windows the provider has aged out all return what was gathered, with the
|
|
23
|
+
* gap named. A bill quietly short by an unknown amount is the failure this
|
|
24
|
+
* repository refuses everywhere it can occur, and a paginated API is exactly
|
|
25
|
+
* where it occurs.
|
|
26
|
+
*/
|
|
27
|
+
import { SAFE_FETCH_INIT } from '@trazum/core/node';
|
|
28
|
+
import { normalizeAnthropicUsage, normalizeOpenAIUsage } from '@trazum/core';
|
|
29
|
+
/** Fixed, compiled in, never taken from the caller. See the module note. */
|
|
30
|
+
const ENDPOINTS = {
|
|
31
|
+
anthropic: 'https://api.anthropic.com/v1/organizations/usage_report/messages',
|
|
32
|
+
openai: 'https://api.openai.com/v1/organizations/usage/completions',
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* How many pages a single pull will walk before it stops and says so.
|
|
36
|
+
*
|
|
37
|
+
* A cap rather than an unbounded loop: a wrong window against a busy
|
|
38
|
+
* organisation is otherwise a request storm against somebody's rate limit,
|
|
39
|
+
* paid for by them. Reaching it is reported as a gap, never as a complete
|
|
40
|
+
* bill.
|
|
41
|
+
*/
|
|
42
|
+
const MAX_PAGES = 50;
|
|
43
|
+
/** Requests in flight is always one: usage endpoints are strictly rate limited. */
|
|
44
|
+
const REQUEST_TIMEOUT_MS = 30_000;
|
|
45
|
+
/**
|
|
46
|
+
* Finds the credential without ever returning it to a caller that might print
|
|
47
|
+
* it: the key stays inside this module, and the caller gets the variable name.
|
|
48
|
+
*/
|
|
49
|
+
export function findCredential(descriptor, env) {
|
|
50
|
+
for (const variable of descriptor.credentialEnv) {
|
|
51
|
+
const value = env[variable];
|
|
52
|
+
if (typeof value === 'string' && value.trim() !== '') {
|
|
53
|
+
return { key: value.trim(), source: { variable } };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Removes credential material from anything on its way to a terminal.
|
|
60
|
+
*
|
|
61
|
+
* Two layers on purpose. The exact key is redacted because we hold it; the
|
|
62
|
+
* shapes are redacted because an error body may quote a *different* key —
|
|
63
|
+
* the one the caller mistyped, a key from a proxy's log line — and a leak
|
|
64
|
+
* through somebody else's error message is still a leak through Trazum's
|
|
65
|
+
* output.
|
|
66
|
+
*/
|
|
67
|
+
export function redact(text, key) {
|
|
68
|
+
let out = text;
|
|
69
|
+
if (key !== undefined && key.length >= 8) {
|
|
70
|
+
out = out.split(key).join('[redacted]');
|
|
71
|
+
}
|
|
72
|
+
return out
|
|
73
|
+
.replace(/sk-ant-[A-Za-z0-9_-]{8,}/g, '[redacted]')
|
|
74
|
+
.replace(/sk-[A-Za-z0-9_-]{16,}/g, '[redacted]')
|
|
75
|
+
.replace(/\bBearer\s+[A-Za-z0-9._-]{8,}/gi, 'Bearer [redacted]');
|
|
76
|
+
}
|
|
77
|
+
function headersFor(provider, key) {
|
|
78
|
+
if (provider === 'anthropic') {
|
|
79
|
+
return { 'x-api-key': key, 'anthropic-version': '2023-06-01', accept: 'application/json' };
|
|
80
|
+
}
|
|
81
|
+
return { authorization: `Bearer ${key}`, accept: 'application/json' };
|
|
82
|
+
}
|
|
83
|
+
function urlFor(provider, fromMs, toMs, page) {
|
|
84
|
+
const url = new URL(ENDPOINTS[provider]);
|
|
85
|
+
if (provider === 'anthropic') {
|
|
86
|
+
url.searchParams.set('starting_at', new Date(fromMs).toISOString());
|
|
87
|
+
url.searchParams.set('ending_at', new Date(toMs).toISOString());
|
|
88
|
+
url.searchParams.set('bucket_width', '1d');
|
|
89
|
+
url.searchParams.append('group_by[]', 'model');
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
url.searchParams.set('start_time', String(Math.floor(fromMs / 1000)));
|
|
93
|
+
url.searchParams.set('end_time', String(Math.floor(toMs / 1000)));
|
|
94
|
+
url.searchParams.set('bucket_width', '1d');
|
|
95
|
+
url.searchParams.append('group_by[]', 'model');
|
|
96
|
+
url.searchParams.set('limit', '31');
|
|
97
|
+
}
|
|
98
|
+
if (page !== null)
|
|
99
|
+
url.searchParams.set('page', page);
|
|
100
|
+
return url.toString();
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Pulls a window of usage, page by page, and reports what it could not get.
|
|
104
|
+
*
|
|
105
|
+
* Returns whatever was gathered when a page fails partway through: half a
|
|
106
|
+
* month with the gap named beats an exception that throws away the half that
|
|
107
|
+
* arrived, and beats a total that silently describes less traffic than the
|
|
108
|
+
* caller asked about.
|
|
109
|
+
*/
|
|
110
|
+
export async function fetchProviderUsage(options) {
|
|
111
|
+
const { descriptor, fromMs, toMs, env, fetchImpl = fetch } = options;
|
|
112
|
+
const found = findCredential(descriptor, env);
|
|
113
|
+
if (found === null) {
|
|
114
|
+
throw new Error(`No credential for ${descriptor.displayName}. Trazum reads it from the environment and never stores it — set ${descriptor.credentialEnv.join(' or ')} to ${descriptor.keyKind}. See ${descriptor.docs}.`);
|
|
115
|
+
}
|
|
116
|
+
const gaps = [];
|
|
117
|
+
const payloads = [];
|
|
118
|
+
let page = null;
|
|
119
|
+
let pages = 0;
|
|
120
|
+
while (pages < MAX_PAGES) {
|
|
121
|
+
const url = urlFor(descriptor.id, fromMs, toMs, page);
|
|
122
|
+
let response;
|
|
123
|
+
try {
|
|
124
|
+
response = await fetchImpl(url, {
|
|
125
|
+
...SAFE_FETCH_INIT,
|
|
126
|
+
method: 'GET',
|
|
127
|
+
headers: headersFor(descriptor.id, found.key),
|
|
128
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
133
|
+
gaps.push({
|
|
134
|
+
kind: 'rate-limited',
|
|
135
|
+
detail: `the request for page ${pages + 1} did not complete (${redact(message, found.key)}), so everything after it is missing from this window`,
|
|
136
|
+
});
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
pages += 1;
|
|
140
|
+
if (response.status === 429) {
|
|
141
|
+
gaps.push({
|
|
142
|
+
kind: 'rate-limited',
|
|
143
|
+
detail: `the provider rate-limited page ${pages}, so this window stops early and the rest of it was not measured`,
|
|
144
|
+
});
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
if (response.status === 401 || response.status === 403) {
|
|
148
|
+
throw new Error(`${descriptor.displayName} refused the credential in ${found.source.variable} (HTTP ${response.status}). This endpoint needs ${descriptor.keyKind}; an ordinary API key cannot read the usage report.`);
|
|
149
|
+
}
|
|
150
|
+
if (!response.ok) {
|
|
151
|
+
const body = await response.text().catch(() => '');
|
|
152
|
+
throw new Error(`${descriptor.displayName} returned HTTP ${response.status}: ${redact(body.slice(0, 400), found.key) || '(no body)'}`);
|
|
153
|
+
}
|
|
154
|
+
let payload;
|
|
155
|
+
try {
|
|
156
|
+
payload = await response.json();
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
gaps.push({
|
|
160
|
+
kind: 'unreadable-entry',
|
|
161
|
+
detail: `page ${pages} was not readable JSON, so its buckets are missing from this window`,
|
|
162
|
+
});
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
payloads.push(payload);
|
|
166
|
+
const more = payload.has_more === true;
|
|
167
|
+
const next = payload.next_page;
|
|
168
|
+
if (!more)
|
|
169
|
+
break;
|
|
170
|
+
if (typeof next !== 'string' || next === '') {
|
|
171
|
+
gaps.push({
|
|
172
|
+
kind: 'cursor-expired',
|
|
173
|
+
detail: 'the provider said there was more and served no cursor to reach it, so this window is short by an unknown amount',
|
|
174
|
+
});
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
page = next;
|
|
178
|
+
}
|
|
179
|
+
if (pages >= MAX_PAGES) {
|
|
180
|
+
gaps.push({
|
|
181
|
+
kind: 'page-limit',
|
|
182
|
+
detail: `the pull stopped at ${MAX_PAGES} pages, so this window is incomplete — narrow it with --since and --until`,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
const normalize = descriptor.id === 'anthropic' ? normalizeAnthropicUsage : normalizeOpenAIUsage;
|
|
186
|
+
const pulls = payloads.map((payload) => normalize(payload));
|
|
187
|
+
const pull = {
|
|
188
|
+
provider: descriptor.id,
|
|
189
|
+
granularity: descriptor.granularity,
|
|
190
|
+
buckets: pulls.flatMap((p) => p.buckets),
|
|
191
|
+
window: pulls.length === 0
|
|
192
|
+
? null
|
|
193
|
+
: {
|
|
194
|
+
fromMs: Math.min(...pulls.filter((p) => p.window).map((p) => p.window.fromMs), Infinity),
|
|
195
|
+
toMs: Math.max(...pulls.filter((p) => p.window).map((p) => p.window.toMs), -Infinity),
|
|
196
|
+
},
|
|
197
|
+
gaps: [...pulls.flatMap((p) => p.gaps), ...gaps],
|
|
198
|
+
unavailable: descriptor.unavailable,
|
|
199
|
+
};
|
|
200
|
+
if (pull.window !== null && !Number.isFinite(pull.window.fromMs))
|
|
201
|
+
pull.window = null;
|
|
202
|
+
return { pull, source: found.source, pages };
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=connect.js.map
|
|
@@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AO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;AAC/C,CAAC"}
|
package/dist/i18n/en.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAqB9C;;;;;;GAMG;AACH,eAAO,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAqB9C;;;;;;GAMG;AACH,eAAO,MAAM,EAAE,EAAE,WAqpDhB,CAAC"}
|
package/dist/i18n/en.js
CHANGED
|
@@ -33,6 +33,8 @@ ${bold('USAGE')}
|
|
|
33
33
|
trazum plan <log.jsonl|dir> [options]
|
|
34
34
|
trazum verify <plan.json> --against <newer.jsonl|dir> [options]
|
|
35
35
|
trazum history <dir-of-stored-reports> [options]
|
|
36
|
+
trazum connect <anthropic|openai> [options]
|
|
37
|
+
trazum store [--prune] [options]
|
|
36
38
|
trazum diff <before> <after> [options]
|
|
37
39
|
trazum diff --all <dir> <dir> [options]
|
|
38
40
|
trazum rank <dir> [options]
|
|
@@ -310,7 +312,64 @@ ${bold('OPTIONS FOR plan')}
|
|
|
310
312
|
a plan that hides its assumptions is advice pretending to be arithmetic.
|
|
311
313
|
Projected savings and money already spent are separate totals throughout.
|
|
312
314
|
|
|
315
|
+
${bold('OPTIONS FOR store')}
|
|
316
|
+
--prune Drop measurements older than the retention
|
|
317
|
+
policy, and compact the append log to what the
|
|
318
|
+
store already resolves to. Says what went.
|
|
319
|
+
--keep <n>d Retention for this run, when the config has none.
|
|
320
|
+
--dry-run With --prune: say what would go, and delete
|
|
321
|
+
nothing.
|
|
322
|
+
--json The inventory as data.
|
|
323
|
+
|
|
324
|
+
Says what the local store holds: how many measurements, over what span, per
|
|
325
|
+
provider, and what a prune would take. The store keeps aggregates and
|
|
326
|
+
billing fields — never prompt text, never completion text, never a
|
|
327
|
+
credential — so it is a file a team can back up without a privacy review.
|
|
328
|
+
|
|
329
|
+
Pruning is the one operation here that destroys something, so it refuses to
|
|
330
|
+
run without a retention policy: set "store": {"keepDays": 90} in the config
|
|
331
|
+
or pass --keep. Deleting measurements on a policy nobody wrote down is not a
|
|
332
|
+
default anybody should get by accident.
|
|
333
|
+
|
|
334
|
+
${bold('OPTIONS FOR connect')}
|
|
335
|
+
--since <when> The window to pull. A UTC day, an ISO timestamp,
|
|
336
|
+
--until <when> a relative window (7d, 24h) or "now". Defaults to
|
|
337
|
+
the last 30 days.
|
|
338
|
+
--dry-run Say what would be called and which environment
|
|
339
|
+
variable the key would come from. Sends nothing
|
|
340
|
+
and needs no credential.
|
|
341
|
+
--payload <file> Price a usage payload you already have, instead of
|
|
342
|
+
pulling one. No credential, no network — the same
|
|
343
|
+
arithmetic on the same shape.
|
|
344
|
+
--store Keep what was pulled in the local store, so the
|
|
345
|
+
next run does not download it again and "trazum
|
|
346
|
+
history --store" has a series.
|
|
347
|
+
-o, --out <file> Save the priced report as JSON.
|
|
348
|
+
--markdown-out <file> Also write it as Markdown, for a CI job summary.
|
|
349
|
+
--json The report as data.
|
|
350
|
+
|
|
351
|
+
Reads your bill from the provider's usage API, so nothing has to be exported
|
|
352
|
+
by hand. The credential is read from the environment at the moment of the
|
|
353
|
+
call and never stored, never printed and never written to a config: set
|
|
354
|
+
TRAZUM_ANTHROPIC_ADMIN_KEY or TRAZUM_OPENAI_ADMIN_KEY. Each provider needs
|
|
355
|
+
the narrowest key that can read a usage report, and an ordinary API key
|
|
356
|
+
cannot.
|
|
357
|
+
|
|
358
|
+
These APIs serve sums over a window, not one row per call, so a connected
|
|
359
|
+
report is a restricted one and says so: the totals, the model split, the day
|
|
360
|
+
series and the cache verdict are all available, and the per-call findings —
|
|
361
|
+
input shapes, truncation retries, conversations, context pressure — are
|
|
362
|
+
listed as unavailable with what would unlock them. A rate limit, a page cap
|
|
363
|
+
or an expired cursor returns what arrived with the gap named, never a total
|
|
364
|
+
that quietly describes less traffic than you asked about.
|
|
365
|
+
|
|
313
366
|
${bold('OPTIONS FOR history')}
|
|
367
|
+
--store Build the series from the local store instead of
|
|
368
|
+
a directory of stored reports. Bucketed sources
|
|
369
|
+
carry no label, so the label series is absent and
|
|
370
|
+
said to be — the model-share and cache-share
|
|
371
|
+
series are what a series exists for, and both
|
|
372
|
+
work.
|
|
314
373
|
--markdown-out <file> Also write the series as Markdown, for a CI job
|
|
315
374
|
summary or a pull request comment.
|
|
316
375
|
--json The history as data.
|
|
@@ -1136,11 +1195,49 @@ ${bold('EXAMPLES')}
|
|
|
1136
1195
|
footer: () => 'Ranked by money, projected or already spent alike. The assumptions are yours to answer: this plan is arithmetic over the log, not knowledge of your product.',
|
|
1137
1196
|
wrote: (path) => `Plan written to ${path}, dated. Keep it: a prediction nobody wrote down is a prediction nobody can be held to.`,
|
|
1138
1197
|
},
|
|
1198
|
+
store: {
|
|
1199
|
+
appended: (count, dir) => `Kept ${count} measurements in ${dir}.`,
|
|
1200
|
+
empty: (dir) => `The store at ${dir} is empty. Fill it with "trazum connect <provider> --store" — that is a state, not an error.`,
|
|
1201
|
+
heading: (records, usd, from, to) => `The store: ${records} measurements · ${usd} · ${from} → ${to}`,
|
|
1202
|
+
providerRow: (provider, records, span, models) => `${provider} ${records} measurements · ${span} · ${models} models`,
|
|
1203
|
+
holds: (files) => `Held in ${files} files: token counts, billed dollars and the account's own workspace and key identifiers. Never prompt text, never completion text, never a credential — this is a file you can back up without a privacy review.`,
|
|
1204
|
+
possiblyDouble: (count) => `${count} records could not be told apart from another — a window of no length, or a record naming no model. They are kept whole rather than merged, so a total built on them may count the same spend twice. Saying so beats a smaller number nobody can check.`,
|
|
1205
|
+
unknownVersion: (count) => `${count} records come from a newer schema than this version knows, so they are kept and left out of the figures above rather than guessed at. Upgrade to read them.`,
|
|
1206
|
+
unreadable: (file, line) => `${file} line ${line} would not parse, so it is not in the figures above. The rest of the file was read — one broken line must not lose a month.`,
|
|
1207
|
+
retention: (days) => `Retention: ${days} days, from "store.keepDays". Run "trazum store --prune" to apply it.`,
|
|
1208
|
+
noRetention: () => 'No retention policy is configured, so nothing is ever deleted on its own. Set "store": {"keepDays": 90} when you want one.',
|
|
1209
|
+
pruneNeedsPolicy: () => 'Pruning needs a retention policy: set "store": {"keepDays": 90} in trazum.config.json, or pass --keep 90d for this run. Deleting measurements on a policy nobody wrote down is not a default you should get by accident.',
|
|
1210
|
+
pruneDryRun: (count, days, span, usd) => span === null
|
|
1211
|
+
? `Nothing is older than ${days} days, so a prune would delete nothing.`
|
|
1212
|
+
: `A prune would delete ${count} measurements older than ${days} days, covering ${span} and ${usd} of measured spend. Nothing was deleted — this was --dry-run.`,
|
|
1213
|
+
pruned: (count, days, span, usd, kept) => span === null
|
|
1214
|
+
? `Nothing was older than ${days} days. ${kept} measurements kept, and the append log compacted.`
|
|
1215
|
+
: `Deleted ${count} measurements older than ${days} days, covering ${span} and ${usd} of measured spend. ${kept} kept, and the append log compacted to what the store already resolved to.`,
|
|
1216
|
+
},
|
|
1217
|
+
connect: {
|
|
1218
|
+
noTarget: (providers) => `Name a provider to read your bill from: trazum connect anthropic. Available: ${providers}. The credential comes from the environment and is never stored — add --dry-run to see exactly what would be called and which variable it would be read from.`,
|
|
1219
|
+
unknownProvider: (id, providers) => `There is no connector for "${id}". The ones that exist are: ${providers}.`,
|
|
1220
|
+
dryRun: (provider, from, to, envVars, keyKind) => `Would read ${provider} usage from ${from} to ${to}, using ${keyKind} taken from ${envVars}. Nothing was sent and no credential was needed to print this.`,
|
|
1221
|
+
heading: (provider, from, to, usd, calls) => calls === null
|
|
1222
|
+
? `${provider} · ${from} → ${to} · ${usd}`
|
|
1223
|
+
: `${provider} · ${from} → ${to} · ${usd} · ${calls} calls`,
|
|
1224
|
+
modelRow: (model, usd, share, calls) => calls === null ? `${model} ${usd} ${share}` : `${model} ${usd} ${share} · ${calls} calls`,
|
|
1225
|
+
nothingBilled: () => 'The provider billed nothing in this window. That is a measurement, not an error — widen it with --since if you expected traffic.',
|
|
1226
|
+
cachePaid: (saved) => `Caching paid for itself: ${saved} less than these tokens would have cost as ordinary input.`,
|
|
1227
|
+
cacheLost: (added) => `Caching added ${added} to this bill against what the same tokens would have cost as ordinary input.`,
|
|
1228
|
+
cacheUnsettled: () => 'This source did not say which TTL the cache writes used, so the cheaper rate was assumed and the verdict moves under the other one. Unsettled, not settled in your favour.',
|
|
1229
|
+
noCallCount: (provider) => `${provider}'s usage report serves token sums and no request count, so there is no call count here and no per-call average. A zero would read as "no traffic", so nothing is printed instead.`,
|
|
1230
|
+
unpriced: (model, tokens) => `${model} is not in the price catalogue, so its ${tokens} tokens are counted and its money is not. Add it with --pricing rather than reading the total as complete.`,
|
|
1231
|
+
gap: (detail) => `This window is incomplete: ${detail}.`,
|
|
1232
|
+
unavailable: (findings) => `Findings this source cannot support: ${findings}. They need one row per call, and a sum has lost the rows — a per-call log still answers them.`,
|
|
1233
|
+
wrote: (path) => `Report written to ${path}.`,
|
|
1234
|
+
footer: () => 'Every figure here is the provider\u2019s own billed token count at the catalogue\u2019s rates. Nothing was estimated, and nothing the provider did not serve was filled in.',
|
|
1235
|
+
},
|
|
1139
1236
|
history: {
|
|
1140
1237
|
noTarget: () => 'Point this at a directory of stored reports: trazum history reports/. It reads the --json documents "trazum profile" writes (and any saved plans beside them) and builds the series no pairwise comparison can see.',
|
|
1141
1238
|
needsThree: (count) => `A series needs at least three dated reports, and this directory has ${count}. Two reports is a comparison, and "trazum profile --against" already does that better.`,
|
|
1142
1239
|
heading: (periods, from, to) => `The long run: ${periods} periods, ${from} → ${to}`,
|
|
1143
|
-
periodRow: (name, usd, calls, days) => `${name} ${usd} · ${calls} calls · ${days} days`,
|
|
1240
|
+
periodRow: (name, usd, calls, days) => calls === null ? `${name} ${usd} · ${days} days` : `${name} ${usd} · ${calls} calls · ${days} days`,
|
|
1144
1241
|
runLabel: (label, periods, sinceName, from, to) => `${label} has climbed for ${periods} consecutive periods since ${sinceName}: ${from} → ${to}. A shape, not a forecast.`,
|
|
1145
1242
|
runModel: (model, periods, sinceName, from, to) => `${model}'s share of the bill has climbed for ${periods} consecutive periods since ${sinceName}: ${from} → ${to}. The totals can look flat while the mix moves under them.`,
|
|
1146
1243
|
runCache: (periods, sinceName, from, to) => `The cache share has decayed for ${periods} consecutive periods since ${sinceName}: ${from} → ${to} — slowly enough that no single report called it a finding, which is exactly why a series exists.`,
|
|
@@ -1157,6 +1254,7 @@ ${bold('EXAMPLES')}
|
|
|
1157
1254
|
const span = first !== null && last !== null ? ` (${first} → ${last})` : '';
|
|
1158
1255
|
return `${what} has been planned ${appearances} times${span} and is still in the newest plan — a decision nobody is revisiting.`;
|
|
1159
1256
|
},
|
|
1257
|
+
storeNoLabels: () => 'This series comes from the store, and a usage API groups by model and workspace rather than by workload — so there is no label series here at all. Absent, not empty: nothing above says a workload did or did not move.',
|
|
1160
1258
|
undated: (name) => `${name} carries no span, so it is on no timeline above — named, never silently absorbed.`,
|
|
1161
1259
|
unrecognized: (name) => `${name} is neither a stored report nor a saved plan, so it is in no series above.`,
|
|
1162
1260
|
footer: () => 'A series names shapes, not futures. Twenty points make a trend visible; they do not make next month knowable — where these lines go next is yours to judge.',
|