agent-cost-analyzer 0.0.0 → 0.16.1

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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -5
  3. package/THIRD-PARTY-NOTICES.md +3510 -0
  4. package/bin/agent-cost-analyzer.js +22 -0
  5. package/bin/node-gate.js +41 -0
  6. package/dist/cli.js +315313 -0
  7. package/dist/data/learn-scripts/cache-basics.json +163 -0
  8. package/dist/data/learn-scripts/cache-ttl-1-hour-breakpoint.json +176 -0
  9. package/dist/data/learn-scripts/cache-ttl-smoke-break.json +190 -0
  10. package/dist/data/learn-scripts/cascading-model-switch-then-ttl-lapse.json +121 -0
  11. package/dist/data/learn-scripts/clear.json +133 -0
  12. package/dist/data/learn-scripts/compaction.json +98 -0
  13. package/dist/data/learn-scripts/image-attachment-invalidation.json +108 -0
  14. package/dist/data/learn-scripts/inline-exploration-bloat.json +115 -0
  15. package/dist/data/learn-scripts/instructions-edit.json +99 -0
  16. package/dist/data/learn-scripts/mcp-tool-change.json +93 -0
  17. package/dist/data/learn-scripts/model-switch.json +88 -0
  18. package/dist/data/learn-scripts/reasoning-budget-toggle.json +98 -0
  19. package/dist/data/learn-scripts/rewind.json +139 -0
  20. package/dist/data/learn-scripts/session-forking-multi-branch.json +124 -0
  21. package/dist/data/learn-scripts/session-forking.json +99 -0
  22. package/dist/data/learn-scripts/silent-instructions-pullin.json +104 -0
  23. package/dist/data/learn-scripts/subagent-cheaper-model.json +70 -0
  24. package/dist/data/learn-scripts/subagent-session.json +70 -0
  25. package/dist/data/price-book/anthropic-api.json +662 -0
  26. package/dist/data/price-book/github-copilot.json +1402 -0
  27. package/dist/data/price-book/google-api.json +507 -0
  28. package/dist/data/price-book/openai-api.json +1184 -0
  29. package/dist/data/vendor-profiles/anthropic.json +568 -0
  30. package/dist/data/vendor-profiles/google.json +190 -0
  31. package/dist/data/vendor-profiles/microsoft.json +96 -0
  32. package/dist/data/vendor-profiles/moonshot.json +115 -0
  33. package/dist/data/vendor-profiles/openai.json +442 -0
  34. package/dist/data/vendor-profiles/xai.json +217 -0
  35. package/dist/mcp-apps/views.html +124 -0
  36. package/dist/web/assets/commit-mono-latin-400-normal-s0S3qwFW.woff +0 -0
  37. package/dist/web/assets/commit-mono-latin-400-normal-wzhe4RuD.woff2 +0 -0
  38. package/dist/web/assets/commit-mono-latin-700-normal-1-GU0IUE.woff +0 -0
  39. package/dist/web/assets/commit-mono-latin-700-normal-DU8mrtj2.woff2 +0 -0
  40. package/dist/web/assets/index-DeqVluBu.js +76 -0
  41. package/dist/web/assets/index-EJpifWDV.css +1 -0
  42. package/dist/web/assets/source-serif-4-latin-400-normal-C1O10bxN.woff +0 -0
  43. package/dist/web/assets/source-serif-4-latin-400-normal-DJ5YJwmz.woff2 +0 -0
  44. package/dist/web/assets/source-serif-4-latin-600-normal-DeJomR3S.woff +0 -0
  45. package/dist/web/assets/source-serif-4-latin-600-normal-DouSKlru.woff2 +0 -0
  46. package/dist/web/index.html +32 -0
  47. package/package.json +18 -4
@@ -0,0 +1,442 @@
1
+ {
2
+ "vendorId": "openai",
3
+ "displayName": "OpenAI",
4
+ "defaultModelId": "gpt-6.1-sol",
5
+ "caching": {
6
+ "kind": "best-effort",
7
+ "note": "Models before GPT-5.6: automatic prefix caching, implicit only, with no cache-write charge. OpenAI publishes no minimum cacheable length for them (it varies with request settings) and no breakpoint interval length. Lifetime depends on retention: in_memory keeps entries around 5 to 10 minutes of inactivity, up to one hour; 24h typically around 30 minutes, up to 24 hours. Which retention Copilot uses isn't documented."
8
+ },
9
+ "invalidation": [
10
+ {
11
+ "change": "tools-changed",
12
+ "invalidatesFrom": "tools",
13
+ "confidence": "inferred",
14
+ "sourceIds": ["openai-pc-tools", "openai-pc-prefix-match"]
15
+ },
16
+ {
17
+ "change": "system-changed",
18
+ "invalidatesFrom": "system",
19
+ "confidence": "inferred",
20
+ "sourceIds": ["openai-pc-prefix-match", "openai-pc-stable-first"]
21
+ },
22
+ {
23
+ "change": "image-added",
24
+ "invalidatesFrom": "unknown",
25
+ "confidence": "unknown",
26
+ "sourceIds": []
27
+ },
28
+ {
29
+ "change": "image-removed",
30
+ "invalidatesFrom": "unknown",
31
+ "confidence": "unknown",
32
+ "sourceIds": []
33
+ },
34
+ {
35
+ "change": "thinking-changed",
36
+ "invalidatesFrom": "unknown",
37
+ "confidence": "unknown",
38
+ "sourceIds": []
39
+ },
40
+ {
41
+ "change": "model-switch",
42
+ "invalidatesFrom": "tools",
43
+ "confidence": "documented",
44
+ "sourceIds": ["openai-pc-model"]
45
+ },
46
+ {
47
+ "change": "tool-choice-changed",
48
+ "invalidatesFrom": "unknown",
49
+ "confidence": "unknown",
50
+ "sourceIds": []
51
+ }
52
+ ],
53
+ "models": [
54
+ {
55
+ "modelId": "gpt-5.3-codex",
56
+ "displayName": "GPT-5.3-Codex",
57
+ "vendorId": "openai",
58
+ "releaseStatus": "GA",
59
+ "cheaperSiblingId": "gpt-5.4-nano",
60
+ "sourceIds": [
61
+ "gh-pricing-table",
62
+ "gh-models-pricing-openai",
63
+ "openai-pc-min-earlier"
64
+ ]
65
+ },
66
+ {
67
+ "modelId": "gpt-5.4-nano",
68
+ "displayName": "GPT-5.4 nano",
69
+ "vendorId": "openai",
70
+ "releaseStatus": "GA",
71
+ "cheaperSiblingId": "gpt-6-luna",
72
+ "sourceIds": [
73
+ "gh-pricing-table",
74
+ "gh-models-pricing-openai",
75
+ "openai-pc-min-earlier"
76
+ ]
77
+ },
78
+ {
79
+ "modelId": "gpt-5.6-luna",
80
+ "displayName": "GPT-5.6 Luna",
81
+ "vendorId": "openai",
82
+ "releaseStatus": "GA",
83
+ "cachingKind": {
84
+ "kind": "automatic-prefix",
85
+ "ttlMinutes": { "fixed": 30 },
86
+ "writeCharged": true,
87
+ "minCacheableTokens": 1024
88
+ },
89
+ "cheaperSiblingId": "gpt-6-luna",
90
+ "sourceIds": [
91
+ "gh-pricing-table",
92
+ "gh-models-pricing-openai",
93
+ "openai-pc-min-new",
94
+ "openai-pc-retention-table",
95
+ "openai-pc-write"
96
+ ]
97
+ },
98
+ {
99
+ "modelId": "gpt-5.6-sol",
100
+ "displayName": "GPT-5.6 Sol",
101
+ "vendorId": "openai",
102
+ "releaseStatus": "GA",
103
+ "cachingKind": {
104
+ "kind": "automatic-prefix",
105
+ "ttlMinutes": { "fixed": 30 },
106
+ "writeCharged": true,
107
+ "minCacheableTokens": 1024
108
+ },
109
+ "cheaperSiblingId": "gpt-5.6-terra",
110
+ "sourceIds": [
111
+ "gh-pricing-table",
112
+ "gh-models-pricing-openai",
113
+ "openai-pc-min-new",
114
+ "openai-pc-retention-table",
115
+ "openai-pc-write"
116
+ ]
117
+ },
118
+ {
119
+ "modelId": "gpt-5.6-terra",
120
+ "displayName": "GPT-5.6 Terra",
121
+ "vendorId": "openai",
122
+ "releaseStatus": "GA",
123
+ "cachingKind": {
124
+ "kind": "automatic-prefix",
125
+ "ttlMinutes": { "fixed": 30 },
126
+ "writeCharged": true,
127
+ "minCacheableTokens": 1024
128
+ },
129
+ "cheaperSiblingId": "gpt-5.6-luna",
130
+ "sourceIds": [
131
+ "gh-pricing-table",
132
+ "gh-models-pricing-openai",
133
+ "openai-pc-min-new",
134
+ "openai-pc-retention-table",
135
+ "openai-pc-write"
136
+ ]
137
+ },
138
+ {
139
+ "modelId": "gpt-6-astra",
140
+ "displayName": "GPT-6 Astra",
141
+ "vendorId": "openai",
142
+ "releaseStatus": "GA",
143
+ "cachingKind": {
144
+ "kind": "automatic-prefix",
145
+ "ttlMinutes": { "fixed": 30 },
146
+ "writeCharged": true,
147
+ "minCacheableTokens": 1024
148
+ },
149
+ "cheaperSiblingId": "gpt-6-sol",
150
+ "sourceIds": [
151
+ "gh-pricing-table",
152
+ "gh-models-pricing-openai",
153
+ "openai-pc-min-new",
154
+ "openai-pc-retention-table",
155
+ "openai-pc-write"
156
+ ]
157
+ },
158
+ {
159
+ "modelId": "gpt-6-luna",
160
+ "displayName": "GPT-6 Luna",
161
+ "vendorId": "openai",
162
+ "releaseStatus": "GA",
163
+ "cachingKind": {
164
+ "kind": "automatic-prefix",
165
+ "ttlMinutes": { "fixed": 30 },
166
+ "writeCharged": true,
167
+ "minCacheableTokens": 1024
168
+ },
169
+ "sourceIds": [
170
+ "gh-pricing-table",
171
+ "gh-models-pricing-openai",
172
+ "openai-pc-min-new",
173
+ "openai-pc-retention-table",
174
+ "openai-pc-write"
175
+ ]
176
+ },
177
+ {
178
+ "modelId": "gpt-6-sol",
179
+ "displayName": "GPT-6 Sol",
180
+ "vendorId": "openai",
181
+ "releaseStatus": "GA",
182
+ "cachingKind": {
183
+ "kind": "automatic-prefix",
184
+ "ttlMinutes": { "fixed": 30 },
185
+ "writeCharged": true,
186
+ "minCacheableTokens": 1024
187
+ },
188
+ "cheaperSiblingId": "gpt-6-luna",
189
+ "sourceIds": [
190
+ "gh-pricing-table",
191
+ "gh-models-pricing-openai",
192
+ "openai-pc-min-new",
193
+ "openai-pc-retention-table",
194
+ "openai-pc-write"
195
+ ]
196
+ },
197
+ {
198
+ "modelId": "gpt-6.1-sol",
199
+ "displayName": "GPT-6.1 Sol",
200
+ "vendorId": "openai",
201
+ "releaseStatus": "GA",
202
+ "cachingKind": {
203
+ "kind": "automatic-prefix",
204
+ "ttlMinutes": { "fixed": 30 },
205
+ "writeCharged": true,
206
+ "minCacheableTokens": 1024
207
+ },
208
+ "cheaperSiblingId": "gpt-6.1-terra",
209
+ "sourceIds": [
210
+ "gh-pricing-table",
211
+ "gh-models-pricing-openai",
212
+ "openai-pc-min-new",
213
+ "openai-pc-retention-table",
214
+ "openai-pc-write"
215
+ ]
216
+ },
217
+ {
218
+ "modelId": "gpt-6.1-terra",
219
+ "displayName": "GPT-6.1 Terra",
220
+ "vendorId": "openai",
221
+ "releaseStatus": "GA",
222
+ "cachingKind": {
223
+ "kind": "automatic-prefix",
224
+ "ttlMinutes": { "fixed": 30 },
225
+ "writeCharged": true,
226
+ "minCacheableTokens": 1024
227
+ },
228
+ "cheaperSiblingId": "gpt-6-luna",
229
+ "sourceIds": [
230
+ "gh-pricing-table",
231
+ "gh-models-pricing-openai",
232
+ "openai-pc-min-new",
233
+ "openai-pc-retention-table",
234
+ "openai-pc-write"
235
+ ]
236
+ }
237
+ ],
238
+ "assumptions": [
239
+ {
240
+ "text": "OpenAI documents no tools/system/messages render order, only that stable content should come first. The simulation assumes tools → system → messages, so the tools and system rules are inferred.",
241
+ "confidence": "unknown"
242
+ },
243
+ {
244
+ "text": "Which cache lifetime Copilot requests for GPT-5.6 and later (the 30-minute default or 12 hours) isn't documented. The simulation assumes the 30-minute default.",
245
+ "confidence": "unknown"
246
+ },
247
+ {
248
+ "text": "For GPT-5.6 and later, 30 minutes is a minimum lifetime, and a read extends coverage to at least 30 minutes after it. The simulation treats an entry as expired 30 minutes after its last read or write, though it may survive longer.",
249
+ "confidence": "inferred",
250
+ "sourceIds": ["openai-pc-ttl", "openai-pc-refresh"]
251
+ },
252
+ {
253
+ "text": "For GPT-5.3-Codex and GPT-5.4 nano, Copilot's retention is probably in_memory: GitHub has a zero data retention agreement with OpenAI, and OpenAI defaults organizations with Zero Data Retention to in_memory on models that support both values. No doc states this for Copilot, or which values these two models support.",
254
+ "confidence": "inferred",
255
+ "sourceIds": [
256
+ "gh-model-hosting-openai-zdr",
257
+ "openai-pc-zdr-default",
258
+ "openai-pc-in-memory"
259
+ ]
260
+ },
261
+ {
262
+ "text": "Changing reasoning effort can change model-side reasoning instructions, and so the prefix. OpenAI doesn't say from which point, so the rule is unknown.",
263
+ "confidence": "documented",
264
+ "sourceIds": ["openai-pc-effort"]
265
+ },
266
+ {
267
+ "text": "Reasoning tokens are billed as output tokens.",
268
+ "confidence": "documented",
269
+ "sourceIds": ["openai-reasoning-billing"]
270
+ },
271
+ {
272
+ "text": "Copilot bills GitHub's tiers (rule register owner decision 3): GPT-5.6 Luna's long-context tier starts above 200K input tokens on GitHub, though OpenAI's pricing page shows 272K for all models; the other tiered models start above 272K. The long-context output prices are GitHub's, which differ from OpenAI's own page data (owner decision 4, open).",
273
+ "confidence": "documented",
274
+ "sourceIds": ["gh-pricing-table", "openai-pricing-long-context"]
275
+ },
276
+ {
277
+ "text": "GitHub's thresholds ('≤ 200K', '≤ 272K') are read as 200,000 and 272,000 input tokens; GitHub doesn't define K.",
278
+ "confidence": "inferred",
279
+ "sourceIds": ["gh-pricing-table"]
280
+ },
281
+ {
282
+ "text": "GitHub doesn't say which tokens count toward a tier threshold or whether the long-context tier prices the whole request. The simulation prices the whole request by its total input tokens.",
283
+ "confidence": "unknown"
284
+ }
285
+ ],
286
+ "sources": [
287
+ {
288
+ "id": "gh-pricing-table",
289
+ "title": "GitHub Copilot price table (github/docs models-and-pricing.yml)",
290
+ "url": "https://github.com/github/docs/blob/cc0c29a040c251c48ed65198f108a484c33406fa/data/tables/copilot/models-and-pricing.yml",
291
+ "quote": "Applies to Anthropic models and to GPT-5.6 and later OpenAI model families. Use \"Not applicable\" for models that have no cache write cost.",
292
+ "checkedAt": "2026-11-05"
293
+ },
294
+ {
295
+ "id": "gh-models-pricing-openai",
296
+ "title": "GitHub Docs: Models and pricing for GitHub Copilot",
297
+ "url": "https://docs.github.com/en/copilot/reference/copilot-billing/models-and-pricing",
298
+ "quote": "Earlier OpenAI models have no cache write cost.",
299
+ "checkedAt": "2026-11-05"
300
+ },
301
+ {
302
+ "id": "gh-model-hosting-openai-zdr",
303
+ "title": "GitHub Docs: Hosting of models for GitHub Copilot (OpenAI models)",
304
+ "url": "https://docs.github.com/en/copilot/reference/ai-models/model-hosting",
305
+ "quote": "GitHub maintains a zero data retention agreement with OpenAI.",
306
+ "checkedAt": "2026-11-05"
307
+ },
308
+ {
309
+ "id": "openai-pc-default-on",
310
+ "title": "OpenAI: Prompt caching",
311
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
312
+ "quote": "Prompt caching is enabled by default for supported OpenAI models.",
313
+ "checkedAt": "2026-11-04"
314
+ },
315
+ {
316
+ "id": "openai-pc-implicit-breakpoint",
317
+ "title": "OpenAI: Prompt caching (implicit breakpoint, GPT-5.6 and later)",
318
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
319
+ "quote": "OpenAI places a breakpoint at the end of the latest eligible message.",
320
+ "checkedAt": "2026-11-04"
321
+ },
322
+ {
323
+ "id": "openai-pc-min-new",
324
+ "title": "OpenAI: Prompt caching (minimum length)",
325
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
326
+ "quote": "The minimum cacheable prompt length is 1,024 tokens for GPT-5.6 and later and varies by request settings for earlier models.",
327
+ "checkedAt": "2026-11-04"
328
+ },
329
+ {
330
+ "id": "openai-pc-min-earlier",
331
+ "title": "OpenAI: Prompt caching (minimum length, earlier models)",
332
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
333
+ "quote": "For models before GPT-5.6, the minimum cacheable input length varies with request settings, including tools, images, output schemas, reasoning effort, and verbosity.",
334
+ "checkedAt": "2026-11-04"
335
+ },
336
+ {
337
+ "id": "openai-pc-earlier-interval",
338
+ "title": "OpenAI: Prompt caching (implicit breakpoints, earlier models)",
339
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
340
+ "quote": "Spaced at regular, model-dependent intervals.",
341
+ "checkedAt": "2026-11-04"
342
+ },
343
+ {
344
+ "id": "openai-pc-retention-table",
345
+ "title": "OpenAI: Prompt caching (supported retention values)",
346
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
347
+ "quote": "Supported retention values | \"30m\" (default), or \"12h\" in the Responses API | \"24h\" only | \"in_memory\" or \"24h\" *",
348
+ "checkedAt": "2026-11-04"
349
+ },
350
+ {
351
+ "id": "openai-pc-ttl",
352
+ "title": "OpenAI: Prompt caching (cache lifetime, GPT-5.6 and later)",
353
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
354
+ "quote": "set `prompt_cache_options.ttl` to choose the minimum cache lifetime.",
355
+ "checkedAt": "2026-11-04"
356
+ },
357
+ {
358
+ "id": "openai-pc-refresh",
359
+ "title": "OpenAI: Prompt caching (refresh on read, GPT-5.6 and later)",
360
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
361
+ "quote": "A 30-minute read refreshes coverage to at least 30 minutes after that read. If it uses an entry with valid 12-hour coverage, it preserves the later of the existing expiry and 30 minutes after the read. It does not restart a 12-hour clock or incur another write charge.",
362
+ "checkedAt": "2026-11-04"
363
+ },
364
+ {
365
+ "id": "openai-pc-write",
366
+ "title": "OpenAI: Prompt caching (cache-write charge, GPT-5.6 and later)",
367
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
368
+ "quote": "cache writes cost 1.25× the standard, uncached input-token rate for the default 30-minute lifetime.",
369
+ "checkedAt": "2026-11-04"
370
+ },
371
+ {
372
+ "id": "openai-pc-in-memory",
373
+ "title": "OpenAI: Prompt caching (in_memory retention)",
374
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
375
+ "quote": "in_memory: Entries typically remain active for around 5 to 10 minutes of inactivity, up to one hour.",
376
+ "checkedAt": "2026-11-04"
377
+ },
378
+ {
379
+ "id": "openai-pc-24h",
380
+ "title": "OpenAI: Prompt caching (24h retention)",
381
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
382
+ "quote": "24h: Extended retention typically keeps entries available for around 30 minutes and can retain them for up to 24 hours.",
383
+ "checkedAt": "2026-11-04"
384
+ },
385
+ {
386
+ "id": "openai-pc-zdr-default",
387
+ "title": "OpenAI: Prompt caching (default retention with Zero Data Retention)",
388
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
389
+ "quote": "Organizations with Zero Data Retention enabled default to in_memory.",
390
+ "checkedAt": "2026-11-04"
391
+ },
392
+ {
393
+ "id": "openai-pc-prefix-match",
394
+ "title": "OpenAI: Prompt caching (prefix match)",
395
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
396
+ "quote": "Cache reuse requires the entire rendered prefix to match.",
397
+ "checkedAt": "2026-11-04"
398
+ },
399
+ {
400
+ "id": "openai-pc-tools",
401
+ "title": "OpenAI: Prompt caching (tool changes)",
402
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
403
+ "quote": "Changes tool names, descriptions, schemas, ordering, or tool-specific instructions.",
404
+ "checkedAt": "2026-11-04"
405
+ },
406
+ {
407
+ "id": "openai-pc-stable-first",
408
+ "title": "OpenAI: Prompt caching (prompt structure)",
409
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
410
+ "quote": "Put stable developer instructions and shared reference material first.",
411
+ "checkedAt": "2026-11-04"
412
+ },
413
+ {
414
+ "id": "openai-pc-model",
415
+ "title": "OpenAI: Prompt caching (model changes)",
416
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
417
+ "quote": "A different model can use different weights and caching behavior.",
418
+ "checkedAt": "2026-11-04"
419
+ },
420
+ {
421
+ "id": "openai-pc-effort",
422
+ "title": "OpenAI: Prompt caching (reasoning effort changes)",
423
+ "url": "https://developers.openai.com/api/docs/guides/prompt-caching",
424
+ "quote": "Can change model-side reasoning instructions.",
425
+ "checkedAt": "2026-11-04"
426
+ },
427
+ {
428
+ "id": "openai-pricing-long-context",
429
+ "title": "OpenAI: API pricing (long-context toggle)",
430
+ "url": "https://developers.openai.com/api/docs/pricing",
431
+ "quote": "Long: >272K input tokens",
432
+ "checkedAt": "2026-11-04"
433
+ },
434
+ {
435
+ "id": "openai-reasoning-billing",
436
+ "title": "OpenAI: Reasoning models",
437
+ "url": "https://developers.openai.com/api/docs/guides/reasoning",
438
+ "quote": "While reasoning tokens are not visible via the API, they still occupy space in the model’s context window and are billed as output tokens.",
439
+ "checkedAt": "2026-11-05"
440
+ }
441
+ ]
442
+ }
@@ -0,0 +1,217 @@
1
+ {
2
+ "vendorId": "xai",
3
+ "displayName": "xAI",
4
+ "defaultModelId": "grok-4.7",
5
+ "caching": {
6
+ "kind": "best-effort",
7
+ "note": "Automatic prefix caching that isn't guaranteed: entries can be evicted at any time, and requests may be routed to different servers. Messages at the start of the request that match exactly are served from cache, tool call results included. xAI documents no cache lifetime, no minimum cacheable length and no cache-write charge, and GitHub's table has no cache-write column for xAI."
8
+ },
9
+ "invalidation": [
10
+ {
11
+ "change": "tools-changed",
12
+ "invalidatesFrom": "unknown",
13
+ "confidence": "unknown",
14
+ "sourceIds": []
15
+ },
16
+ {
17
+ "change": "system-changed",
18
+ "invalidatesFrom": "unknown",
19
+ "confidence": "unknown",
20
+ "sourceIds": []
21
+ },
22
+ {
23
+ "change": "image-added",
24
+ "invalidatesFrom": "unknown",
25
+ "confidence": "unknown",
26
+ "sourceIds": []
27
+ },
28
+ {
29
+ "change": "image-removed",
30
+ "invalidatesFrom": "unknown",
31
+ "confidence": "unknown",
32
+ "sourceIds": []
33
+ },
34
+ {
35
+ "change": "thinking-changed",
36
+ "invalidatesFrom": "unknown",
37
+ "confidence": "unknown",
38
+ "sourceIds": []
39
+ },
40
+ {
41
+ "change": "model-switch",
42
+ "invalidatesFrom": "unknown",
43
+ "confidence": "unknown",
44
+ "sourceIds": []
45
+ },
46
+ {
47
+ "change": "tool-choice-changed",
48
+ "invalidatesFrom": "unknown",
49
+ "confidence": "unknown",
50
+ "sourceIds": []
51
+ }
52
+ ],
53
+ "models": [
54
+ {
55
+ "modelId": "grok-4.5",
56
+ "displayName": "Grok 4.5",
57
+ "vendorId": "xai",
58
+ "releaseStatus": "GA",
59
+ "sourceIds": ["gh-pricing-table", "gh-model-hosting-xai"]
60
+ },
61
+ {
62
+ "modelId": "grok-4.6",
63
+ "displayName": "Grok 4.6",
64
+ "vendorId": "xai",
65
+ "releaseStatus": "GA",
66
+ "sourceIds": ["gh-pricing-table", "gh-model-hosting-xai"]
67
+ },
68
+ {
69
+ "modelId": "grok-4.7",
70
+ "displayName": "Grok 4.7",
71
+ "vendorId": "xai",
72
+ "releaseStatus": "GA",
73
+ "sourceIds": ["gh-pricing-table", "gh-model-hosting-xai"]
74
+ }
75
+ ],
76
+ "assumptions": [
77
+ {
78
+ "text": "xAI documents no cache lifetime, only that entries can be evicted at any time. The simulation's cache lifetime is assumed (D5).",
79
+ "confidence": "unknown"
80
+ },
81
+ {
82
+ "text": "Whether Copilot sends x-grok-conv-id or another routing hint, which xAI recommends to maximize cache hits, isn't documented.",
83
+ "confidence": "unknown"
84
+ },
85
+ {
86
+ "text": "xAI documents no tools/system/messages order; it advises putting system prompts, few-shot examples and reference documents at the beginning. The simulation assumes tools → system → messages.",
87
+ "confidence": "unknown"
88
+ },
89
+ {
90
+ "text": "Any edit, removal or reordering of earlier messages breaks the cache; only appended messages keep it.",
91
+ "confidence": "documented",
92
+ "sourceIds": ["xai-caching-earlier-messages"]
93
+ },
94
+ {
95
+ "text": "On reasoning models, leaving out reasoning_content from previous responses causes cache misses.",
96
+ "confidence": "documented",
97
+ "sourceIds": ["xai-caching-reasoning"]
98
+ },
99
+ {
100
+ "text": "Copilot bills GitHub's tiers (rule register owner decision 5): the default tier up to and including 200K input tokens, the long-context tier above it. xAI's own boundary puts exactly 200k in the long tier, and xAI bills all tokens in such a request, cached ones included, at the long-context rates.",
101
+ "confidence": "documented",
102
+ "sourceIds": [
103
+ "gh-pricing-table",
104
+ "xai-models-long-context",
105
+ "xai-usage-long-context"
106
+ ]
107
+ },
108
+ {
109
+ "text": "GitHub's '≤ 200K' threshold is read as 200,000 input tokens; GitHub doesn't define K.",
110
+ "confidence": "inferred",
111
+ "sourceIds": ["gh-pricing-table"]
112
+ },
113
+ {
114
+ "text": "xAI's own Grok 4.5 cached-input price is $0.30 (< 200k) and $0.60 (≥ 200k); GitHub lists $0.50 and $1.00. The profile uses GitHub's table, which Copilot bills; the cause isn't documented (rule register owner decision 6, open).",
115
+ "confidence": "documented",
116
+ "sourceIds": ["xai-models-pricing", "gh-pricing-table"]
117
+ },
118
+ {
119
+ "text": "Grok 4.5, 4.6 and 4.7 have identical Copilot prices, so xAI has no cheaper model and two-model scenarios are skipped for it (rule register owner decision 2).",
120
+ "confidence": "documented",
121
+ "sourceIds": ["gh-pricing-table"]
122
+ }
123
+ ],
124
+ "sources": [
125
+ {
126
+ "id": "gh-pricing-table",
127
+ "title": "GitHub Copilot price table (github/docs models-and-pricing.yml)",
128
+ "url": "https://github.com/github/docs/blob/cc0c29a040c251c48ed65198f108a484c33406fa/data/tables/copilot/models-and-pricing.yml",
129
+ "quote": "threshold: Input token threshold for pricing tier (OpenAI, Google, and xAI; Anthropic only for models with more than one pricing tier).",
130
+ "checkedAt": "2026-11-05"
131
+ },
132
+ {
133
+ "id": "gh-model-hosting-xai",
134
+ "title": "GitHub Docs: Hosting of models for GitHub Copilot (xAI models)",
135
+ "url": "https://docs.github.com/en/copilot/reference/ai-models/model-hosting",
136
+ "quote": "These models are hosted on xAI. xAI operates these models in GitHub Copilot under a zero data retention API policy.",
137
+ "checkedAt": "2026-11-05"
138
+ },
139
+ {
140
+ "id": "xai-caching-automatic",
141
+ "title": "xAI: Prompt caching",
142
+ "url": "https://docs.x.ai/developers/advanced-api-usage/prompt-caching",
143
+ "quote": "The xAI API performs prompt caching automatically.",
144
+ "checkedAt": "2026-11-04"
145
+ },
146
+ {
147
+ "id": "xai-caching-prefix",
148
+ "title": "xAI: Prompt caching (prefix)",
149
+ "url": "https://docs.x.ai/developers/advanced-api-usage/prompt-caching",
150
+ "quote": "When consecutive requests share the same starting messages, the xAI API automatically caches them. On the next request, messages at the beginning that match exactly are served from cache:",
151
+ "checkedAt": "2026-11-04"
152
+ },
153
+ {
154
+ "id": "xai-caching-not-guaranteed",
155
+ "title": "xAI: Prompt caching, how it works",
156
+ "url": "https://docs.x.ai/developers/advanced-api-usage/prompt-caching/how-it-works",
157
+ "quote": "Prompt caching is not 100% guaranteed. Cache entries can be evicted due to memory pressure, and requests may be routed to different servers.",
158
+ "checkedAt": "2026-11-04"
159
+ },
160
+ {
161
+ "id": "xai-caching-eviction",
162
+ "title": "xAI: Prompt caching, best practices (cache lifetime)",
163
+ "url": "https://docs.x.ai/developers/advanced-api-usage/prompt-caching/best-practices",
164
+ "quote": "Cache entries can be evicted at any time due to server load or restarts. Use `x-grok-conv-id` to maximize retention by routing to the same server.",
165
+ "checkedAt": "2026-11-04"
166
+ },
167
+ {
168
+ "id": "xai-caching-tool-results",
169
+ "title": "xAI: Prompt caching, best practices (cacheable prefix)",
170
+ "url": "https://docs.x.ai/developers/advanced-api-usage/prompt-caching/best-practices",
171
+ "quote": "The cacheable prefix includes all messages up to and including tool call results.",
172
+ "checkedAt": "2026-11-04"
173
+ },
174
+ {
175
+ "id": "xai-caching-front-load",
176
+ "title": "xAI: Prompt caching, best practices (prompt structure)",
177
+ "url": "https://docs.x.ai/developers/advanced-api-usage/prompt-caching/best-practices",
178
+ "quote": "**Front-load static content** — Place system prompts, few-shot examples, and reference documents at the beginning where they form a stable prefix.",
179
+ "checkedAt": "2026-11-04"
180
+ },
181
+ {
182
+ "id": "xai-caching-earlier-messages",
183
+ "title": "xAI: Prompt caching, multi-turn",
184
+ "url": "https://docs.x.ai/developers/advanced-api-usage/prompt-caching/multi-turn",
185
+ "quote": "Any change to earlier messages breaks the cache. Only append new messages at the end.",
186
+ "checkedAt": "2026-11-04"
187
+ },
188
+ {
189
+ "id": "xai-caching-reasoning",
190
+ "title": "xAI: Prompt caching, multi-turn (reasoning models)",
191
+ "url": "https://docs.x.ai/developers/advanced-api-usage/prompt-caching/multi-turn",
192
+ "quote": "For reasoning models, you **must** include `reasoning_content` from previous responses; omitting it is the top cause of cache misses.",
193
+ "checkedAt": "2026-11-04"
194
+ },
195
+ {
196
+ "id": "xai-models-pricing",
197
+ "title": "xAI: Models and pricing",
198
+ "url": "https://docs.x.ai/developers/models",
199
+ "quote": "| grok-4.5 (< 200k prompt tokens) | 500k | $2.00 | $0.30 | $6.00 |",
200
+ "checkedAt": "2026-11-04"
201
+ },
202
+ {
203
+ "id": "xai-models-long-context",
204
+ "title": "xAI: Models and pricing (long context pricing)",
205
+ "url": "https://docs.x.ai/developers/models",
206
+ "quote": "Models listed with two rows use long context pricing: requests whose prompt reaches the listed token threshold are billed at the higher rate for all tokens in the request.",
207
+ "checkedAt": "2026-11-04"
208
+ },
209
+ {
210
+ "id": "xai-usage-long-context",
211
+ "title": "xAI: Prompt caching, usage and pricing",
212
+ "url": "https://docs.x.ai/developers/advanced-api-usage/prompt-caching/usage-and-pricing",
213
+ "quote": "Long context pricing applies when total prompt tokens (including cached tokens) exceed the model's long context threshold. Both cached and non-cached tokens use their respective long-context rates in this case.",
214
+ "checkedAt": "2026-11-04"
215
+ }
216
+ ]
217
+ }