[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DWBPP2CYBZQTH71EP25T4Q":3,"skill-same:01M6DWBPP2CYBZQTH71EP25T4Q":95},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":71,"commitSha":72,"skillDirectory":73,"forksCount":74,"repositoryHtmlUrl":75,"repositoryHomepageUrl":76,"ownerHtmlUrl":77,"ownerBlogUrl":78,"ownerDescription":79,"updatedAt":80,"install":81,"resources":94},"01M6DWBPP2CYBZQTH71EP25T4Q","ai-cost-finops",null,"Cutting LLM cost: model price book, prompt caching, Batch tiers, routing, attribution. Use when projecting LLM cost or hunting pipeline waste.","Muvon\u002Foctomind-tap","Muvon","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F25336907?v=4","01M6DWA4KTRX4J73CW5CECKAD0","01M6DWA4QSWFGYE6WDMAMFF1WE",6,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FMuvon\u002Foctomind-tap\u002Fblob\u002Fmaster\u002Fskills\u002Fai-cost-finops\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"finops","cost","ai cost finops","hunting","LangSmith","reduce","when","economics","haiku","stack","router","batch","api","caching","selection","up","pipeline","model","prompt caching","SET","2026-11-10 10:12:30",false,"---\nname: ai-cost-finops\ntitle: \"AI Cost & FinOps: Caching, Batching, Model Routing\"\ndescription: \"Cutting LLM cost: model price book, prompt caching, Batch tiers, routing, attribution. Use when projecting LLM cost or hunting pipeline waste.\"\nlicense: Apache-2.0\ncompatibility: \"Stack-agnostic. FinOps observability typically needs a proxy (Helicone) or instrumented SDK (Langfuse \u002F Phoenix \u002F OpenLLMetry \u002F Vantage). All major providers expose Batch APIs and prompt caching.\"\ndomains: ai\nrules:\n  - session(ai)\n  - content(cost)\n  - content(token)\n  - content(tokens)\n  - content(caching)\n  - content(batch)\n  - content(pricing)\n  - match(\\b(token\\s+(cost|economics|budget|usage|waste))\\b)\n  - match(\\b(prompt\\s+caching|cache\\s+control)\\b)\n  - match(\\b(batch\\s+api)\\b)\n  - match(\\b(model\\s+(routing|selection|router))\\b)\n  - match(\\b(finops|cost\\s+optimization|reduce\\s+(ai|llm)\\s+cost)\\b)\n  - match(\\b(Fable|Haiku|Sonnet|Opus|GPT-?6|Astra|Gemini\\s+(Pro|Flash))\\b)\n  - match(\\b(Helicone|Langfuse|Vantage|Phoenix|LangSmith|OpenLLMetry)\\b)\n  - semantic(reduce our LLM API spend)\n  - semantic(why is our AI bill so high)\n  - semantic(should we use Opus or Haiku for this)\n  - semantic(set up cost tracking for our AI features)\n  - semantic(what does prompt caching save)\n---\n\n## Overview\n\nLLM cost is an engineering surface, not a line on the card statement. The levers that move it most in 2026, in order: prompt caching (cache reads cost a tenth of input or less), Batch\u002FFlex tiers (50% off), effort or reasoning-depth tuning, then model routing. This skill holds the dated price book, the discount mechanics, and the optimization order with primary-source citations.\n\nUse it when projecting cost for a new feature, hunting waste in an existing pipeline, picking a model or effort level, or setting up per-feature attribution. Skip it for prototypes spending under ~$100\u002Fmonth.\n\n## Mental model\n\nEvery call costs `uncached_input × $in + cache_writes × $write + cache_reads × $read + output × $out` (thinking tokens bill as output), plus retrieval, rerank, and storage for RAG. Judge cost per completed task, not per request: a cheaper call that needs more turns or retries is not cheaper.\n\nWork the levers in order. Free wins first, because they don't trade quality: caching, input hygiene, output hygiene, batch. Then quality trades, measured against an eval: effort level, then model choice. The cheapest call is the one not made; then the cached one; then the batched one; then the one at lower effort or on a smaller model.\n\nOutput tokens cost 5× input on most current models, so output-length discipline (no markdown for machine consumers, no preambles) is the next lever after caching.\n\n## Rules\n\n### 1. Price book (2026: verified 2026-10-12, per 1M tokens, standard tier, input\u002Foutput)\n\nPrices change quarterly. Re-check the pricing pages before any budget.\n\n| Provider | Model | Input | Output | Notes |\n|---|---|---|---|---|\n| Anthropic | Claude Fable 5.1 | $10 | $50 | Most capable widely released Claude; thinking always on |\n| Anthropic | Claude Opus 5.5 | $4 | $20 | Default effort `medium` |\n| Anthropic | Claude Sonnet 5.5 | $2 | $10 | |\n| Anthropic | Claude Haiku 5.5 | $0.10 | $0.50 | Prompts ≤100K tokens; $0.50 \u002F $2.50 above |\n| OpenAI | gpt-6-astra | $10 | $50 | Cached input $1; >272K input billed at a higher tier |\n| OpenAI | gpt-6.1-sol | $2 | $10 | Cached input $0.10 |\n| OpenAI | gpt-6-luna | $0.10 | $0.50 | Cached input $0.01 |\n| Google | Gemini 3.1 Pro (preview) | $2 | $12 | ≤200K prompt; $4 \u002F $18 above |\n| Google | Gemini 3.8 Flash | $0.75 | $3.75 | Promotional to 31 Dec 2026, then $1.50 \u002F $7.50 |\n| Google | Gemini 3.5 Flash-Lite | $0.30 | $2.50 | |\n\nSources: [Anthropic pricing](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fabout-claude\u002Fpricing), [OpenAI pricing](https:\u002F\u002Fdevelopers.openai.com\u002Fapi\u002Fdocs\u002Fpricing), [Gemini pricing](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fpricing). Older generations stay listed at their own prices; Claude Opus 4.7 and later use a tokenizer that emits ~1–1.35× the tokens of older Claude models, so re-baseline with token counting when migrating. Regional data-residency endpoints carry uplifts on some providers (OpenAI: +10%).\n\n### 2. Prompt caching\n\nAnthropic ([docs](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fprompt-caching)):\n- Writes cost 1.25× input (5-minute TTL, the default) or 2× (1-hour TTL, set `\"ttl\": \"1h\"`). Reads cost ~0.1× input; 0.05× on Opus 5.5 and 0.025× on Fable 5.1.\n- Break-even: two requests on the 5-minute TTL, three on the 1-hour. A cache read refreshes the TTL, so traffic that arrives less than 5 minutes apart never needs the 1-hour TTL.\n- Prefix match in render order tools → system → messages; any byte change invalidates everything after it. Max 4 breakpoints; minimum cacheable prefix is model-dependent (512–4096 tokens) and shorter prefixes silently don't cache.\n- Top-level automatic caching moves the breakpoint forward as a conversation grows; add an explicit breakpoint on the static system prefix for agent loops.\n- Caches are model-scoped, and changing top-level effort mid-conversation invalidates the message cache.\n- Verify with `usage.cache_read_input_tokens`; zero across repeated requests means a silent invalidator (timestamps in the system prompt, unsorted JSON, a varying tool list).\n\nOpenAI: automatic prefix caching, no code change; cached input is billed at 5–10% of input on the GPT-6 family (pricing page). Gemini: implicit caching plus explicit context caches billed at ~10% of input plus hourly storage.\n\nCache system prompts, tool and skill definitions, few-shot examples, and long static documents — anything long, stable, and re-sent.\n\n### 3. Batch and Flex (50% off anything nobody waits on)\n\n- Anthropic Message Batches — 50% off every token, including cache reads and writes; results within 24 hours, in any order (key by `custom_id`). No mid-batch tool loop. [docs](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fbatch-processing)\n- OpenAI Batch and Flex — both 50% below standard on current models. [pricing](https:\u002F\u002Fdevelopers.openai.com\u002Fapi\u002Fdocs\u002Fpricing)\n- Gemini Batch and Flex — 50% off; Priority costs ~1.8×. [pricing](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fpricing)\n\nUse for evals, backfills, embeddings, dataset enrichment, and scheduled jobs.\n\n### 4. Effort before routing\n\nCurrent frontier models expose a reasoning-depth control: Claude `output_config.effort` (`low` → `max`, with adaptive thinking), OpenAI reasoning effort, Gemini thinking level. Effort is the first quality-trading lever: it trades thoroughness for tokens inside one model and keeps one cache namespace.\n\n- Effort names don't mean the same thinking budget across models; re-run the sweep per model. Anthropic reports Opus 5.5 at `medium` matching or beating Opus 5 at `high` on coding and knowledge work ([prompting guide](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fprompt-engineering\u002Fprompting-claude-opus-5-5)).\n- Chat, classification, and high-volume routes often hold quality at `low`; coding and long-horizon agents repay `high`\u002F`xhigh`. Tune per route, not globally.\n- Before building a multi-model cascade, measure the strongest model at lower effort on the same tasks.\n\n### 5. Model routing\n\n| Approach | Pros | Cons |\n|---|---|---|\n| Manual rules (classify by complexity, escalate on validation failure) | Predictable, auditable | Needs upfront classification logic |\n| Commercial routers (Martian, NotDiamond, OpenRouter Auto) | Zero setup | Vendor-claimed savings; often pick expensive models ([RouterArena, arXiv:2510.00202](https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.00202)) |\n\nPattern: small model by default (Haiku, Flash-Lite, Luna), escalate to mid-tier on low confidence or failed validation, reserve the top tier for hard-reasoning paths — with an eval gate per tier. Every model switch forfeits cache reuse.\n\n### 6. Output and input hygiene\n\n- Structured outputs (Anthropic `output_config.format` and strict tools, OpenAI Structured Outputs) kill preambles and parse-retry loops.\n- No markdown when the consumer is a machine; ban preambles in the system prompt.\n- Don't ask current reasoning models to write their reasoning into the answer: it costs output tokens, and on the newest Claude models it can be declined (`reasoning_extraction`). Lower effort instead.\n- Trim tool results to high-signal fields; cap or compact long histories.\n- Set `max_tokens` with room for thinking — a truncated answer you retry costs twice.\n\n### 7. FinOps observability and attribution\n\n| Tool | Mode | Strength |\n|---|---|---|\n| Provider usage\u002Fcost APIs (Anthropic Usage & Cost Admin API, OpenAI usage) | Org-level | Ground truth for spend by model, key, workspace |\n| Helicone | Gateway (URL swap) | Always-on cost\u002Flatency logging; OSS |\n| Langfuse | SDK or OTLP | Per-generation cost tracking; OSS |\n| Phoenix (Arize) | OSS, OTLP-native | Local-first trace analysis |\n| LangSmith | SDK | Deepest LangChain integration |\n| Vantage | FinOps platform | Cross-provider and cloud roll-up, per-team allocation |\n\nCheck current plan pricing on each vendor's site. Tag every call with `feature`, `team`, `customer_tier`, `experiment_arm`; use per-project API keys or workspaces so usage reports are attributable. Without attribution you can't optimize.\n\n### 8. Waste patterns\n\n| Pattern | Impact | Fix |\n|---|---|---|\n| Uncached system prompt and tools re-sent every turn | Full input price per turn | Stable prefix + breakpoints; verify hit rate |\n| Timestamp or request ID in the system prompt | Cache never hits | Move volatile content after the last breakpoint |\n| Over-retrieved RAG context | Input bloat | Rerank + tighter top-k |\n| JSON parse-retry loops | 2–3× cost on flaky calls | Structured outputs \u002F strict tools |\n| Top tier at top effort for routine traffic | Several-fold over-spend | Effort sweep, then routing, gated by evals |\n| No streaming abort | Pay for bad output | Stream and stop on quality signals |\n\n### 9. RAG cost stack\n\n- Embeddings are usually a rounding error next to generation; upgrade the embedding model only when retrieval evals show lift.\n- Rerankers bill per search (Cohere: one query + up to 100 documents; Rerank 4 shipped Apr 2026) — cost scales with candidates, so rerank the top 50, not the top 500.\n- Managed vector DBs (Pinecone, Weaviate, Qdrant, Turbopuffer) price on storage, reads, and writes; self-hosting wins at very large scale. Price your own volume on the vendor pages.\n- A stable corpus under ~200K tokens can skip RAG entirely: put it in the prompt and cache it ([Anthropic Contextual Retrieval](https:\u002F\u002Fwww.anthropic.com\u002Fnews\u002Fcontextual-retrieval)).\n\n## Examples\n\nBad: \"Use Opus for everything; it's the best.\" No per-task cost, no eval, no effort setting.\n\nGood: \"Support triage runs 40K requests\u002Fday with a 6K-token static prefix. Caching the prefix cuts that input to ~0.1× after the first write; the nightly re-classification moves to Batch at 50% off; an effort sweep shows `low` holds the 94% routing accuracy of `high`. Projected per-ticket cost drops from $X to $Y (prices from the pricing page, 2026-10-12).\"\n\nCase studies (Klarna, Intercom Fin) are useful for direction only; budget from your own attribution data, not vendor blog numbers.\n\n## Checklist\n\n- [ ] Prices quoted with the date checked and the source URL\n- [ ] Cache hit rate measured from usage fields; static prefix byte-stable; TTL chosen from request gaps\n- [ ] Every non-real-time path on Batch or Flex\n- [ ] Effort swept per route against an eval before any model routing\n- [ ] Routing tiers each gated by an eval; cache-scope loss accounted for\n- [ ] Structured outputs on machine-consumed paths; no preambles; `max_tokens` leaves room for thinking\n- [ ] RAG: rerank depth bounded; long-context-with-cache considered for small corpora\n- [ ] Every call tagged for per-feature attribution; per-project keys or workspaces\n- [ ] Cost reported per completed task, not per request\n\n## Composition \u002F References\n\nWithin-domain pairings:\n- Pairs with the sibling AI skill on RAG patterns (embeddings, rerank, vector DB costs).\n- Pairs with the sibling AI skill on agent design (multi-agent and tool-loop cost).\n- Pairs with the sibling AI skill on evals (every effort or routing change needs an eval gate; eval runs belong on Batch).\n\nPrimary sources:\n- [Anthropic pricing](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fabout-claude\u002Fpricing)\n- [Anthropic prompt caching](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fprompt-caching)\n- [Anthropic batch processing](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fbatch-processing)\n- [Anthropic effort](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Feffort)\n- [OpenAI pricing](https:\u002F\u002Fdevelopers.openai.com\u002Fapi\u002Fdocs\u002Fpricing)\n- [Gemini pricing](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fpricing)\n- [Langfuse token and cost tracking](https:\u002F\u002Flangfuse.com\u002Fdocs\u002Fobservability\u002Ffeatures\u002Ftoken-and-cost-tracking)\n- [RouterArena, arXiv:2510.00202](https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.00202)\n","## Overview\n\nLLM cost is an engineering surface, not a line on the card statement. The levers that move it most in 2026, in order: prompt caching (cache reads cost a tenth of input or less), Batch\u002FFlex tiers (50% off), effort or reasoning-depth tuning, then model routing. This skill holds the dated price book, the discount mechanics, and the optimization order with primary-source citations.\n\nUse it when projecting cost for a new feature, hunting waste in an existing pipeline, picking a model or effort level, or setting up per-feature attribution. Skip it for prototypes spending under ~$100\u002Fmonth.\n\n## Mental model\n\nEvery call costs `uncached_input × $in + cache_writes × $write + cache_reads × $read + output × $out` (thinking tokens bill as output), plus retrieval, rerank, and storage for RAG. Judge cost per completed task, not per request: a cheaper call that needs more turns or retries is not cheaper.\n\nWork the levers in order. Free wins first, because they don't trade quality: caching, input hygiene, output hygiene, batch. Then quality trades, measured against an eval: effort level, then model choice. The cheapest call is the one not made; then the cached one; then the batched one; then the one at lower effort or on a smaller model.\n\nOutput tokens cost 5× input on most current models, so output-length discipline (no markdown for machine consumers, no preambles) is the next lever after caching.\n\n## Rules\n\n### 1. Price book (2026: verified 2026-10-12, per 1M tokens, standard tier, input\u002Foutput)\n\nPrices change quarterly. Re-check the pricing pages before any budget.\n\n| Provider | Model | Input | Output | Notes |\n|---|---|---|---|---|\n| Anthropic | Claude Fable 5.1 | $10 | $50 | Most capable widely released Claude; thinking always on |\n| Anthropic | Claude Opus 5.5 | $4 | $20 | Default effort `medium` |\n| Anthropic | Claude Sonnet 5.5 | $2 | $10 | |\n| Anthropic | Claude Haiku 5.5 | $0.10 | $0.50 | Prompts ≤100K tokens; $0.50 \u002F $2.50 above |\n| OpenAI | gpt-6-astra | $10 | $50 | Cached input $1; >272K input billed at a higher tier |\n| OpenAI | gpt-6.1-sol | $2 | $10 | Cached input $0.10 |\n| OpenAI | gpt-6-luna | $0.10 | $0.50 | Cached input $0.01 |\n| Google | Gemini 3.1 Pro (preview) | $2 | $12 | ≤200K prompt; $4 \u002F $18 above |\n| Google | Gemini 3.8 Flash | $0.75 | $3.75 | Promotional to 31 Dec 2026, then $1.50 \u002F $7.50 |\n| Google | Gemini 3.5 Flash-Lite | $0.30 | $2.50 | |\n\nSources: [Anthropic pricing](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fabout-claude\u002Fpricing), [OpenAI pricing](https:\u002F\u002Fdevelopers.openai.com\u002Fapi\u002Fdocs\u002Fpricing), [Gemini pricing](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fpricing). Older generations stay listed at their own prices; Claude Opus 4.7 and later use a tokenizer that emits ~1–1.35× the tokens of older Claude models, so re-baseline with token counting when migrating. Regional data-residency endpoints carry uplifts on some providers (OpenAI: +10%).\n\n### 2. Prompt caching\n\nAnthropic ([docs](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fprompt-caching)):\n- Writes cost 1.25× input (5-minute TTL, the default) or 2× (1-hour TTL, set `\"ttl\": \"1h\"`). Reads cost ~0.1× input; 0.05× on Opus 5.5 and 0.025× on Fable 5.1.\n- Break-even: two requests on the 5-minute TTL, three on the 1-hour. A cache read refreshes the TTL, so traffic that arrives less than 5 minutes apart never needs the 1-hour TTL.\n- Prefix match in render order tools → system → messages; any byte change invalidates everything after it. Max 4 breakpoints; minimum cacheable prefix is model-dependent (512–4096 tokens) and shorter prefixes silently don't cache.\n- Top-level automatic caching moves the breakpoint forward as a conversation grows; add an explicit breakpoint on the static system prefix for agent loops.\n- Caches are model-scoped, and changing top-level effort mid-conversation invalidates the message cache.\n- Verify with `usage.cache_read_input_tokens`; zero across repeated requests means a silent invalidator (timestamps in the system prompt, unsorted JSON, a varying tool list).\n\nOpenAI: automatic prefix caching, no code change; cached input is billed at 5–10% of input on the GPT-6 family (pricing page). Gemini: implicit caching plus explicit context caches billed at ~10% of input plus hourly storage.\n\nCache system prompts, tool and skill definitions, few-shot examples, and long static documents — anything long, stable, and re-sent.\n\n### 3. Batch and Flex (50% off anything nobody waits on)\n\n- Anthropic Message Batches — 50% off every token, including cache reads and writes; results within 24 hours, in any order (key by `custom_id`). No mid-batch tool loop. [docs](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fbatch-processing)\n- OpenAI Batch and Flex — both 50% below standard on current models. [pricing](https:\u002F\u002Fdevelopers.openai.com\u002Fapi\u002Fdocs\u002Fpricing)\n- Gemini Batch and Flex — 50% off; Priority costs ~1.8×. [pricing](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fpricing)\n\nUse for evals, backfills, embeddings, dataset enrichment, and scheduled jobs.\n\n### 4. Effort before routing\n\nCurrent frontier models expose a reasoning-depth control: Claude `output_config.effort` (`low` → `max`, with adaptive thinking), OpenAI reasoning effort, Gemini thinking level. Effort is the first quality-trading lever: it trades thoroughness for tokens inside one model and keeps one cache namespace.\n\n- Effort names don't mean the same thinking budget across models; re-run the sweep per model. Anthropic reports Opus 5.5 at `medium` matching or beating Opus 5 at `high` on coding and knowledge work ([prompting guide](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fprompt-engineering\u002Fprompting-claude-opus-5-5)).\n- Chat, classification, and high-volume routes often hold quality at `low`; coding and long-horizon agents repay `high`\u002F`xhigh`. Tune per route, not globally.\n- Before building a multi-model cascade, measure the strongest model at lower effort on the same tasks.\n\n### 5. Model routing\n\n| Approach | Pros | Cons |\n|---|---|---|\n| Manual rules (classify by complexity, escalate on validation failure) | Predictable, auditable | Needs upfront classification logic |\n| Commercial routers (Martian, NotDiamond, OpenRouter Auto) | Zero setup | Vendor-claimed savings; often pick expensive models ([RouterArena, arXiv:2510.00202](https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.00202)) |\n\nPattern: small model by default (Haiku, Flash-Lite, Luna), escalate to mid-tier on low confidence or failed validation, reserve the top tier for hard-reasoning paths — with an eval gate per tier. Every model switch forfeits cache reuse.\n\n### 6. Output and input hygiene\n\n- Structured outputs (Anthropic `output_config.format` and strict tools, OpenAI Structured Outputs) kill preambles and parse-retry loops.\n- No markdown when the consumer is a machine; ban preambles in the system prompt.\n- Don't ask current reasoning models to write their reasoning into the answer: it costs output tokens, and on the newest Claude models it can be declined (`reasoning_extraction`). Lower effort instead.\n- Trim tool results to high-signal fields; cap or compact long histories.\n- Set `max_tokens` with room for thinking — a truncated answer you retry costs twice.\n\n### 7. FinOps observability and attribution\n\n| Tool | Mode | Strength |\n|---|---|---|\n| Provider usage\u002Fcost APIs (Anthropic Usage & Cost Admin API, OpenAI usage) | Org-level | Ground truth for spend by model, key, workspace |\n| Helicone | Gateway (URL swap) | Always-on cost\u002Flatency logging; OSS |\n| Langfuse | SDK or OTLP | Per-generation cost tracking; OSS |\n| Phoenix (Arize) | OSS, OTLP-native | Local-first trace analysis |\n| LangSmith | SDK | Deepest LangChain integration |\n| Vantage | FinOps platform | Cross-provider and cloud roll-up, per-team allocation |\n\nCheck current plan pricing on each vendor's site. Tag every call with `feature`, `team`, `customer_tier`, `experiment_arm`; use per-project API keys or workspaces so usage reports are attributable. Without attribution you can't optimize.\n\n### 8. Waste patterns\n\n| Pattern | Impact | Fix |\n|---|---|---|\n| Uncached system prompt and tools re-sent every turn | Full input price per turn | Stable prefix + breakpoints; verify hit rate |\n| Timestamp or request ID in the system prompt | Cache never hits | Move volatile content after the last breakpoint |\n| Over-retrieved RAG context | Input bloat | Rerank + tighter top-k |\n| JSON parse-retry loops | 2–3× cost on flaky calls | Structured outputs \u002F strict tools |\n| Top tier at top effort for routine traffic | Several-fold over-spend | Effort sweep, then routing, gated by evals |\n| No streaming abort | Pay for bad output | Stream and stop on quality signals |\n\n### 9. RAG cost stack\n\n- Embeddings are usually a rounding error next to generation; upgrade the embedding model only when retrieval evals show lift.\n- Rerankers bill per search (Cohere: one query + up to 100 documents; Rerank 4 shipped Apr 2026) — cost scales with candidates, so rerank the top 50, not the top 500.\n- Managed vector DBs (Pinecone, Weaviate, Qdrant, Turbopuffer) price on storage, reads, and writes; self-hosting wins at very large scale. Price your own volume on the vendor pages.\n- A stable corpus under ~200K tokens can skip RAG entirely: put it in the prompt and cache it ([Anthropic Contextual Retrieval](https:\u002F\u002Fwww.anthropic.com\u002Fnews\u002Fcontextual-retrieval)).\n\n## Examples\n\nBad: \"Use Opus for everything; it's the best.\" No per-task cost, no eval, no effort setting.\n\nGood: \"Support triage runs 40K requests\u002Fday with a 6K-token static prefix. Caching the prefix cuts that input to ~0.1× after the first write; the nightly re-classification moves to Batch at 50% off; an effort sweep shows `low` holds the 94% routing accuracy of `high`. Projected per-ticket cost drops from $X to $Y (prices from the pricing page, 2026-10-12).\"\n\nCase studies (Klarna, Intercom Fin) are useful for direction only; budget from your own attribution data, not vendor blog numbers.\n\n## Checklist\n\n- [ ] Prices quoted with the date checked and the source URL\n- [ ] Cache hit rate measured from usage fields; static prefix byte-stable; TTL chosen from request gaps\n- [ ] Every non-real-time path on Batch or Flex\n- [ ] Effort swept per route against an eval before any model routing\n- [ ] Routing tiers each gated by an eval; cache-scope loss accounted for\n- [ ] Structured outputs on machine-consumed paths; no preambles; `max_tokens` leaves room for thinking\n- [ ] RAG: rerank depth bounded; long-context-with-cache considered for small corpora\n- [ ] Every call tagged for per-feature attribution; per-project keys or workspaces\n- [ ] Cost reported per completed task, not per request\n\n## Composition \u002F References\n\nWithin-domain pairings:\n- Pairs with the sibling AI skill on RAG patterns (embeddings, rerank, vector DB costs).\n- Pairs with the sibling AI skill on agent design (multi-agent and tool-loop cost).\n- Pairs with the sibling AI skill on evals (every effort or routing change needs an eval gate; eval runs belong on Batch).\n\nPrimary sources:\n- [Anthropic pricing](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fabout-claude\u002Fpricing)\n- [Anthropic prompt caching](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fprompt-caching)\n- [Anthropic batch processing](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fbatch-processing)\n- [Anthropic effort](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Feffort)\n- [OpenAI pricing](https:\u002F\u002Fdevelopers.openai.com\u002Fapi\u002Fdocs\u002Fpricing)\n- [Gemini pricing](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fpricing)\n- [Langfuse token and cost tracking](https:\u002F\u002Flangfuse.com\u002Fdocs\u002Fobservability\u002Ffeatures\u002Ftoken-and-cost-tracking)\n- [RouterArena, arXiv:2510.00202](https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.00202)\n",{"name":5,"rules":48,"title":68,"domains":69,"license":14,"description":7,"compatibility":70},[49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"session(ai)","content(cost)","content(token)","content(tokens)","content(caching)","content(batch)","content(pricing)","match(\\b(token\\s+(cost|economics|budget|usage|waste))\\b)","match(\\b(prompt\\s+caching|cache\\s+control)\\b)","match(\\b(batch\\s+api)\\b)","match(\\b(model\\s+(routing|selection|router))\\b)","match(\\b(finops|cost\\s+optimization|reduce\\s+(ai|llm)\\s+cost)\\b)","match(\\b(Fable|Haiku|Sonnet|Opus|GPT-?6|Astra|Gemini\\s+(Pro|Flash))\\b)","match(\\b(Helicone|Langfuse|Vantage|Phoenix|LangSmith|OpenLLMetry)\\b)","semantic(reduce our LLM API spend)","semantic(why is our AI bill so high)","semantic(should we use Opus or Haiku for this)","semantic(set up cost tracking for our AI features)","semantic(what does prompt caching save)","AI Cost & FinOps: Caching, Batching, Model Routing","ai","Stack-agnostic. FinOps observability typically needs a proxy (Helicone) or instrumented SDK (Langfuse \u002F Phoenix \u002F OpenLLMetry \u002F Vantage). All major providers expose Batch APIs and prompt caching.","master","e9e4a19559669b1627b1ac5ed3f77b8e36cfad95","skills\u002Fai-cost-finops",0,"https:\u002F\u002Fgithub.com\u002FMuvon\u002Foctomind-tap","https:\u002F\u002Foctomind.run\u002Ftap\u002F","https:\u002F\u002Fgithub.com\u002FMuvon","https:\u002F\u002Fmuvon.io","We bring ideas to life","2026-11-14 13:21:16",{"source":8,"skillName":5,"commands":82,"prompt":92,"zipAvailable":93},[83,86,89],{"tool":84,"command":85},"npx","npx skills add Muvon\u002Foctomind-tap --skill ai-cost-finops",{"tool":87,"command":88},"bunx","bunx skills add Muvon\u002Foctomind-tap --skill ai-cost-finops",{"tool":90,"command":91},"pnpm","pnpm dlx skills add Muvon\u002Foctomind-tap --skill ai-cost-finops","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMuvon\u002Foctomind-tap\u002Fblob\u002Fmaster\u002Fskills\u002Fai-cost-finops\u002FSKILL.md",true,[],[96,134,161,181,204,226],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":113,"publishedAt":43},"01M70SFC5CTHRKA9B97N1ARVZ2","seo-content-refresh","Finds decaying pages, picks update, merge, redirect or remove, and briefs each refresh. Use to prioritize existing content and judge whether it helped.","https:\u002F\u002Fgithub.com\u002FMuvon\u002Foctomind-tap\u002Fblob\u002Fmaster\u002Fskills\u002Fseo-content-refresh\u002FSKILL.md",[102,105,110],{"categoryNo":103,"categoryName":104,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000019","营销推广",{"categoryNo":106,"categoryName":107,"taxonomyType":108,"taxonomyTypeDesc":109},"01JBSEEDCAT000000000000035","市场营销","PROFESSION","适用职业",{"categoryNo":111,"categoryName":112,"taxonomyType":108,"taxonomyTypeDesc":109},"01JBSEEDCAT000000000000036","内容创作者",[114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133],"seo content refresh","seo","seo content","content refresh","refresh","content","posts","remove","web search","performance","search","traffic","access","drop","websearch","revamp","merge","diagnosis","update","decay",{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":142,"publishedAt":43},"01M70SBWQCHGH7HGS51Y0GTKKW","marketing-review-program","Plans how to ask real customers for honest public reviews: site choice, invitation copy, incentive and disclosure rules. Use to start a review program.","https:\u002F\u002Fgithub.com\u002FMuvon\u002Foctomind-tap\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketing-review-program\u002FSKILL.md",[140,141],{"categoryNo":103,"categoryName":104,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":106,"categoryName":107,"taxonomyType":108,"taxonomyTypeDesc":109},[143,144,145,146,147,148,122,124,149,150,151,152,153,154,155,156,157,158,159,160],"program","review","marketing review program","marketing","reviews","get","campaign","choice","how to","only","generated","ask","plan","product","generate","customer","how","request",{"skillNo":162,"name":163,"nameZh":6,"description":164,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":165,"categories":166,"keywords":167,"publishedAt":43},"01M70SBB65Z2FC71Q7DEAXGJBG","geo-source-actions","Turns AI citation findings into ranked per-source actions for Reddit threads, listicles, review sites and videos. Records only. Use after a GEO audit.","https:\u002F\u002Fgithub.com\u002FMuvon\u002Foctomind-tap\u002Fblob\u002Fmaster\u002Fskills\u002Fgeo-source-actions\u002FSKILL.md",[],[168,169,170,171,172,148,122,124,173,174,152,128,144,175,176,177,156,178,179,180],"actions","geo source actions","source","geo","sources","copilot","domains","llms","threads","youtube","audit","action","data",{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":185,"categories":186,"keywords":190,"publishedAt":43},"01M70S99D3Y6GF097GTXWBXHPW","commerce-ai-readiness","Audits product feeds, markup and live pages for AI shopping assistants, then lists exact fixes. Use to make a store catalog readable to AI shoppers.","https:\u002F\u002Fgithub.com\u002FMuvon\u002Foctomind-tap\u002Fblob\u002Fmaster\u002Fskills\u002Fcommerce-ai-readiness\u002FSKILL.md",[187],{"categoryNo":188,"categoryName":189,"taxonomyType":108,"taxonomyTypeDesc":109},"01JBSEEDCAT000000000000031","产品经理",[191,192,193,194,195,196,197,198,199,200,124,38,173,152,126,201,202,156,178,203],"ai readiness","commerce ai readiness","commerce","readiness","feeds","ready","show","shopping","discover","checkout","ecommerce","documentation","recommend",{"skillNo":205,"name":206,"nameZh":6,"description":207,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":208,"categories":209,"keywords":211,"publishedAt":43},"01M6DWSX45J42KTK6XASKJRGPA","tap-model-training","Train, evaluate and publish the octomind-embed model behind capability auto-activation. Use when capability triggers or skill semantic() phrases change.","https:\u002F\u002Fgithub.com\u002FMuvon\u002Foctomind-tap\u002Fblob\u002Fmaster\u002Fskills\u002Ftap-model-training\u002FSKILL.md",[210],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[40,212,213,214,215,38,216,217,218,219,220,35,221,222,223,159,224,225,29,132],"training","tap","tap model training","scope","eval","uv","auto","dataset","activate","capabilities","publish","change","embedding","re",{"skillNo":227,"name":228,"nameZh":6,"description":229,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":230,"categories":231,"keywords":233,"publishedAt":43},"01M6DWSQB7NSW53Z86XM81R1W1","tap-deps-authoring","Write dep scripts for the octomind-tap registry: header comments, platform.sh, mcp vs dep types, npx\u002Fuvx pattern. Use when editing deps\u002F\u003Corg>\u002F\u003Ctool>.sh.","https:\u002F\u002Fgithub.com\u002FMuvon\u002Foctomind-tap\u002Fblob\u002Fmaster\u002Fskills\u002Ftap-deps-authoring\u002FSKILL.md",[232],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[234,213,235,236,237,238,239,240,241,242,243,244,245,246,247,248,29,249,250,251],"deps","tap deps authoring","authoring","DEP","MCP","run","scripts","pattern","install","registry","platform","repo","editing","tool","types","write","org","for"]