VS Code Extensions
PromptScan — LLM prompt cost

PromptScan — LLM prompt cost

by joandino

See the token count and dollar cost of every LLM prompt, inline, as you write it.

Downloads

0

Rating

(0)

Version

0.1.0

Last updated

Jul 28, 2026

See what your LLM prompts cost — token count and dollar cost — inline, above every call site, as you write them.

This extension wraps PromptScan, a static analyzer for LLM call sites. It reads your code (no runtime, no API key) and annotates each OpenAI / Anthropic / LangChain / litellm / Vercel AI SDK call with its estimated input cost.

What you get

  • Inline cost CodeLens above every detected call site: ⚡ ~$0.0029/call · ~587+ tok · claude-opus-4-8 · +2 tools. Markers match the CLI — ~ an approximate (Anthropic proxy) tokenizer, + a floor where only static content could be counted.
  • Diagnostics in the Problems panel: prompt-caching opportunities, possibly-unused prompts, and duplicated prompts, each on the line that owns it.
  • PromptScan: Scan Workspace command for a whole-project summary.

Because it's static analysis, it reports only what the source makes knowable: a prompt built at runtime is marked unresolved rather than guessed. Notably, a call whose prompt is a runtime value but whose tool schemas are static still gets a real number — the tools are often the larger cost.

Settings

Setting Default Description
promptscan.enableCodeLens true Show the token/cost CodeLens above each call site.
promptscan.enableDiagnostics true Report caching opportunities, dead prompts, and duplicates as diagnostics.

Notes

  • Results reflect the saved file — the scanner reads from disk, so annotations refresh on save.
  • Anthropic token counts use a calibrated cl100k proxy (Anthropic publishes no tokenizer); OpenAI uses the exact tiktoken encoding. See the main README for the accuracy details.

Development

npm install
npm run build      # tsc → out/
npm test           # headless unit tests of the presentation logic
npm run package    # build a .vsix (vsce)

Press F5 in VS Code to launch an Extension Development Host and try it on a real file.

Related extensions