RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

llm_cost_tracker 0.1.2: self-hosted LLM API cost tracking for Ruby/Rails

I released my first Ruby gem: llm_cost_tracker.

It is a small self-hosted LLM API cost tracking gem for Ruby/Rails apps. It works as Faraday middleware, tracks token usage and estimated costs for OpenAI, Anthropic, Gemini, OpenRouter, DeepSeek, and OpenAI-compatible APIs, and can store events in ActiveRecord with tags like user_id, tenant_id, and feature.

v0.1.2 adds OpenAI Responses API tracking, OpenAI-compatible providers, best-effort budget guardrails, non-fatal storage error handling, latency tracking, PostgreSQL JSONB tags, and a local JSON/YAML price registry.

GitHub: https://github.com/sergey-homenko/llm_cost_tracker RubyGems: https://rubygems.org/gems/llm_cost_tracker

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in