leanprompt 0.0.1 → 0.1.0-dev.8
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/LICENSE +202 -0
- package/LICENSE-DOCS +396 -0
- package/NOTICE +11 -0
- package/README.md +86 -3
- package/cli/dist/detect.d.ts +23 -0
- package/cli/dist/detect.js +219 -0
- package/cli/dist/evalAudit.d.ts +32 -0
- package/cli/dist/evalAudit.js +161 -0
- package/cli/dist/facts.d.ts +14 -0
- package/cli/dist/facts.js +43 -0
- package/cli/dist/forms.d.ts +23 -0
- package/cli/dist/forms.js +199 -0
- package/cli/dist/frontmatter.d.ts +10 -0
- package/cli/dist/frontmatter.js +32 -0
- package/cli/dist/help.d.ts +27 -0
- package/cli/dist/help.js +118 -0
- package/cli/dist/init.d.ts +78 -0
- package/cli/dist/init.js +358 -0
- package/cli/dist/install.d.ts +20 -0
- package/cli/dist/install.js +225 -0
- package/cli/dist/isMain.d.ts +6 -0
- package/cli/dist/isMain.js +18 -0
- package/cli/dist/lesson.d.ts +16 -0
- package/cli/dist/lesson.js +205 -0
- package/cli/dist/lint/facts.d.ts +7 -0
- package/cli/dist/lint/facts.js +163 -0
- package/cli/dist/lint/numbers.d.ts +26 -0
- package/cli/dist/lint/numbers.js +163 -0
- package/cli/dist/lint/rules.d.ts +20 -0
- package/cli/dist/lint/rules.js +170 -0
- package/cli/dist/log/logger.d.ts +49 -0
- package/cli/dist/log/logger.js +148 -0
- package/cli/dist/log/record.d.ts +56 -0
- package/cli/dist/log/record.js +117 -0
- package/cli/dist/main.d.ts +6 -0
- package/cli/dist/main.js +67 -0
- package/cli/dist/profile.d.ts +93 -0
- package/cli/dist/profile.js +372 -0
- package/cli/dist/report/cost.d.ts +55 -0
- package/cli/dist/report/cost.js +151 -0
- package/cli/dist/report/html.d.ts +81 -0
- package/cli/dist/report/html.js +555 -0
- package/cli/dist/report/template.html +269 -0
- package/cli/dist/score/calibrate.d.ts +65 -0
- package/cli/dist/score/calibrate.js +213 -0
- package/cli/dist/score/measured.d.ts +66 -0
- package/cli/dist/score/measured.js +191 -0
- package/cli/dist/score/static.d.ts +112 -0
- package/cli/dist/score/static.js +172 -0
- package/cli/dist/score/write.d.ts +29 -0
- package/cli/dist/score/write.js +247 -0
- package/forms/AGENTS.block.md +25 -0
- package/forms/opencode/commands/leanprompt-audit.md +10 -0
- package/forms/opencode/commands/leanprompt.md +8 -0
- package/forms/skills/generation-economy/SKILL.md +89 -0
- package/forms/skills/generation-economy/rules/LP-GE-01.md +93 -0
- package/forms/skills/generation-economy/rules/LP-GE-02.md +82 -0
- package/forms/skills/generation-economy/rules/LP-GE-03.md +87 -0
- package/forms/skills/generation-economy/rules/LP-GE-04.md +118 -0
- package/forms/skills/generation-economy/rules/LP-GE-05.md +84 -0
- package/forms/skills/generation-economy/rules/LP-GE-06.md +76 -0
- package/forms/skills/generation-economy/rules/LP-GE-07.md +84 -0
- package/forms/skills/generation-economy/rules/LP-GE-08.md +71 -0
- package/forms/skills/generation-economy/rules/LP-GE-09.md +79 -0
- package/forms/skills/generation-economy/rules/LP-GE-10.md +104 -0
- package/forms/skills/leanprompt/SKILL.md +48 -0
- package/forms/skills/leanprompt/fix.md +15 -0
- package/forms/skills/leanprompt/init.md +30 -0
- package/forms/skills/llm-call-audit/SKILL.md +169 -0
- package/forms/skills/llm-call-audit/call-shapes.md +99 -0
- package/forms/skills/llm-call-audit/presenting.md +72 -0
- package/forms/skills/llm-call-audit/report-template.md +113 -0
- package/forms/skills/lmwarden/SKILL.md +97 -0
- package/forms/skills/lmwarden/rules/LP-LW-01.md +73 -0
- package/forms/skills/lmwarden/rules/LP-LW-02.md +78 -0
- package/forms/skills/lmwarden/rules/LP-LW-03.md +73 -0
- package/forms/skills/measure-loop/SKILL.md +155 -0
- package/forms/skills/measure-loop/templates/stable-head.template.ts +38 -0
- package/forms/skills/measure-loop/templates/stable_head_template.py +40 -0
- package/forms/skills/prefill-cache/SKILL.md +66 -0
- package/forms/skills/prefill-cache/rules/LP-PC-01.md +103 -0
- package/forms/skills/prefill-cache/rules/LP-PC-02.md +80 -0
- package/forms/skills/prefill-cache/rules/LP-PC-03.md +75 -0
- package/forms/skills/prefill-cache/rules/LP-PC-04.md +79 -0
- package/forms/skills/prefill-cache/rules/LP-PC-05.md +68 -0
- package/forms/skills/prefill-cache/rules/LP-PC-06.md +71 -0
- package/forms/skills/prefill-cache/rules/LP-PC-07.md +97 -0
- package/forms/skills/prefill-cache/rules/LP-PC-08.md +67 -0
- package/forms/skills/prefill-cache/rules/LP-PC-09.md +75 -0
- package/forms/skills/prefill-cache/rules/LP-PC-10.md +76 -0
- package/forms/skills/prefill-cache/rules/LP-PC-11.md +72 -0
- package/forms/skills/prefill-cache/rules/LP-PC-12.md +73 -0
- package/forms/skills/prompt-diet/SKILL.md +69 -0
- package/forms/skills/prompt-diet/rules/LP-PD-01.md +79 -0
- package/forms/skills/prompt-diet/rules/LP-PD-02.md +73 -0
- package/forms/skills/prompt-diet/rules/LP-PD-03.md +65 -0
- package/forms/skills/prompt-diet/rules/LP-PD-04.md +77 -0
- package/forms/skills/prompt-diet/rules/LP-PD-05.md +71 -0
- package/forms/skills/prompt-diet/rules/LP-PD-06.md +68 -0
- package/models/anthropic-thinking.md +38 -0
- package/models/openai-reasoning.md +35 -0
- package/models/qwen.md +34 -0
- package/package.json +31 -8
- package/providers/anthropic.md +83 -0
- package/providers/deepinfra.md +46 -0
- package/providers/gemini.md +61 -0
- package/providers/openai.md +73 -0
- package/providers/openrouter.md +66 -0
- package/providers/sglang.md +41 -0
- package/providers/vllm.md +52 -0
- package/runtimes/http-clients.md +20 -0
- package/skills/_template/RULE.md +31 -0
- package/skills/generation-economy/SKILL.md +88 -0
- package/skills/generation-economy/rules/LP-GE-01.md +92 -0
- package/skills/generation-economy/rules/LP-GE-02.md +81 -0
- package/skills/generation-economy/rules/LP-GE-03.md +86 -0
- package/skills/generation-economy/rules/LP-GE-04.md +117 -0
- package/skills/generation-economy/rules/LP-GE-05.md +83 -0
- package/skills/generation-economy/rules/LP-GE-06.md +75 -0
- package/skills/generation-economy/rules/LP-GE-07.md +83 -0
- package/skills/generation-economy/rules/LP-GE-08.md +70 -0
- package/skills/generation-economy/rules/LP-GE-09.md +78 -0
- package/skills/generation-economy/rules/LP-GE-10.md +103 -0
- package/skills/leanprompt/SKILL.md +47 -0
- package/skills/leanprompt/fix.md +14 -0
- package/skills/leanprompt/init.md +29 -0
- package/skills/llm-call-audit/SKILL.md +168 -0
- package/skills/llm-call-audit/call-shapes.md +98 -0
- package/skills/llm-call-audit/presenting.md +71 -0
- package/skills/llm-call-audit/report-template.md +112 -0
- package/skills/lmwarden/SKILL.md +96 -0
- package/skills/lmwarden/rules/LP-LW-01.md +72 -0
- package/skills/lmwarden/rules/LP-LW-02.md +77 -0
- package/skills/lmwarden/rules/LP-LW-03.md +72 -0
- package/skills/measure-loop/SKILL.md +154 -0
- package/skills/measure-loop/templates/stable-head.template.ts +38 -0
- package/skills/measure-loop/templates/stable_head_template.py +40 -0
- package/skills/prefill-cache/SKILL.md +65 -0
- package/skills/prefill-cache/rules/LP-PC-01.md +102 -0
- package/skills/prefill-cache/rules/LP-PC-02.md +79 -0
- package/skills/prefill-cache/rules/LP-PC-03.md +74 -0
- package/skills/prefill-cache/rules/LP-PC-04.md +78 -0
- package/skills/prefill-cache/rules/LP-PC-05.md +67 -0
- package/skills/prefill-cache/rules/LP-PC-06.md +70 -0
- package/skills/prefill-cache/rules/LP-PC-07.md +96 -0
- package/skills/prefill-cache/rules/LP-PC-08.md +66 -0
- package/skills/prefill-cache/rules/LP-PC-09.md +74 -0
- package/skills/prefill-cache/rules/LP-PC-10.md +75 -0
- package/skills/prefill-cache/rules/LP-PC-11.md +71 -0
- package/skills/prefill-cache/rules/LP-PC-12.md +72 -0
- package/skills/prompt-diet/SKILL.md +68 -0
- package/skills/prompt-diet/rules/LP-PD-01.md +78 -0
- package/skills/prompt-diet/rules/LP-PD-02.md +72 -0
- package/skills/prompt-diet/rules/LP-PD-03.md +64 -0
- package/skills/prompt-diet/rules/LP-PD-04.md +76 -0
- package/skills/prompt-diet/rules/LP-PD-05.md +70 -0
- package/skills/prompt-diet/rules/LP-PD-06.md +67 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
provider: anthropic
|
|
3
|
+
checked: 2026-11-26
|
|
4
|
+
source: https://platform.claude.com/docs/en/build-with-claude/prompt-caching
|
|
5
|
+
cache:
|
|
6
|
+
mode: breakpoints
|
|
7
|
+
min_tokens: 4096
|
|
8
|
+
max_breakpoints: 4
|
|
9
|
+
ttl_seconds: 300
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Anthropic (Claude API)
|
|
13
|
+
|
|
14
|
+
Status: documented. Cache reuse without markers measured in E1 (0 tokens cached on 29 turns of sessions that send no `cache_control`).
|
|
15
|
+
|
|
16
|
+
Frontmatter `min_tokens: 4096` is the conservative default: the largest per-model minimum below. Use the per-model value when the model is known.
|
|
17
|
+
|
|
18
|
+
## Cache lifetime and markers
|
|
19
|
+
|
|
20
|
+
| Fact | Value | Basis |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| Default lifetime | 5 minutes, refreshed at no extra cost on each use | docs, checked 2026-11-26 |
|
|
23
|
+
| Longer lifetime | 1 hour, `"ttl": "1h"` in `cache_control` | docs |
|
|
24
|
+
| Breakpoints per request | 4 explicit; automatic caching (top-level `cache_control`) uses one of the 4 | docs |
|
|
25
|
+
| Lookback per breakpoint | 20 blocks, counting the breakpoint | docs |
|
|
26
|
+
| Cache write | 1.25x base input (5 minutes), 2x (1 hour) | docs |
|
|
27
|
+
| Cache read | 0.1x base input by default; 0.05x on Opus 5.5 and Sonnet 5.5; 0.025x on Fable 5.2, Mythos 5.2, Fable 5.1, Mythos 5.1 | docs |
|
|
28
|
+
| Usage fields | `cache_creation_input_tokens`, `cache_read_input_tokens`, `input_tokens` | docs |
|
|
29
|
+
| Without markers | nothing cached on the sessions measured | E1 |
|
|
30
|
+
|
|
31
|
+
## Minimum cacheable prompt, by model (docs)
|
|
32
|
+
|
|
33
|
+
Shorter prompts are processed without caching and return no error.
|
|
34
|
+
|
|
35
|
+
| Minimum tokens | Models |
|
|
36
|
+
|---|---|
|
|
37
|
+
| 512 | Fable 5.2, Mythos 5.2, Fable 5.1, Mythos 5.1, Opus 5.5, Opus 5, Sonnet 5.5, Fable 5, Mythos 5, Haiku 5.5 |
|
|
38
|
+
| 1,024 | Opus 4.8, Sonnet 5, Sonnet 4.6, Sonnet 4.5, Opus 4.1, Opus 4, Sonnet 4 |
|
|
39
|
+
| 2,048 | Mythos Preview, Opus 4.7 |
|
|
40
|
+
| 4,096 | Opus 4.6, Opus 4.5, Haiku 4.5 |
|
|
41
|
+
|
|
42
|
+
## What invalidates a cached prefix (docs)
|
|
43
|
+
|
|
44
|
+
- Tools render first. Changing a tool definition (names, descriptions, parameters) invalidates tools, system and messages. Appending a tool after a cached tool block is not safe on this provider (E3: cached 0 with no breakpoint in front of the change). A `cache_control` mark on the last original tool should keep the tool block, because marks are written at a block boundary; this is untested here (E3 had no breakpoint in front of the change) and the docs do not describe this case (checked 2026-11-26).
|
|
45
|
+
- Toggling web search or citations, or the speed setting, invalidates system and messages.
|
|
46
|
+
- Thinking parameters invalidate message blocks. The thinking mode and `budget_tokens` are rendered into the prompt. See `models/anthropic-thinking.md`.
|
|
47
|
+
- `output_config.effort` can invalidate message blocks, and on some models tool and system caches. Setting it explicitly to the model default does not.
|
|
48
|
+
- `tool_choice` and adding or removing images invalidate message blocks only.
|
|
49
|
+
- Batch API: requests can run concurrently, so a cache written by one line may not be visible to the others. OpenRouter's docs suggest 1-hour breakpoints on a shared prefix.
|
|
50
|
+
|
|
51
|
+
## Generation features (docs, checked 2026-11-26)
|
|
52
|
+
|
|
53
|
+
Used by the `generation-economy` rules.
|
|
54
|
+
|
|
55
|
+
| Fact | Value | Source |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `n` (several samples per request) | No `n` parameter in the Messages API body parameters; one request returns one message | https://platform.claude.com/docs/en/api/messages/create |
|
|
58
|
+
| Output limit | `max_tokens` (required); "our models may stop before reaching this maximum". Thinking tokens count toward it (`models/anthropic-thinking.md`) | same page |
|
|
59
|
+
| Truncation signal | `stop_reason: "max_tokens"` ("Raise `max_tokens` or continue the response"; a truncated tool call needs a retry with a higher `max_tokens`); `model_context_window_exceeded` ("Treat the response as truncated") | https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons |
|
|
60
|
+
| Usage field | `usage.output_tokens` | Messages API reference |
|
|
61
|
+
| Message Batches | Costs reduced by 50 percent; most batches finish in less than 1 hour; batches expire if not done within 24 hours (expired requests are not billed); up to 100,000 requests or 256 MB; results kept 29 days. Prompt caching works in batches on a best-effort basis; the page suggests the 1-hour cache lifetime for shared context | https://platform.claude.com/docs/en/build-with-claude/batch-processing |
|
|
62
|
+
| Service tiers | Legacy. Priority Tier needs an existing commitment (no longer sold); `service_tier` accepts `auto` and `standard_only`. No cheaper interactive tier is listed | https://platform.claude.com/docs/en/api/service-tiers |
|
|
63
|
+
| Predicted outputs | No prediction parameter in the Messages API body parameters | https://platform.claude.com/docs/en/api/messages/create |
|
|
64
|
+
| Structured outputs | `output_config.format: {type: "json_schema", schema}` (SDK helper `messages.parse`), and `strict: true` on tools. Constrained decoding: "No retries needed for schema violations". Unsupported schema features return 400. The first use of a schema compiles a grammar (cached 24 hours from last use). Changing `output_config.format` invalidates the prompt cache for that conversation | https://platform.claude.com/docs/en/build-with-claude/structured-outputs (first 100,000 of 112,853 characters read) |
|
|
65
|
+
| Long requests | Use streaming or the batch API for long requests, "especially those over 10 minutes"; avoid a large `max_tokens` without streaming. The SDK checks that a non-streaming request is not expected to exceed a 10-minute timeout | https://platform.claude.com/docs/en/api/errors |
|
|
66
|
+
| SDK retries | 2 retries by default (3 attempts); follows `x-should-retry` when present, else retries connection errors, timeouts, 408, 409, 429 and 5xx; waits `retry-after` or backs off from 0.5 to 8 seconds. The SDK does not retry an error inside a stream | same page |
|
|
67
|
+
| Errors | 400 `invalid_request_error`, 401 `authentication_error`, 413 `request_too_large`; 504 `timeout_error` (for long requests the page points to streaming); 529 `overloaded_error` (temporary); 429 also covers a monthly spend cap, which has no `retry-after` and keeps failing, so limit retries after a 429; 500: retry only if `x-should-retry` is not `false` | same page |
|
|
68
|
+
| Client disconnect | Whether closing the connection stops generation and billing on a direct call: not stated on the pages above. Through OpenRouter, Anthropic is listed among providers whose streams stop on abort (`providers/openrouter.md`) | not stated (checked 2026-11-26) |
|
|
69
|
+
|
|
70
|
+
## Prompt size facts (docs, checked 2026-11-26)
|
|
71
|
+
|
|
72
|
+
Used by the `prompt-diet` rules.
|
|
73
|
+
|
|
74
|
+
| Fact | Value | Source |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| Tool definitions are input | Tool use requests are priced on "the total number of input tokens sent to the model (including in the `tools` parameter)"; the extra tokens come from the `tools` parameter (names, descriptions, schemas), `tool_use` blocks and `tool_result` blocks. With any tool present the API also adds a tool use system prompt, whose size per model and `tool_choice` is listed on the page | https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview |
|
|
77
|
+
| Thinking blocks in a tool-use turn | "Required: within a tool-use turn, pass thinking blocks back", complete and unmodified. Across turns: "You don't need to prune old thinking yourself"; the API filters them and bills input only for the blocks shown to the model. Which earlier blocks are kept is per model | https://platform.claude.com/docs/en/build-with-claude/thinking |
|
|
78
|
+
| Changing an earlier message | On models with preserved thinking, a change to `system`, `tools` or an earlier message makes every thinking block after the change fail a prefix check, and the request can get a 400 error. A dropped thinking block changes the cached prefix from its position onward | same page |
|
|
79
|
+
| Tool result clearing | Context editing (beta, header `context-management-2025-06-27`) has a `clear_tool_uses_20250919` strategy that clears old tool results past a token trigger, keeping the most recent ones. It "invalidates cached prompt prefixes when content is cleared"; `clear_at_least` skips a clearing that would remove too little to be worth the cache write | https://platform.claude.com/docs/en/build-with-claude/context-editing |
|
|
80
|
+
|
|
81
|
+
## Not stated in the docs
|
|
82
|
+
|
|
83
|
+
- Whether a cache entry can be evicted before its lifetime ends: not stated in the docs (checked 2026-11-26). Only the first 100,000 characters of the page were read; the rest was not.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
provider: deepinfra
|
|
3
|
+
checked: 2026-11-26
|
|
4
|
+
source: https://docs.deepinfra.com/chat/prompt-caching.md
|
|
5
|
+
cache:
|
|
6
|
+
mode: automatic
|
|
7
|
+
min_tokens: 0
|
|
8
|
+
step_tokens: 64
|
|
9
|
+
ttl_seconds: 300
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# DeepInfra
|
|
13
|
+
|
|
14
|
+
Status: documented, and the 64-token step measured in E2 (DeepSeek-class model; 96% or 95% token agreement with kvsig ids; reported cached tokens in multiples of 64). E3: after one deferred tool was appended to the tool list, DeepInfra cached 10,176 of 21,149 tokens.
|
|
15
|
+
|
|
16
|
+
## Facts
|
|
17
|
+
|
|
18
|
+
| Fact | Value | Basis |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| Mode | automatic, no parameters; keep the prefix identical and stable content first | docs |
|
|
21
|
+
| Render order (system vs tools) | Observed 2026-11-21 in the replay test (E3 source): when only the tool list changed, the system-prompt part stayed cached, consistent with system rendered before tools. After one deferred tool was appended, 10,176 of 21,149 tokens were still cached (E3). DeepInfra's docs do not state the order (checked 2026-11-26) | observed (E3) |
|
|
22
|
+
| Models | "supported models, check the model page"; the docs do not list them | docs |
|
|
23
|
+
| Step | 64 tokens | E2 (not stated in the docs, checked 2026-11-26) |
|
|
24
|
+
| Minimum | none observed in E2 (`min_tokens: 0`); not stated in the docs (checked 2026-11-26) | E2 |
|
|
25
|
+
| `prompt_cache_key` | optional string, shares a cache across requests with slightly different prompts; pass through `extra_body` in the Python SDK | docs |
|
|
26
|
+
| Usage field | `usage.prompt_tokens_details.cached_tokens` | docs |
|
|
27
|
+
| Price | cached input "billed at a reduced rate"; no multiplier stated | docs |
|
|
28
|
+
|
|
29
|
+
## Lifetime
|
|
30
|
+
|
|
31
|
+
- Default entries "expire after a period of inactivity"; no duration is stated in the docs (checked 2026-11-26). `ttl_seconds: 300` in the frontmatter is the shortest documented retention option, used as a conservative planning floor. It is not a stated default.
|
|
32
|
+
- Optional retention (https://docs.deepinfra.com/chat/prompt-cache-retention.md): `prompt_cache_options.mode: "explicit"`, `ttl` of `"5m"` or `"1h"`, `prompt_cache_breakpoint: {"mode": "explicit"}` on a content part, and a required `prompt_cache_key`. Writes cost 1.25x (5 minutes) or 2.0x (1 hour); reads are at the model's cache-read rate (0.2x for Nemotron-3-Ultra). Documented for `nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B` and `moonshotai/Kimi-K2.7-Code` only. Default values are not stated; granularity 8,192 tokens is stated for Nemotron-3-Ultra only. Not measured here.
|
|
33
|
+
|
|
34
|
+
## Generation features (docs, checked 2026-11-26)
|
|
35
|
+
|
|
36
|
+
Used by the `generation-economy` rules.
|
|
37
|
+
|
|
38
|
+
| Fact | Value | Source |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `n` (several samples per request) | OpenAI-compatible chat completions: `n` from 1 to 4, default 1 ("number of sequences to return") | https://docs.deepinfra.com/api-reference/chat-completions/openai-chat-completions.md |
|
|
41
|
+
| Output limit | `max_tokens` | same page |
|
|
42
|
+
| Service tiers | `service_tier`: `default`, `priority`, `flex` (`auto` treated as `priority`, `standard_only` as `default`). Prices: not on that page | same page |
|
|
43
|
+
| Predicted outputs | `prediction` not listed | same page |
|
|
44
|
+
| Batch API | "billed at 20% less than the corresponding real-time price"; within 24 hours; `/v1/chat/completions`, `/v1/completions`, `/v1/embeddings` (`/v1/responses` rejected); 50,000 requests and 200 MB per file; one model per file; does not count against real-time rate limits | https://docs.deepinfra.com/batch/introduction.md |
|
|
45
|
+
| Structured outputs | `response_format` `json_object` (valid JSON, shape not controlled) or `json_schema` with `strict` ("The model is constrained to produce only values that match your schema"); on "many of our models". The page warns that a `max_tokens` or `length` stop can leave the JSON incomplete | https://docs.deepinfra.com/chat/structured-outputs.md |
|
|
46
|
+
| Client disconnect | Not stated in DeepInfra's docs read. OpenRouter lists DeepInfra among providers whose streams stop on abort (`providers/openrouter.md`) | OpenRouter streaming docs |
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
provider: gemini
|
|
3
|
+
checked: 2026-11-26
|
|
4
|
+
source: https://aistudio.google.com/docs/caching
|
|
5
|
+
cache:
|
|
6
|
+
mode: automatic
|
|
7
|
+
min_tokens: 4096
|
|
8
|
+
ttl_seconds: 180
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Google Gemini
|
|
12
|
+
|
|
13
|
+
Status: documented, not yet measured here.
|
|
14
|
+
|
|
15
|
+
`min_tokens: 4096` is the conservative default (the largest implicit-caching minimum listed). `ttl_seconds: 180` is the shortest figure (lower bound of "about 3-5 minutes, varies") from OpenRouter's description of implicit caching, chosen on purpose as the conservative cap; it is not a default stated by Google, whose caching page does not state an implicit TTL (see below).
|
|
16
|
+
|
|
17
|
+
## Implicit caching (docs, checked 2026-11-26)
|
|
18
|
+
|
|
19
|
+
| Model | Minimum input tokens |
|
|
20
|
+
|---|---|
|
|
21
|
+
| Gemini 4 Carbon, Argon, Neon, Hydrogen | 4,096 |
|
|
22
|
+
| Gemini 3.8 Flash, 3.6 Flash, 3.1 Pro Preview | 4,096 |
|
|
23
|
+
| Gemini 2.5 Flash, 2.5 Pro | 2,048 |
|
|
24
|
+
|
|
25
|
+
- Hit field: `usage.total_cached_tokens` in the page's SDK examples.
|
|
26
|
+
- Multi-turn and agent loops on Gemini 4: "Gemini caches the full previous request only if the new request adds at least 2,050 tokens". Model output, thought and function results count toward that total. For smaller additions, the last 2,050 tokens of the previous request are re-processed at the standard input rate.
|
|
27
|
+
- Pricing: the page says savings are passed on automatically and gives no rate. OpenRouter's notes give 0.25x for reads and no write or storage charge on implicit caching, 2.5 series and newer.
|
|
28
|
+
- Explicit caching is unsupported in the Interactions API and for Gemini 4 models; on supported Gemini 3 and 2.5 models it is available through `generateContent`.
|
|
29
|
+
|
|
30
|
+
## Generation features (docs, checked 2026-11-26)
|
|
31
|
+
|
|
32
|
+
Used by the `generation-economy` rules.
|
|
33
|
+
|
|
34
|
+
| Fact | Value | Source |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| `candidateCount` (several samples per request) | "Number of generated responses to return. If unset, this will default to 1"; not for Gemini 1.0 models. No upper limit stated | https://aistudio.google.com/api-reference/generate-content (first 100,000 of 103,138 characters read) |
|
|
37
|
+
| Output limit | `maxOutputTokens`; default varies by model (`Model.output_token_limit`) | same page |
|
|
38
|
+
| Thinking controls | `thinkingConfig.thinkingBudget` ("The number of thoughts tokens that the model should generate") and `thinkingLevel` (an error on earlier models) | same page |
|
|
39
|
+
| Truncation signal | `finishReason: "MAX_TOKENS"` | same page |
|
|
40
|
+
| Usage fields | `usageMetadata.candidatesTokenCount` (all candidates), `thoughtsTokenCount` | same page |
|
|
41
|
+
| Batch API | "priced at 50% of the standard interactive API cost"; target turnaround 24 hours; inline requests under 20 MB, input file up to 2 GB; "Context caching is supported for batch requests" | https://aistudio.google.com/docs/batch-api |
|
|
42
|
+
| Service tiers | The response carries `usageMetadata.serviceTier` (`standard`, `flex`, `priority`). How to request a tier and its price: not on the page read | generateContent reference; not stated (checked 2026-11-26) |
|
|
43
|
+
| Predicted outputs | No predicted-output parameter on the generateContent reference read | not stated (checked 2026-11-26) |
|
|
44
|
+
| Structured output | `response_format` with a JSON `schema` and `mime_type: application/json` (Interactions API examples); `responseMimeType` / `responseJsonSchema` on generateContent. Output is syntactically valid JSON, but "always validate values in your application"; some constraints (`minLength`, `maxLength`, ...) are stripped, not enforced; a too complex schema returns 400 | https://aistudio.google.com/docs/structured-output |
|
|
45
|
+
| Client disconnect | Not stated on the pages above. OpenRouter lists Google and Google AI Studio among providers that keep generating (and billing) after a stream is aborted (`providers/openrouter.md`) | OpenRouter streaming docs |
|
|
46
|
+
|
|
47
|
+
## Prompt size facts (docs, checked 2026-11-26)
|
|
48
|
+
|
|
49
|
+
Used by the `prompt-diet` rules.
|
|
50
|
+
|
|
51
|
+
| Fact | Value | Source |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| Function declarations are input | "Every function declaration you send is billed as input tokens on every request"; past a few dozen tools the page suggests retrieving tools instead of sending all of them. It also describes an `allowed_tools` list in `tool_choice`; whether that keeps the implicit cache is not stated | https://aistudio.google.com/docs/function-calling (first 100,000 of 135,989 characters read) |
|
|
54
|
+
|
|
55
|
+
## Not stated in the docs
|
|
56
|
+
|
|
57
|
+
- Implicit-caching TTL: not stated in the docs (checked 2026-11-26). The 3-5 minute figure comes from OpenRouter's notes.
|
|
58
|
+
- Explicit-caching minimum token count: not stated in the docs (checked 2026-11-26).
|
|
59
|
+
- Step or granularity of implicit reuse other than the 2,050-token rule above: not stated in the docs (checked 2026-11-26).
|
|
60
|
+
- Through OpenRouter only the last `cache_control` breakpoint is used on Gemini (OpenRouter docs); see `providers/openrouter.md`.
|
|
61
|
+
- kvsig cannot identify Gemini's native request dialect, so these requests are reported as unmeasured by the CLI.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
provider: openai
|
|
3
|
+
checked: 2026-11-26
|
|
4
|
+
source: https://developers.openai.com/api/docs/guides/prompt-caching
|
|
5
|
+
cache:
|
|
6
|
+
mode: automatic
|
|
7
|
+
min_tokens: 1024
|
|
8
|
+
step_tokens: 128
|
|
9
|
+
ttl_seconds: 300
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# OpenAI
|
|
13
|
+
|
|
14
|
+
Status: documented, and the 1,024 minimum and 128-token steps measured in E2 (95% and 96% token agreement between kvsig prefix ids and reported `cached_tokens`).
|
|
15
|
+
|
|
16
|
+
`ttl_seconds: 300` is the shortest documented lifetime (the 5-minute lower bound of the `in_memory` range for earlier models), chosen on purpose as the conservative cap. It is not the default. Defaults: earlier models, organizations without Zero Data Retention (ZDR) default to `24h` retention and ZDR organizations to `in_memory`; GPT-5.6 and later default to a 30-minute minimum lifetime (1,800 seconds).
|
|
17
|
+
|
|
18
|
+
## Automatic caching
|
|
19
|
+
|
|
20
|
+
| Fact | Value | Basis |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| Minimum | 1,024 visible input tokens (hidden system tokens do not count). The docs state this for GPT-5.6 and later; for earlier models they say the minimum "varies by request settings" (tools, images, output schemas, reasoning effort, verbosity). OpenRouter's docs also say 1,024. | docs; measured E2 |
|
|
23
|
+
| Granularity | Reported `cached_tokens` are 1,024 plus multiples of 128 | E2; docs say rounded down to a multiple of 128 for earlier models |
|
|
24
|
+
| Implicit breakpoints | GPT-5.6 and later: end of the latest eligible message. GPT-5.5 and 5.5 Pro: every 2,048 tokens. Other earlier models: regular, model-dependent intervals | docs |
|
|
25
|
+
| Lifetime, earlier models (`prompt_cache_retention`) | `in_memory`: typically around 5 to 10 minutes of inactivity, up to one hour. `24h`: typically around 30 minutes, retained up to 24 hours. Default: organizations without ZDR default to `24h`; organizations with ZDR default to `in_memory`. The frontmatter uses 300 s, the shortest figure (lower bound of the `in_memory` range), not the default | docs |
|
|
26
|
+
| Lifetime, GPT-5.6 and later | `prompt_cache_options.ttl` of `"30m"` (default, minimum 30 minutes; omitting the setting keeps it) or `"12h"` (minimum 12 hours) | docs |
|
|
27
|
+
| Routing key | `prompt_cache_key`. Before GPT-5.6, use a stable key per related group; the docs suggest about 15 requests per minute per key and prefix group. From GPT-5.6 routing is automatic and the key is optional (separate cache accounting). Keys influence routing; they do not guarantee a hit | docs |
|
|
28
|
+
| Render order (system vs tools) | Observed 2026-11-21 in the replay test (internal report, not public): when only the tool list changed, the system-prompt part stayed cached, consistent with system rendered before tools. Not stated in OpenAI's docs (checked 2026-11-26) | observed 2026-11-21 (internal report) |
|
|
29
|
+
| What must match | The entire rendered prefix up to a breakpoint, including relevant request settings | docs |
|
|
30
|
+
| Usage fields | `usage.input_tokens_details.cached_tokens` (Responses); `prompt_tokens_details.cached_tokens` (Chat Completions, as seen through OpenRouter) | docs; OpenRouter docs |
|
|
31
|
+
|
|
32
|
+
## Explicit breakpoints (GPT-5.6 and later only)
|
|
33
|
+
|
|
34
|
+
- Set `prompt_cache_options.mode` to `"explicit"` and add `prompt_cache_breakpoint: {"mode": "explicit"}` to a content block of an input message. Up to four cache writes per request. Top-level `instructions` cannot carry a breakpoint.
|
|
35
|
+
- Writes cost 1.25x input with the 30-minute TTL and 2.5x with the 12-hour TTL; before GPT-5.6 writes are free; reads are 0.25x or 0.50x input depending on the model. (OpenRouter's per-provider notes, checked 2026-11-26; the OpenAI page read for this table does not state prices.)
|
|
36
|
+
|
|
37
|
+
## Tool limits observed here
|
|
38
|
+
|
|
39
|
+
- `tool_choice: "none"` drops the tool definitions from the rendered prompt (observed 2026-11-21 via OpenRouter: `prompt_tokens` halved). A change of `tool_choice` between turns therefore changes the prefix.
|
|
40
|
+
- At most 128 tools per request; a request with 232 tools was rejected (observed 2026-11-21 via OpenRouter).
|
|
41
|
+
|
|
42
|
+
## Generation features (docs, checked 2026-11-26)
|
|
43
|
+
|
|
44
|
+
Used by the `generation-economy` rules. Prices are relative; the price card is on OpenAI's pricing page.
|
|
45
|
+
|
|
46
|
+
| Fact | Value | Source |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| `n` (several samples per request) | Chat Completions: "How many chat completion choices to generate for each input message"; "Newer models reject an explicit `n`, even `n=1`"; generated tokens are billed across all choices. Responses API: no `n` in the body parameters | https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create, https://developers.openai.com/api/reference/resources/responses/methods/create |
|
|
49
|
+
| Output limit | Chat Completions `max_completion_tokens` (`max_tokens` is deprecated); Responses `max_output_tokens`. Both include reasoning tokens | same pages |
|
|
50
|
+
| Truncation signal | Chat Completions `finish_reason: "length"`; Responses `status: "incomplete"` with `incomplete_details.reason: "max_output_tokens"` | same pages |
|
|
51
|
+
| Usage fields | `usage.completion_tokens` (Chat Completions), `usage.output_tokens` (Responses); with streaming, `stream_options.include_usage` adds a final usage chunk | same pages |
|
|
52
|
+
| Batch API | 50% discount compared to synchronous APIs; completion window `24h` only; up to 50,000 requests and 200 MB per input file; `/v1/responses` and `/v1/chat/completions` among the endpoints. The page does not mention prompt caching inside a batch | https://developers.openai.com/api/docs/guides/batch |
|
|
53
|
+
| Flex processing | `service_tier: "flex"`: slower, occasionally unavailable, "Tokens are priced at Batch API rates". Unavailable on GPT-6.2 Astra and GPT-6.2 Sol and not added to future models. Out of capacity returns `429 Resource Unavailable`, not charged | https://developers.openai.com/api/docs/guides/flex-processing |
|
|
54
|
+
| Service tiers | `service_tier`: `auto`, `default`, `flex`, `scale`, `priority`, `fast` | Chat Completions reference |
|
|
55
|
+
| Predicted outputs | Chat Completions `prediction: {type: "content", content: ...}`, on `gpt-4o`, `gpt-4o-mini`, `gpt-4.1`, `gpt-4.1-mini`, `gpt-4.1-nano`. Rejected prediction tokens are billed as completion tokens (`rejected_prediction_tokens` in `usage`). Not supported with `n` > 1, `logprobs`, tools, `audio`, `max_completion_tokens`, and presence or frequency penalties above 0. The page does not mention the Responses API or reasoning models | https://developers.openai.com/api/docs/guides/predicted-outputs |
|
|
56
|
+
| Structured outputs | Responses `text.format: {type: "json_schema", strict: true, schema}`; Chat Completions `response_format` with `json_schema`. "Only Structured Outputs ensure schema adherence" (JSON mode only ensures valid JSON). Refusals come back in a `refusal` field. The first request with a new schema has extra latency | https://developers.openai.com/api/docs/guides/structured-outputs (first 100,000 of 152,792 characters read) |
|
|
57
|
+
| SDK timeout and retries | Python SDK: default timeout 10 minutes; connection errors, 408, 409, 429 and 5xx retried 2 times with short exponential backoff; timed-out requests are retried twice by default | https://github.com/openai/openai-python/blob/main/README.md |
|
|
58
|
+
| Errors | 401 invalid authentication and 403 unsupported region: fix, not retry. 500: retry after a brief wait. 429 rate limit and 503 overloaded: retry, following `Retry-After`. 429 for exhausted credit, spend or usage limits: do not retry | https://developers.openai.com/api/docs/guides/error-codes |
|
|
59
|
+
| Client disconnect | Whether closing the connection stops generation and billing on a direct OpenAI call: not stated on the pages above. Through OpenRouter, OpenAI is listed among providers whose streams stop on abort (`providers/openrouter.md`) | not stated (checked 2026-11-26) |
|
|
60
|
+
|
|
61
|
+
## Prompt size facts (docs, checked 2026-11-26)
|
|
62
|
+
|
|
63
|
+
Used by the `prompt-diet` rules.
|
|
64
|
+
|
|
65
|
+
| Fact | Value | Source |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| Function definitions are input | "callable function definitions count against the model's context limit and are billed as input tokens"; the guide advises keeping the number of functions available at the start of a turn small, and deferring rarely used ones with tool search | https://developers.openai.com/api/docs/guides/function-calling |
|
|
68
|
+
| A subset of tools per call, cache kept | `tool_choice: {"type": "allowed_tools", "mode": "auto", "tools": [...]}` limits which of the supplied tools the model may call "but not modify the list of tools you pass in, so you can maximize savings from prompt caching" | same page |
|
|
69
|
+
| Tool definitions are in the cached prefix | The cacheable prefix "can include OpenAI-provided instructions, developer messages, tool definitions"; changing tool names, descriptions, schemas or order breaks reuse. The page advises `allowed_tools`, or `tool_choice: "none"`, instead of removing tool definitions. Observed here (above): `"none"` dropped the definitions from `prompt_tokens` through OpenRouter, so prefer `allowed_tools` and verify | https://developers.openai.com/api/docs/guides/prompt-caching |
|
|
70
|
+
|
|
71
|
+
## Not stated in the docs
|
|
72
|
+
|
|
73
|
+
- Cached-token price multiplier for the current model list: not stated on the caching page (checked 2026-11-26).
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
provider: openrouter
|
|
3
|
+
checked: 2026-11-26
|
|
4
|
+
source: https://openrouter.ai/docs/features/prompt-caching
|
|
5
|
+
cache:
|
|
6
|
+
mode: automatic
|
|
7
|
+
min_tokens: 1024
|
|
8
|
+
ttl_seconds: 300
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# OpenRouter (a router, not a cache)
|
|
12
|
+
|
|
13
|
+
Status: documented. Marker behaviour through OpenRouter measured in E1 (0 tokens cached on 29 turns of sessions that send no `cache_control`, on an Anthropic model; the Claude Code sessions that set 3 breakpoints matched kvsig at 100% and 97%). The DESIGN addition of 2026-11-22 records the same test as 0% cached without marks vs 92% with them.
|
|
14
|
+
|
|
15
|
+
OpenRouter holds no cache of its own. The frontmatter `cache:` block is a conservative floor for planning (the lowest automatic-cache minimum and the shortest lifetime among the providers it routes to, chosen on purpose; it is not a default); the real values are those of the routed provider in `providers/<name>.md`. Anthropic models need markers whatever the route.
|
|
16
|
+
|
|
17
|
+
## Pinning and routing
|
|
18
|
+
|
|
19
|
+
- Default load balancing: "Providers close to the best share most of the traffic, and each request picks one at random, weighted by those shares" (provider routing docs, https://openrouter.ai/docs/features/provider-routing). The docs say follow-up requests in a conversation stay with the same provider while its prompt cache is warm.
|
|
20
|
+
- Pin with `provider.order` (a list of provider slugs tried in order) and `provider.only` (allow list). `allow_fallbacks` defaults to `true`; set it to `false` to stop backup providers taking a request. Without `order`, a disabled fallback means the top-ranked provider serves the request.
|
|
21
|
+
- Sticky routing (prompt-caching docs): expires after 60 minutes of inactivity, each success resets the timer. It applies only when the provider's cache read price is below its regular prompt price, and it is skipped when `provider.order` is set. Without `session_id` requests are grouped by hashing the first system or developer message and the first non-system message. `session_id` (body or `x-session-id` header, max 256 characters) starts stickiness on any success; without it stickiness starts only after a cache hit.
|
|
22
|
+
|
|
23
|
+
## Marker pass-through (docs, checked 2026-11-26)
|
|
24
|
+
|
|
25
|
+
- A `cache_control` marker on a text block becomes `prompt_cache_breakpoint` when routed to a supporting OpenAI model.
|
|
26
|
+
- A `prompt_cache_breakpoint` becomes a default 5-minute `cache_control` on Anthropic or Google.
|
|
27
|
+
- TTLs are not translated: a `cache_control` TTL is dropped for OpenAI, a `prompt_cache_breakpoint` TTL is dropped for Anthropic or Google.
|
|
28
|
+
- Gemini: multiple breakpoints are accepted, only the last is used.
|
|
29
|
+
- Qwen via Alibaba: explicit only, `cache_control: {"type": "ephemeral"}`, 5-minute TTL; snapshot endpoints do not support it.
|
|
30
|
+
|
|
31
|
+
## Usage accounting
|
|
32
|
+
|
|
33
|
+
- `prompt_tokens_details.cached_tokens` (read) and `cache_write_tokens` (written), plus `cache_discount`. The same data is on the Activity page and in `/api/v1/generation`.
|
|
34
|
+
- A cancelled stream usually gets no cache discount because the provider's final usage never arrives.
|
|
35
|
+
|
|
36
|
+
## Per-provider notes as OpenRouter states them
|
|
37
|
+
|
|
38
|
+
Re-read on the prompt-caching page on 2026-11-26; every cell below is stated there unless marked otherwise.
|
|
39
|
+
|
|
40
|
+
| Provider | Caching | Read price | Note |
|
|
41
|
+
|---|---|---|---|
|
|
42
|
+
| OpenAI | automatic, minimum 1,024 tokens | 0.25x or 0.50x | writes free before GPT-5.6 |
|
|
43
|
+
| Anthropic | markers, 5 min or 1 hour | 0.1x | 4 breakpoints; per-model minimums in `providers/anthropic.md` |
|
|
44
|
+
| Gemini | implicit, 2.5 series and newer | 0.25x | implicit TTL about 3-5 minutes; minimums 1,024 (2.5 Flash) and 4,096 (2.5 Pro) as OpenRouter states them, which differs from Google's own page (2,048 for both); `providers/gemini.md` follows Google's page |
|
|
45
|
+
| DeepSeek, Grok, Moonshot | automatic | 0.1x, 0.25x, 0.25x | writes free except DeepSeek (input price) |
|
|
46
|
+
| Groq | automatic, Kimi K2 models only | 0.5x | |
|
|
47
|
+
| Z.AI | automatic | about 0.2x | pass `session_id` to keep sessions on one cache (OpenRouter derives a session affinity key from it); cached input storage listed as limited-time free |
|
|
48
|
+
|
|
49
|
+
## Generation features (docs, checked 2026-11-26)
|
|
50
|
+
|
|
51
|
+
Used by the `generation-economy` rules. What a routed request supports depends on the upstream provider; the model page lists its supported parameters.
|
|
52
|
+
|
|
53
|
+
| Fact | Value | Source |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `n` (several samples per request) | Not listed on the parameters page | https://openrouter.ai/docs/api/reference/parameters |
|
|
56
|
+
| Output limit | `max_tokens`; "For reasoning models, this limit covers reasoning tokens and visible output together on most providers" | same page |
|
|
57
|
+
| Structured outputs | `response_format` with `json_schema` on models with the `structured_outputs` capability | same page |
|
|
58
|
+
| Predicted outputs | `prediction` not listed on the parameters page | same page |
|
|
59
|
+
| Batch API | `POST /api/v1/batches`, "Typically 50% of the sync per-token price" (each model page has its batch price); within 24 hours on most providers, Google Vertex up to 96 hours; up to 200 MB per batch, inline JSON; one model and one endpoint per batch; text and embeddings only; only models with a batch variant | https://openrouter.ai/docs/guides/features/batch-api |
|
|
60
|
+
| Stream cancellation | "Streaming requests can be cancelled by aborting the connection. For supported providers, this immediately stops model processing and billing." "For non-streaming requests or unsupported providers, the model will continue processing and you will be billed for the complete response." Supported include OpenAI, Azure, Anthropic, DeepInfra, DeepSeek, Together, Fireworks, xAI; not supported include AWS Bedrock, Groq, Google, Google AI Studio, Mistral, Alibaba | https://openrouter.ai/docs/api/reference/streaming |
|
|
61
|
+
| Usage fields | `usage.completion_tokens`, `finish_reason` (OpenAI-shaped responses) | parameters and API reference pages |
|
|
62
|
+
|
|
63
|
+
## Not stated in the docs
|
|
64
|
+
|
|
65
|
+
- Cache TTL on the OpenRouter side: not applicable; only the 60-minute sticky-routing timer is stated (checked 2026-11-26).
|
|
66
|
+
- The provider routing page was read to character 100,000 of 132,066; the rest was not read.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
provider: sglang
|
|
3
|
+
checked: 2026-11-26
|
|
4
|
+
source: https://docs.sglang.io/advanced_features/hicache_design.html
|
|
5
|
+
cache:
|
|
6
|
+
mode: block
|
|
7
|
+
min_tokens: 0
|
|
8
|
+
block_tokens: 1
|
|
9
|
+
ttl_seconds: 0
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# SGLang (self-hosted)
|
|
13
|
+
|
|
14
|
+
Status: documented, not yet measured here.
|
|
15
|
+
|
|
16
|
+
`ttl_seconds: 0` means no lifetime: eviction only. `block_tokens: 1` is a placeholder for exact-token matching; it applies when `page_size` is 1. The default `page_size` is not stated in the docs (checked 2026-11-26), so read it from your server arguments.
|
|
17
|
+
|
|
18
|
+
## Facts (docs, checked 2026-11-26)
|
|
19
|
+
|
|
20
|
+
| Fact | Value |
|
|
21
|
+
|---|---|
|
|
22
|
+
| Mechanism | RadixAttention: "leverages idle GPU memory to cache and reuse prefix KV caches"; each radix tree node holds the KV cache of a consecutive span of tokens |
|
|
23
|
+
| Granularity | `page_size` is "the number of tokens per page" and "determines the granularity of KV cache storage and retrieval". When `page_size > 1`, matching is done at page granularity. A match that ends inside a node splits the node, giving an exact boundary |
|
|
24
|
+
| Hierarchical cache (HiCache) | Write-back to a lower tier happens when an entry is evicted from the upper tier. The `HiCacheFastFile` backend does background LRU eviction |
|
|
25
|
+
|
|
26
|
+
## Generation features (docs, checked 2026-11-26)
|
|
27
|
+
|
|
28
|
+
Used by the `generation-economy` rules.
|
|
29
|
+
|
|
30
|
+
| Fact | Value | Source |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `n` (several samples per request) | Accepted on chat completions and completions, "Integer from 1 to 128". Whether the samples share one prefill is not stated; it follows from the radix cache, untested here | https://docs.sglang.io/basic_usage/openai_api_completions.html |
|
|
33
|
+
| Structured outputs | `response_format` `json_schema`, or `regex` / `ebnf` through `extra_body`, one constraint per request; backends XGrammar (default), Outlines, Llguidance. "The model output will be guaranteed to follow the given constraints" | https://docs.sglang.io/advanced_features/structured_outputs.html |
|
|
34
|
+
| Predicted outputs, batch API, client disconnect | Not on the pages read | not stated (checked 2026-11-26) |
|
|
35
|
+
|
|
36
|
+
## Not stated in the docs
|
|
37
|
+
|
|
38
|
+
- Default `page_size`: not stated in the docs (checked 2026-11-26).
|
|
39
|
+
- Eviction policy of the radix tree and of HiCache's memory tiers: not stated in the docs (checked 2026-11-26).
|
|
40
|
+
- Flag to disable the radix cache: not stated on the pages read (checked 2026-11-26).
|
|
41
|
+
- Treatment of hybrid or Mamba models: not read.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
provider: vllm
|
|
3
|
+
checked: 2026-11-26
|
|
4
|
+
source: https://docs.vllm.ai/en/latest/features/automatic_prefix_caching.html
|
|
5
|
+
cache:
|
|
6
|
+
mode: block
|
|
7
|
+
min_tokens: 0
|
|
8
|
+
block_tokens: 1584
|
|
9
|
+
drops_last_block: true
|
|
10
|
+
ttl_seconds: 0
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# vLLM (self-hosted)
|
|
14
|
+
|
|
15
|
+
Status: measured in E9 (one 4B hybrid model on one 16 GB card, TP1, thinking off) and E5 (a self-hosted vLLM reused only the 7,920 tokens before a changing working-directory line). Everything else below is documented, not yet measured here.
|
|
16
|
+
|
|
17
|
+
`ttl_seconds: 0` means no lifetime: entries are evicted under memory pressure only. The docs do not describe an eviction policy (checked 2026-11-26).
|
|
18
|
+
|
|
19
|
+
`block_tokens: 1584` and `drops_last_block: true` are the values from E9's production setup (hybrid model, MTP speculative decoding on). Read the real block size from your engine's startup log, or from LM Warden's `engine_block_tokens`; a non-hybrid model usually has a smaller block. The default block size is not stated in the docs (checked 2026-11-26).
|
|
20
|
+
|
|
21
|
+
## Facts
|
|
22
|
+
|
|
23
|
+
| Fact | Value | Basis |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| Block size, hybrid model | 1,584 tokens in one production setup | E9 |
|
|
26
|
+
| Last block with MTP speculative decoding | one more block is dropped when MTP is on (short prompts reused 44% on an append-only workload) | E9 |
|
|
27
|
+
| `--prefix-match-unit` | sets the granularity at which prefix-cache keys are computed; unset, it defaults to the greatest common divisor of the prefix-cacheable KV cache group block sizes (the block size on hybrid Mamba models); the docs suggest 64 as a starting point | docs |
|
|
28
|
+
| Effect of `--prefix-match-unit 16` | short-prompt reuse 44% to 76% (ideal 78%), no change in decode speed; vLLM 0.32 | E9 |
|
|
29
|
+
| Hashing | each block's hash covers every token before it; a change at one token invalidates that block and all later blocks | docs |
|
|
30
|
+
| Hybrid models | Mamba state is stored only on the Mamba block grid, so a hit can resume only at a block boundary. `--enable-mamba-shared-prefix-checkpoint` is off by default and takes effect only with prefix caching on and `--prefix-match-unit` smaller than the Mamba block size | docs |
|
|
31
|
+
| Enable / disable | `--enable-prefix-caching` / `--no-enable-prefix-caching` | docs |
|
|
32
|
+
| Chat-template effect | Toggling thinking between turns of a Qwen hybrid session lost 47% of what those turns could have reused | E7 |
|
|
33
|
+
|
|
34
|
+
## Generation features (docs, checked 2026-11-26)
|
|
35
|
+
|
|
36
|
+
Used by the `generation-economy` rules.
|
|
37
|
+
|
|
38
|
+
| Fact | Value | Source |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `n` (several samples per request) | `SamplingParams.n`: "Number of outputs to return for the given prompt request"; maximum set by `VLLM_MAX_N_SEQUENCES` (default 16384). The online-serving page does not list `n` among its extra parameters. Whether the samples share one prefill is not stated; it follows from prefix caching, untested here | https://docs.vllm.ai/en/latest/api/vllm/sampling_params/ |
|
|
41
|
+
| Batch | `/v1/chat/completions/batch` accepts up to 1,024 conversations per request by default | https://docs.vllm.ai/en/latest/serving/online_serving/openai_compatible_server/ |
|
|
42
|
+
| Structured outputs | On by default in the OpenAI-compatible server: `response_format` `json_schema`, or `structured_outputs` with `choice`, `regex`, `json`, `grammar`, `structural_tag` (the `guided_*` fields were removed in v0.12.0). Backends xgrammar or guidance, default `auto`. For reasoning models, see the next two rows | https://docs.vllm.ai/en/latest/features/structured_outputs.html |
|
|
43
|
+
| Reasoning parser | `--reasoning-parser <name>` (for example `qwen3` for the Qwen3 series, `deepseek_r1`) extracts the thinking into a separate `reasoning` field (formerly `reasoning_content`); the field is absent for models served without one. Qwen3 reasoning is on by default; `enable_thinking: false` in `chat_template_kwargs` turns it off per request, `--default-chat-template-kwargs '{"enable_thinking": false}'` for every request | https://docs.vllm.ai/en/latest/features/reasoning_outputs.html |
|
|
44
|
+
| Structured outputs with reasoning | With reasoning outside the output grammar, constraints start after the first end-of-reasoning marker; the reasoning parser supplies that marker (its end token). What happens with no reasoning parser is not stated; that the schema then also constrains thinking returned inside `content` follows from this, not measured here. Qwen3 Coder with reasoning: structured outputs may be disabled unless the reasoning is parsed into `reasoning`, or the server runs with `--structured-outputs-config.enable_in_reasoning=True` | https://docs.vllm.ai/en/latest/features/structured_outputs.html, https://docs.vllm.ai/en/latest/features/reasoning_outputs.html |
|
|
45
|
+
| Predicted outputs | `prediction` is not mentioned on the serving page. The nearest engine-side feature is n-gram speculative decoding (`--speculative-config '{"method": "ngram", ...}'`), which the page says gives "modest speedups"; MTP speculative decoding dropped one more cache block on a hybrid model (E9); n-gram speculation is untested here | https://docs.vllm.ai/en/latest/features/speculative_decoding/ |
|
|
46
|
+
| Client disconnect | Not stated on the serving page read | not stated (checked 2026-11-26) |
|
|
47
|
+
|
|
48
|
+
## Not stated in the docs
|
|
49
|
+
|
|
50
|
+
- Default block size and eviction policy: not stated in the docs (checked 2026-11-26).
|
|
51
|
+
- `cache_salt`: not mentioned on the page (checked 2026-11-26).
|
|
52
|
+
- The docs call `--prefix-match-unit` both required and defaulted; the default above is the one the page gives for the unset case.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
runtime: http-clients
|
|
3
|
+
checked: 2026-11-26
|
|
4
|
+
source: https://github.com/nodejs/undici/blob/main/docs/docs/api/Client.md
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# HTTP client default timeouts
|
|
8
|
+
|
|
9
|
+
Status: documented, not yet measured here. Used by LP-GE-04: a call that sets no timeout of its own gets the default of the HTTP client it runs on. Each row gives the client's default, what it covers, and the page it was read from on the `checked:` date.
|
|
10
|
+
|
|
11
|
+
## Defaults
|
|
12
|
+
|
|
13
|
+
| Runtime / client | Default | What it covers | Source |
|
|
14
|
+
|---|---|---|---|
|
|
15
|
+
| Node.js built-in `fetch` (undici) | `headersTimeout` `300e3` milliseconds (five minutes); `bodyTimeout` `300e3` milliseconds; `0` disables either | `headersTimeout`: the wait for the complete response headers. `bodyTimeout`: the time between consecutive body chunks. Node's `fetch` is based on undici and takes a `dispatcher` option; that a global `fetch` with no `dispatcher` uses these undici defaults follows from that, and is not stated on the Node page | https://github.com/nodejs/undici/blob/main/docs/docs/api/Client.md, https://nodejs.org/api/globals.html#fetch |
|
|
16
|
+
| Python `httpx` | A `TimeoutException` after five seconds of network inactivity; `timeout=None` disables it | Connect, read, write and pool are the four timeout kinds; the page does not say which of them the default covers. A non-streaming completion usually sends nothing until the answer is ready, so a default read wait applies to the whole generation | https://www.python-httpx.org/advanced/timeouts/ |
|
|
17
|
+
| Python `requests` | No timeout unless one is set | `timeout=` sets the connect and read timeouts (one value for both, or a tuple); the read timeout is the wait between bytes from the server, not a wall-clock limit | https://requests.readthedocs.io/en/latest/user/advanced/#timeouts |
|
|
18
|
+
| Go `net/http` (`http.Client`, `http.DefaultClient`) | No timeout: a zero `Timeout` means none, and `DefaultClient` (used by `http.Get`, `http.Head`, `http.Post`) is `&Client{}` | `Client.Timeout` covers connection time, redirects and reading the response body | https://pkg.go.dev/net/http#Client |
|
|
19
|
+
|
|
20
|
+
SDKs set their own defaults on top of these: the OpenAI Python SDK's default timeout and retries are in [providers/openai.md](../providers/openai.md).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: LP-PC-00 # stable; never reused. Format LP-<PC|GE|PD|LW>-<nn>
|
|
3
|
+
title: Short imperative title
|
|
4
|
+
skill: prefill-cache # prefill-cache | generation-economy | prompt-diet | lmwarden
|
|
5
|
+
applies_to: [anthropic, openai, gemini, vllm, sglang, any] # providers with a table the rule is about; add `any` when the fix works on every target
|
|
6
|
+
saves: prefill # prefill | generation | both
|
|
7
|
+
severity: high # high | medium | low, by typical tokens lost
|
|
8
|
+
evidence: [E3] # rows of docs/evidence.md, or {doc: <url>, checked: YYYY-MM-DD}
|
|
9
|
+
---
|
|
10
|
+
<!-- applies_to: a rule that depends on a provider feature (a cache mark, a sample-count parameter, a batch API) lists the providers that have it, and applies only to those. A rule whose fix is the same on every target (an output limit, a retry policy, a timeout, parsing, a response cache) also lists `any`, and then applies to every target, including OpenAI-compatible hosts with no provider table. -->
|
|
11
|
+
|
|
12
|
+
## Rule
|
|
13
|
+
One sentence, imperative.
|
|
14
|
+
|
|
15
|
+
## Why
|
|
16
|
+
The mechanism, in 3-6 lines, with the provider's render order.
|
|
17
|
+
|
|
18
|
+
## Detect in code
|
|
19
|
+
Grep patterns and code shapes per language (Python, TS/JS, Go first).
|
|
20
|
+
|
|
21
|
+
## Fix
|
|
22
|
+
A before/after snippet; the smallest change that works.
|
|
23
|
+
|
|
24
|
+
## Don't break meaning
|
|
25
|
+
What the fix must not do (for example: do not move a date away from the text that refers to it).
|
|
26
|
+
|
|
27
|
+
## Verify
|
|
28
|
+
Two ways: (a) the provider's usage field across two requests; (b) kvsig: which id must stay equal (sys, tools, nodes[i]).
|
|
29
|
+
|
|
30
|
+
## Waste signal
|
|
31
|
+
How the audit scores it, and the Prompt Lens cause code if one exists.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generation-economy
|
|
3
|
+
description: Use when writing, reviewing or debugging code that calls an LLM and controls how much it generates or how often it calls — sample loops, per-question calls over one document, max_tokens and thinking or effort settings, timeouts, retries, response caching, bulk or nightly jobs, model choice for small calls, file edits, JSON parsing — for Anthropic, OpenAI, Gemini, OpenRouter, DeepInfra or a self-hosted vLLM or SGLang server, or when usage shows truncated answers (finish_reason length, stop_reason max_tokens), retries, repeated identical calls or parse failures. Stops paying to generate, or to prefill again, what one call could have produced.
|
|
4
|
+
license: CC-BY-4.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# generation-economy
|
|
8
|
+
|
|
9
|
+
Stops paying to generate, or to prefill again, what one call could have produced. Ten rules, `LP-GE-01` to `LP-GE-10`, each in its own file under `rules/`, each with a way to detect it in code, the smallest fix, what the fix must not break, and how to verify it.
|
|
10
|
+
|
|
11
|
+
The `prefill-cache` skill makes each prompt cheaper to read. This skill is about the calls themselves: how many there are, how much each one generates, and how many of them are thrown away (repeated, retried after a truncation or a timeout, or discarded after a parse failure).
|
|
12
|
+
|
|
13
|
+
## When to use
|
|
14
|
+
|
|
15
|
+
- You are writing or changing code that decides how many calls to make (sampling, one call per question, loops over a dataset), what each may generate (output limits, thinking or effort), or what happens when a call fails or is slow (timeouts, retries, parsing).
|
|
16
|
+
- Usage shows truncated answers, retries, identical repeated calls, parse failures, or output tokens far above what the answers need.
|
|
17
|
+
- The `llm-call-audit` skill sends you here for an `LP-GE-*` finding.
|
|
18
|
+
|
|
19
|
+
## Priority-aware advice
|
|
20
|
+
|
|
21
|
+
Read `priority` from `leanprompt.yaml` (`cost`, `speed`, `quality`, or weights). Without it, ask, or treat the priorities as equal. Rank findings for the priority, but never drop a finding that wastes tokens without buying anything (LP-GE-04, LP-GE-05, LP-GE-10 remove pure waste under every priority).
|
|
22
|
+
|
|
23
|
+
- **Cost first:** the batch API for anything that can wait (LP-GE-07), `n` samples instead of repeats (LP-GE-01), exact-response caching (LP-GE-06), batched questions (LP-GE-02), smaller models for small calls (LP-GE-08), cheaper service tiers where the provider offers them, and aggressive prefix caching (the `prefill-cache` skill).
|
|
24
|
+
- **Speed first:** streaming and idle timeouts (LP-GE-04), output and thinking budgets that fit the task, with thinking off or low effort where the answer check allows (LP-GE-03), smaller models for small steps (LP-GE-08), predicted outputs or changes-only edits (LP-GE-09).
|
|
25
|
+
- **Quality first:** keep thinking on, with budgets that never truncate a correct answer (LP-GE-03); larger models for hard steps; batch, route or shorten only where the answer check passes (LP-GE-02, LP-GE-08). Caching applies under every priority, because it never changes answers (LP-GE-06 for identical deterministic requests, and the `prefill-cache` skill).
|
|
26
|
+
|
|
27
|
+
Any change that can alter answers (fewer separate calls, a smaller model, less thinking, shorter outputs, a schema in place of prose) ships with an answer check: a fixed set of synthetic inputs, outputs compared before and after, pass/fail. Caching-only changes are exempt.
|
|
28
|
+
|
|
29
|
+
## Workflow
|
|
30
|
+
|
|
31
|
+
1. **Know the target and priority.** Read `leanprompt.yaml` if the project has one (`target`, `priority`). Otherwise infer the provider and model from the SDK, `base_url` and model names, and ask if it is unclear. Open that provider's table from the list below; each has a "Generation features" section.
|
|
32
|
+
2. **Find the calls.** List every LLM call and, for each, what wraps it: loops and gathers, retry decorators and SDK retry settings, timeouts, parsing, caches, scheduling (interactive, background, nightly), and the model and budget settings.
|
|
33
|
+
3. **Check each rule,** in the order of the index below. Each rule's "Detect in code" gives `rg` patterns and code shapes for Python, TS/JS and Go. Open a rule file when its pattern matches.
|
|
34
|
+
4. **Propose the fix.** Give the rule id, file and line, and the smallest change from the rule's "Fix", with its "Don't break meaning" check. When you are reviewing existing code, propose and ask before editing. When you are writing the call now, apply the rules directly.
|
|
35
|
+
5. **Verify.** Use the rule's "Verify": (a) the provider's usage fields (output tokens, `finish_reason` or `stop_reason`, number of calls), and (b) the leanprompt usage record (`finish: "length"`, `flags.retry_of`, `flags.parse_failed`, repeated ids with equal `params`). The `measure-loop` skill turns these into a before/after run.
|
|
36
|
+
|
|
37
|
+
## Provider facts, in brief
|
|
38
|
+
|
|
39
|
+
What each provider supports, with prices, limits and windows, lives only in the dated tables; read it there, not from memory.
|
|
40
|
+
|
|
41
|
+
- **Anthropic.** No sample count. `max_tokens` includes thinking; truncation is `stop_reason: "max_tokens"`. Message Batches, with prompt caching on a best-effort basis. Structured outputs and strict tools. Streaming advised for long requests; the SDK retries by default. Service tiers are legacy. No predicted outputs. [providers/anthropic.md](../../providers/anthropic.md), [models/anthropic-thinking.md](../../models/anthropic-thinking.md)
|
|
42
|
+
- **OpenAI.** `n` on Chat Completions (newer models reject it; the Responses API has none). Output limits include reasoning; truncation is `finish_reason: "length"` or an `incomplete` response. Batch API and a `flex` tier at batch rates where still offered. Predicted outputs on some Chat Completions models. Structured outputs. The SDK retries timed-out requests by default. [providers/openai.md](../../providers/openai.md), [models/openai-reasoning.md](../../models/openai-reasoning.md)
|
|
43
|
+
- **Gemini.** `candidateCount`; `thinkingBudget` and `thinkingLevel`; truncation is `MAX_TOKENS`. Batch API with context caching. Structured output with values to validate in the app. [providers/gemini.md](../../providers/gemini.md)
|
|
44
|
+
- **OpenRouter.** A router: features depend on the upstream provider. No `n` listed. Batch endpoint for models with a batch variant. Aborting a stream stops billing only on the providers it lists. [providers/openrouter.md](../../providers/openrouter.md)
|
|
45
|
+
- **DeepInfra.** `n` with a small maximum; `service_tier` including `flex`; a batch API with a smaller discount; structured output. [providers/deepinfra.md](../../providers/deepinfra.md)
|
|
46
|
+
- **vLLM and SGLang (self-hosted).** `n`, structured output by constrained decoding; vLLM has a batch endpoint and n-gram speculative decoding set on the server. Savings are throughput and GPU time, not price. [providers/vllm.md](../../providers/vllm.md), [providers/sglang.md](../../providers/sglang.md), [models/qwen.md](../../models/qwen.md)
|
|
47
|
+
|
|
48
|
+
Evidence rows (E1 to E12) are in [docs/evidence.md](../../docs/evidence.md). A rule whose only source is provider documentation says "documented, not yet measured here".
|
|
49
|
+
|
|
50
|
+
## Frontier generation economy
|
|
51
|
+
|
|
52
|
+
On hosted frontier models, generation is priced per token and the levers are mostly request options. Choose them per the project's priority:
|
|
53
|
+
|
|
54
|
+
- **Batch APIs** for non-interactive work: OpenAI, Anthropic, Gemini, OpenRouter and DeepInfra bill batched requests at a discount, with a completion window instead of an immediate answer (LP-GE-07). The discount and window for each are in [providers/openai.md](../../providers/openai.md), [providers/anthropic.md](../../providers/anthropic.md), [providers/gemini.md](../../providers/gemini.md), [providers/openrouter.md](../../providers/openrouter.md) and [providers/deepinfra.md](../../providers/deepinfra.md).
|
|
55
|
+
- **Cheaper service tiers** where offered: OpenAI `flex` at batch rates on models that still have it, and DeepInfra `flex`. Anthropic's tiers are legacy and offer no cheaper interactive tier; Gemini reports a tier in the response, and how to request one is not in its table yet.
|
|
56
|
+
- **Reasoning effort and thinking budgets**: the largest lever on output tokens for reasoning models. Set them per kind of task, hold them fixed per session, and check answers when lowering them (LP-GE-03; [models/openai-reasoning.md](../../models/openai-reasoning.md), [models/anthropic-thinking.md](../../models/anthropic-thinking.md)).
|
|
57
|
+
- **Predicted outputs** for edits that repeat most of a file, where the provider supports them (OpenAI Chat Completions on some models); elsewhere ask for the changes only (LP-GE-09).
|
|
58
|
+
|
|
59
|
+
Prices change: the tables record what each provider documents and when it was checked, and the report shows money separately from the score, with the price card's date.
|
|
60
|
+
|
|
61
|
+
## Rules
|
|
62
|
+
|
|
63
|
+
| Id | Rule | Severity | Evidence |
|
|
64
|
+
|---|---|---|---|
|
|
65
|
+
| [LP-GE-01](rules/LP-GE-01.md) | n samples in one request | medium | E12, provider docs |
|
|
66
|
+
| [LP-GE-02](rules/LP-GE-02.md) | Batch independent questions about one context | medium | provider docs |
|
|
67
|
+
| [LP-GE-03](rules/LP-GE-03.md) | Output and thinking budgets that fit the task | high | E11, provider docs |
|
|
68
|
+
| [LP-GE-04](rules/LP-GE-04.md) | Stream long outputs; timeouts that match generation time | high | provider docs |
|
|
69
|
+
| [LP-GE-05](rules/LP-GE-05.md) | Retry only retryable errors; never retry a truncation unchanged | high | provider docs |
|
|
70
|
+
| [LP-GE-06](rules/LP-GE-06.md) | Cache exact responses for deterministic requests | medium | provider docs |
|
|
71
|
+
| [LP-GE-07](rules/LP-GE-07.md) | Batch API for work that can wait | medium | provider docs |
|
|
72
|
+
| [LP-GE-08](rules/LP-GE-08.md) | Route trivially small calls to a small model | medium | provider docs |
|
|
73
|
+
| [LP-GE-09](rules/LP-GE-09.md) | Predicted outputs for mostly unchanged text | low | provider docs |
|
|
74
|
+
| [LP-GE-10](rules/LP-GE-10.md) | Structured output instead of parse-and-re-ask | high | provider docs |
|
|
75
|
+
|
|
76
|
+
## Reading the usage record
|
|
77
|
+
|
|
78
|
+
The score's generation waste is output tokens spent on calls that were repeated identically, retried after a truncation, or discarded after a parse failure, over all output tokens. In `.leanprompt/usage.jsonl` those are:
|
|
79
|
+
|
|
80
|
+
- **Repeated identically:** two records with equal exact `ids.nodes` for the last message and an equal `params` hash (LP-GE-01, LP-GE-06).
|
|
81
|
+
- **Retried after a truncation:** a record with `finish: "length"`, and a later record whose `flags.retry_of` points at it (LP-GE-03, LP-GE-05).
|
|
82
|
+
- **Discarded after a parse failure:** a record with `flags.parse_failed` (LP-GE-10).
|
|
83
|
+
|
|
84
|
+
Batch discounts (LP-GE-07) and model choice (LP-GE-08) change money, not tokens, so they do not move the score; the report shows them separately.
|
|
85
|
+
|
|
86
|
+
## What this skill does not do
|
|
87
|
+
|
|
88
|
+
It does not make prompts cache better (that is `prefill-cache`), it does not cut dead weight from the prompt (that is `prompt-diet`), it does not tune engine settings or replica routing on a self-hosted server (that is `lmwarden`), and it does not promise a saving for an app it has not measured.
|