Agent skill

Cache Credits Analyzer

by TsinHzl in TsinHzl/kiro2cc-proxy

分析 kiro2cc-proxy 访问日志,计算 Prompt Caching 节省的 credits。只要用户粘贴了含有"输入token 输出token 费用$ credits✓"格式的日志行,并询问节省了多少credits、缓存效率、cost分析等,立即使用此 skill。触发关键词:节省了多少credits、cache节省、分析日志、caching…

MITAuto-check passedBackend & APIs

Install Cache Credits Analyzer

skills CLI
$ npx skills add TsinHzl/kiro2cc-proxy --skill cache-credits-analyzer -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install TsinHzl/kiro2cc-proxy cache-credits-analyzer --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/TsinHzl/kiro2cc-proxy.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/cache-credits-analyzer .claude/skills/cache-credits-analyzer && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cache-credits-analyzer
GitHub stars
174
Token cost
~1.1k tokens
SKILL.md length
225 words
Files
1
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

分析 kiro2cc-proxy 访问日志,计算 Prompt Caching 节省的 credits。只要用户粘贴了含有"输入token 输出token 费用$ credits✓"格式的日志行,并询问节省了多少credits、缓存效率、cost分析等,立即使用此 skill。触发关键词:节省了多少credits、cache节省、分析日志、caching…

  • Works in 4 steps: 解析日志 → 确定基准 k_ref(按模型分别推算) → 计算节省(按模型分别折算) → …
  • Tasks that involve LLM cost and token optimization
  • SKILL.md covers 日志格式说明, 分析步骤 and 注意事项
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Cache Credits Analyzer is an agent skill from TsinHzl/kiro2cc-proxy. 分析 kiro2cc-proxy 访问日志,计算 Prompt Caching 节省的 credits。只要用户粘贴了含有"输入token 输出token 费用$ credits✓"格式的日志行,并询问节省了多少credits、缓存效率、cost分析等,立即使用此 skill。触发关键词:节省了多少credits、cache节省、分析日志、caching savings、credits分析、计算节省、这些数据节省了多少。

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering LLM cost and token optimization and Caching. The repository describes itself as: Kiro 反代到 Claude Code 与 Codex,支持 Claude Opus 5.5/5/4.8/4.7/4.6、Sonnet 5、GPT-5.6,兼容 Kiro Cache,并支持 SSE 流式输出。Kiro proxy for Claude Code and Codex. Supports Claude Opus… The licence is MIT.

When your agent uses it

  • Tasks that involve LLM cost and token optimization
  • Tasks that involve Caching

Example prompts

  • “输入token 输出token 费用$ credits✓”
  • “/cache-credits-analyzer”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. 解析日志
  2. 确定基准 k_ref(按模型分别推算)
  3. 计算节省(按模型分别折算)
  4. 汇总输出

What it can do on your machine

Read from SKILL.md and the folder at commit 34afa33. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Cache Credits Analyzer loads about 1.1k tokens when it runs. Until then it costs about 59 tokens; SKILL.md has 225 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~59
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from TsinHzl/kiro2cc-proxy at commit 34afa33, republished under its MIT licence (© TsinHzl). 225 words, ~1,059 tokens.

Download SKILL.mdSave it as .claude/skills/cache-credits-analyzer/SKILL.md (or your agent's skills folder).
name
cache-credits-analyzer
description
分析 kiro2cc-proxy 访问日志,计算 Prompt Caching 节省的 credits。只要用户粘贴了含有"输入token 输出token 费用$ credits✓"格式的日志行,并询问节省了多少credits、缓存效率、cost分析等,立即使用此 skill。触发关键词:节省了多少credits、cache节省、分析日志、caching savings、credits分析、计算节省、这些数据节省了多少。

Kiro Cache Credits 节省分析

日志格式说明

支持两种日志来源:

格式 A:访问日志(每行 8 列,制表符/多空格分隔)
时间戳    IP    邮箱    模型    输入tokens    输出tokens    费用($)    credits✓

示例:

2026/05/25 16:19:38  127.0.0.1  user@example.com  claude-sonnet-4-6  11.3K  10  $0.0339  0.1382✓
  • 输入tokens:支持 11.3K、920 等格式(K = × 1000)
  • 费用($):estimated_cost,按 Anthropic 全价计算(无缓存折扣)
  • credits✓:credits_used,来自 Kiro meteringEvent 的真实 credits 消耗
格式 B:runtime-log([usage] 入库 行)
... [usage] 入库: model=<m> input=<n> output=<n> metering_credits=Some(<f>) credits_per_ktok=Some(<f>) effective_rate=Some(<f>) cache_read=<None|Some(n)> cache_creation=<None|Some(n)> ...

解析时:

  • model → 模型名
  • input / output → token 数(已是整数,无需 K 换算)
  • metering_credits → credits_used(Some 内取值)
  • cost_usd 需用 Anthropic 官方定价本地折算:
    cost_usd = (input * input_price + output * output_price) / 1e6
    各模型定价($/1M tokens):
    模型inputoutput
    claude-opus-4-6 / 4-715.075.0
    claude-sonnet-4-6 / 4-73.015.0
    claude-haiku-*0.804.0

分析步骤

1. 解析日志

从用户提供的日志文本中逐行提取:

  • model
  • cost_usd(格式 A 直接取;格式 B 由 input/output 折算)
  • credits_used

格式 A 忽略无 ✓ 标记的行;格式 B 忽略无 metering_credits=Some(...) 的行。

2. 确定基准 k_ref(按模型分别推算)

核心原则:每个模型独立推 k_ref,绝不全局共用一个值。

不同模型的 credit/$ 倍率显著不同(Sonnet ≈ 7.06,Opus ≈ 2.5)。 混用单一 k_ref 会让 Opus 的"基准"虚抬 ~2.7 倍,节省被严重高估。

推算流程(每个模型独立执行)
  1. 计算该模型每行的 k = credits_used / cost_usd
  2. 取该模型样本中 k 的最大值 作为 k_ref(命中缓存只会让 k 变小; 最大 k 最接近"无缓存"基准)
  3. 若 k_max > 经验值 × 1.30,判为 cache-creation 行污染(写缓存定价上限 1.25×,留 5% 容差),剔除后取次大
  4. 该模型样本数 < 3 条 → 回退到下表经验值,并在输出中显式 ⚠️ 告警
各模型经验值 k_ref(fallback 用)
模型k_ref (credits/$)来源
claude-sonnet-4-67.06项目历史实测
claude-sonnet-4-77.06同上(同价位)
claude-opus-4-62.40实测
claude-opus-4-72.60实测
claude-haiku-*未知首次出现时实测,回退前先告警
3. 计算节省(按模型分别折算)

对每行:

该模型的 k_ref = 上一步推算结果
无缓存应消耗 credits = cost_usd × k_ref(model)
实际消耗 credits     = credits_used
节省 credits         = 无缓存credits − 实际credits

汇总时分别累加各模型的 baseline 与 actual,最后再求总和。 禁止用单一全局 k_ref 折算所有模型。

  • 正值:缓存命中节省了 credits
  • 负值:cache creation 写入开销(属于"先花后省")
4. 汇总输出

输出以下结构的分析结果:

## Prompt Caching Credits 节省分析

### k_ref 推算结果(按模型)

| 模型 | 样本数 | 实测 k_max | 采用 k_ref | 来源 |
|------|------:|----------:|----------:|------|
| claude-sonnet-4-6 | 90 | 7.18 | 7.18 | 实测 |
| claude-opus-4-7   |  7 | 2.60 | 2.60 | 实测 |
| claude-opus-4-6   |  7 | 2.38 | 2.38 | 实测 |

> 样本 < 3 条的模型必须标 ⚠️ "回退经验值,结果不可靠"

### 总览

| 指标 | 数值 |
|------|------|
| 请求总数 | N 条 |
| 总 estimated_cost(Anthropic 全价) | $X.XXXX |
| 假设无缓存总 credits(按模型 k_ref 折算后求和) | X.XXXX |
| 实际消耗总 credits | X.XXXX |
| **净节省 credits** | **X.XXXX** |
| 节省比例 | XX.X% |
| 折算 API 成本节省 | ~$X.XXXX |

### 按模型分组

| 模型 | 请求数 | k_ref | baseline | actual | 节省 | 节省率 |
|------|------:|-----:|--------:|------:|----:|------:|
| ...  |       |      |         |       |     |       |

### Cache 构成
- 缓存命中节省(gross):+X.XXXX credits
- Cache creation 额外开销:-X.XXXX credits(如有大输出行,通常为写缓存成本)

### 按用户分组(仅格式 A 有 email 字段时)
| 用户 | 实际 credits | 无缓存 credits | 节省 credits | 节省率 |
|------|-------------|---------------|-------------|--------|
| ... |

### 典型行分析(按模型分别列出)
- 该模型缓存最深(k最小):... → k=X.XX,节省率XX%
- 该模型 cache creation 行(k > k_ref):...
- 该模型无缓存基准行(k≈k_ref):...

注意事项

  • 绝不全局共用 k_ref:每个模型独立推算。混用单一 k_ref 会让 Opus 节省 被高估约 2.7 倍。
  • k_max 异常告警:若某模型 k_max 超过经验值 × 1.30(与推算流程阈值一致), 怀疑有 cache-creation 行污染样本,剔除后重算。
  • 样本不足告警:模型样本数 < 3 → 输出标 ⚠️,提醒该模型节省量是估算。
  • runtime-log 缺 cache 字段:当 cache_read=None cache_creation=None 时 (上游代理未透传),节省量是 baseline − actual 反推,无法用真实 cache token 交叉验证;报告里必须注明"间接估计"。
  • Cache creation 行(k > 该模型 k_ref)表示该请求写入了 prompt cache, 后续请求因此受益——它的"负节省"是整个对话缓存收益的前置成本。
  • estimated_cost 是按 Anthropic 全价的本地估算(不含缓存折扣); credits_used 是 Kiro 实际扣除值(含缓存折扣);两者之差乘以该模型的 k_ref 即为该模型节省量。

© TsinHzl, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/cache-credits-analyzer of TsinHzl/kiro2cc-proxy.

Open the folder on GitHubat commit 34afa33

Compare with similar skills

Cache Credits Analyzer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Cache Credits Analyzer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Cache Credits Analyzer this skillTsinHzl/kiro2cc-proxy174—~1.1kAutomated safety check: PassMIT
Prompt Cachingdavila7/claude-code-templates33k5 repos~452Automated safety check: PassMIT
LLM Cachingsickn33/agentic-awesome-skills47k2 repos~2.8kAutomated safety check: PassMIT
LLM Gatewaysickn33/agentic-awesome-skills47k1 repos~2.1kAutomated safety check: PassMIT
Continue Enable DefaultsOnlyTerp/prompt-cache-skills114—~977Automated safety check: PassCustom licence
Aider Prompt Caching DefaultOnlyTerp/prompt-cache-skills114—~638Automated safety check: PassCustom licence

Similar skills

  • Prompt Caching

    davila7/claude-code-templates

    Caching strategies for LLM prompts including Anthropic prompt caching, response caching, and CAG (Cache Augmented Generation) Use when: prompt caching, cache prompt, response cache, cag, cache…

    33k GitHub starsUsed in 5 repos~452 tokens
    Backend & APIsAuto-check passed
  • LLM Caching

    sickn33/agentic-awesome-skills

    Implement multi-layer LLM caching with exact match, semantic similarity, and provider-side prompt caching.

    47k GitHub starsUsed in 2 repos~2.8k tokens
    Backend & APIsAuto-check passed
  • LLM Gateway

    sickn33/agentic-awesome-skills

    Deploy an API gateway for LLM traffic with load balancing, rate limiting, key management, semantic caching, fallback routing, and cost tracking.

    47k GitHub starsUsed in 1 repo~2.1k tokens
    Backend & APIsAuto-check passed
  • Continue Enable Defaults

    OnlyTerp/prompt-cache-skills

    Continue's prompt caching is opt-in via config and off by default.

    114 GitHub stars~977 tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check passed
  • Aider Prompt Caching Default

    OnlyTerp/prompt-cache-skills

    Patch recipe that turns on Aider's --cache-prompts by default for models that support caching, with a verification procedure against the wire request.

    114 GitHub stars~638 tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check passed
  • Cline Prompt Cache Ladder Check

    OnlyTerp/prompt-cache-skills

    Verifies how Cline marks Anthropic prompt-cache breakpoints on the wire, then adds a tools breakpoint and tunes the cache TTL in its AI SDK code.

    114 GitHub stars~2k tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check passed

Questions about Cache Credits Analyzer

What does Cache Credits Analyzer do?

分析 kiro2cc-proxy 访问日志,计算 Prompt Caching 节省的 credits。只要用户粘贴了含有"输入token 输出token 费用$ credits✓"格式的日志行,并询问节省了多少credits、缓存效率、cost分析等,立即使用此 skill。触发关键词:节省了多少credits、cache节省、分析日志、caching…. Cache Credits Analyzer is an agent skill from TsinHzl/kiro2cc-proxy.

When should I use Cache Credits Analyzer?

Cache Credits Analyzer fits situations like: tasks that involve LLM cost and token optimization; tasks that involve Caching.

How do I install Cache Credits Analyzer in Claude Code?

Run `npx skills add TsinHzl/kiro2cc-proxy --skill cache-credits-analyzer -a claude-code`. Or copy the skill folder (.claude/skills/cache-credits-analyzer in TsinHzl/kiro2cc-proxy) into .claude/skills/cache-credits-analyzer in your project. Claude Code loads it when a task matches its description.

How do I install Cache Credits Analyzer in Codex?

Run `npx skills add TsinHzl/kiro2cc-proxy --skill cache-credits-analyzer -a codex`. Or copy the skill folder (.claude/skills/cache-credits-analyzer in TsinHzl/kiro2cc-proxy) into .agents/skills/cache-credits-analyzer in your project. Codex loads it when a task matches its description.

Can I use Cache Credits Analyzer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add TsinHzl/kiro2cc-proxy --skill cache-credits-analyzer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cache-credits-analyzer, .gemini/skills/cache-credits-analyzer, .github/skills/cache-credits-analyzer and .opencode/skills/cache-credits-analyzer in your project.

What does Cache Credits Analyzer need to run?

SKILL.md names no scripts, command-line tools or credentials: Cache Credits Analyzer is instructions for the agent only.

Does Cache Credits Analyzer access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Cache Credits Analyzer safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Cache Credits Analyzer use?

Cache Credits Analyzer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Cache Credits Analyzer use?

About 1.1k tokens (SKILL.md is roughly 4.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Cache Credits Analyzer?

Skills that share tags, products or a category with Cache Credits Analyzer: Prompt Caching (davila7/claude-code-templates, 33k stars), LLM Caching (sickn33/agentic-awesome-skills, 47k stars), LLM Gateway (sickn33/agentic-awesome-skills, 47k stars) and Continue Enable Defaults (OnlyTerp/prompt-cache-skills, 114 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Cache Credits Analyzer?

TsinHzl (a GitHub user) maintains it in TsinHzl/kiro2cc-proxy, which has 174 GitHub stars. The repository was last updated on October 10, 2026.

Source: TsinHzl/kiro2cc-proxy on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.