RubyLLM 1.15 Adds Image Editing, Cost Tracking, and Simplified Tool Development
Key Takeaways
- ▸Image editing integrated into RubyLLM.paint with support for masking and multiple source images
- ▸Automatic cost tracking calculates API expenses from token usage and provider pricing data
- ▸Tool parameter inference from method signatures eliminates repetitive boilerplate code
Summary
RubyLLM, an open-source Ruby library for integrating with large language models and AI services, has released version 1.15 with significant developer-focused improvements aimed at reducing boilerplate code. The release introduces image editing capabilities through an expanded RubyLLM.paint method that supports generating images from scratch or editing existing images with optional masking. Multiple source images can be combined, and the method integrates seamlessly with Rails Active Storage attachments.
Automatically generated cost tracking is a major feature, calculating API expenses by combining token counts with the library's built-in provider pricing registry. Developers can now call response.cost.total, chat.cost.total, or agent.cost.total without writing pricing logic. The release also refactors token accounting to separately report cache reads, cache writes, input tokens, and output tokens—addressing inconsistencies across providers' prompt caching implementations. Finally, tool definition is dramatically simplified: required and optional parameters are now automatically inferred from Ruby method signatures, eliminating explicit parameter declarations.
- Token accounting refactored to separately track cache reads/writes for accurate cost under prompt caching


