llm_cost_tracker 0.9 released
https://github.com/sergey-homenko/llm_cost_tracker
llm_cost_tracker is a Rails-native ledger for LLM API spend: tracks every Faraday and SDK call, prices each line item against bundled rate snapshots, and renders a built-in dashboard with budgets, rollups, and CSV export. 0.9 ships three major shifts:
-
Image-token billing for gpt-image-1 / -1-mini / -1.5 / -2. The OpenAI SDK integration now splits usage.input_tokens_details.image_tokens and output_tokens into separate image_input_tokens / image_output_tokens columns and prices them at OpenAI’s published image rates. Earlier preview snapshots only stored the 50% batch rates, silently halving image-generation costs.
-
Expanded SDK capture surface. OpenAI: Embeddings#create, Images#generate/#edit/#create_variation, Audio::Transcriptions#create (incl. streaming and the new gpt-4o-transcribe audio/text token split), Audio::Speech#create (TTS billed per character), Moderations#create, Chat::Completions#stream. RubyLLM: Provider#paint and #moderate. Anthropic Priority Tier and inference_geo: “us” data residency mode are recognised and routed to the right rate table.
-
Experimental provider-invoice reconciliation. LlmCostTracker::Reconciliation.import / .diff reconciles your local ledger against the provider’s actual cost API (OpenAI Costs, Anthropic Usage, Gemini). Doctor warns when drift exceeds 5% or imports go stale past 14 days. The default install is now lean: only calls, call_line_items, and call_tags are mandatory. Durable ingestion, rollup-cached budget reads, and reconciliation are opt-in behind config flags and dedicated generators — fresh installs avoid the rollups/inbox tables until you need them.
Security pass: the dashboard no longer auto-mounts (the install generator prints a snippet to drop inside your auth block), tag sanitizer redacts known secret patterns (OpenAI/Anthropic/GitHub/AWS/JWT/Slack/Stripe), and provider_api_key_id / provider_workspace_id are masked on the call-detail page and CSV export.
Full notes & upgrade guide: https://github.com/sergey-homenko/llm_cost_tracker/releases/tag/v0.9.0
Post a comment