@inbrace-tech/tokenline 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +3 -1
- package/tokenline.sh +12 -9
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ LLMs are stateless — by default, they must reread your entire codebase context
|
|
|
67
67
|
|
|
68
68
|
**Prompt Caching** solves this by saving that processed state in the provider's memory:
|
|
69
69
|
- **Cache Write (Cold):** The model reads everything and stores the state. This costs slightly more than base tokens.
|
|
70
|
-
- **Cache Hit (Warm):** If your prompt prefix matches the cached state exactly, the model skips the reading phase. This is **~90% cheaper** (**97.5%** on Claude Fable 5.1 / Mythos 5.1, which bill cache hits at 0.025x base input) and starts responding almost instantly. `tokenline` picks the right multiplier from the active model.
|
|
70
|
+
- **Cache Hit (Warm):** If your prompt prefix matches the cached state exactly, the model skips the reading phase. This is **~90% cheaper** (**97.5%** on Claude Fable 5.1 / Mythos 5.1, which bill cache hits at 0.025x base input, and **95%** on Claude Opus 5.5 at 0.05x) and starts responding almost instantly. `tokenline` picks the right multiplier from the active model.
|
|
71
71
|
- **TTL (Time-To-Live):** The cache operates as a **sliding window**. Every cache hit resets the countdown to its full duration for free. The secret to minimizing rate-limit drain is adjusting your workflow pace to keep the cache continuously **HOT**.
|
|
72
72
|
|
|
73
73
|
### 💡 Pro-tip: Forcing a 5m TTL to save rate limits
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inbrace-tech/tokenline",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "A cache-aware statusline for AI coding CLIs — installs tokenline.sh and wires it into your Claude Code settings.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tokenline": "dist/cli.js"
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@changesets/changelog-github": "1.0.1",
|
|
40
41
|
"@changesets/cli": "^3.0.2",
|
|
41
42
|
"@eslint/js": "10.0.1",
|
|
42
43
|
"@types/node": "24.13.4",
|
|
@@ -63,6 +64,7 @@
|
|
|
63
64
|
"audit:lockfile": "node --experimental-strip-types scripts/check-lockfile-release-age.mts",
|
|
64
65
|
"test:watch": "vitest",
|
|
65
66
|
"changeset": "changeset",
|
|
67
|
+
"changeset:check": "node --experimental-strip-types scripts/check-changeset-size.mts",
|
|
66
68
|
"release": "pnpm build && changeset publish"
|
|
67
69
|
}
|
|
68
70
|
}
|
package/tokenline.sh
CHANGED
|
@@ -156,13 +156,17 @@ parse_and_prepare_paths() {
|
|
|
156
156
|
is_gemini=true
|
|
157
157
|
fi
|
|
158
158
|
|
|
159
|
-
# Claude Fable 5.1
|
|
160
|
-
#
|
|
161
|
-
# (Fable 5.1) so either field alone is enough.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
159
|
+
# Cache hits bill at 0.1x base input, except Claude Fable 5.1 / Mythos 5.1 (0.025x)
|
|
160
|
+
# and Claude Opus 5.5 (0.05x). Match the API id (claude-fable-5-1[1m]) or the
|
|
161
|
+
# display name (Fable 5.1) so either field alone is enough. Pin the full version:
|
|
162
|
+
# claude-opus-5 must stay 0.1x, and a later version's price is confirmed, not guessed.
|
|
163
|
+
claude_read_mult="0.1"
|
|
164
|
+
local fable_re='(fable|mythos)[- ]5[-.]1([^0-9]|$)'
|
|
165
|
+
local opus_re='opus[- ]5[-.]5([^0-9]|$)'
|
|
166
|
+
if [[ "${model_id,,}" =~ $fable_re ]] || [[ "${model,,}" =~ $fable_re ]]; then
|
|
167
|
+
claude_read_mult="0.025"
|
|
168
|
+
elif [[ "${model_id,,}" =~ $opus_re ]] || [[ "${model,,}" =~ $opus_re ]]; then
|
|
169
|
+
claude_read_mult="0.05"
|
|
166
170
|
fi
|
|
167
171
|
|
|
168
172
|
# Get the current epoch timestamp once to be reused across all calculations
|
|
@@ -425,8 +429,7 @@ compute_turn_breakdown() {
|
|
|
425
429
|
input_mult="1"
|
|
426
430
|
output_mult="4"
|
|
427
431
|
else
|
|
428
|
-
read_mult="
|
|
429
|
-
[ "$discounted_cache_read" = true ] && read_mult="0.025"
|
|
432
|
+
read_mult="$claude_read_mult"
|
|
430
433
|
write_mult="1.25"
|
|
431
434
|
[ "${ttl_label:-5m}" = "1h" ] && write_mult="2"
|
|
432
435
|
input_mult="1"
|