# RubyLLM

> The Ruby AI framework

Source: https://talira.ai/catalog/rubyllm-2fxp4hmn
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library, Framework
- Categories: [ai / llm / client libraries](https://talira.ai/categories/ai/llm/client-libraries), [ai / agents / frameworks](https://talira.ai/categories/ai/agents/frameworks), [languages / ruby / rails](https://talira.ai/categories/languages/ruby/rails), [languages / ruby](https://talira.ai/categories/languages/ruby)
- Licence: MIT[^1][^2]
- Pricing: Free and open source[^2]
- Free tier: yes[^2]
- Self-hostable: yes[^3]
- Supports: [Agent Skills](https://talira.ai/standards/agent-skills.md)[^3]
- Creator: Carmine Paolino (crmne)

RubyLLM is a Ruby library and framework for building AI features with one API across 23 providers, including [OpenAI](https://talira.ai/catalog/openai-api-t57ph5ck.md), [Anthropic](https://talira.ai/catalog/claude-api-n5v34f04.md), [Gemini](https://talira.ai/catalog/gemini-api-r5x8ntes.md), Bedrock, [OpenRouter](https://talira.ai/catalog/openrouter-7b9zt83p.md), [Ollama](https://talira.ai/catalog/ollama-gr2tx5nn.md) and any OpenAI-compatible endpoint. `RubyLLM.chat` handles conversations with streaming through a block, attachments (images, audio, video, PDFs), structured output from a Ruby schema (`with_schema`, read back with `response.parsed`), tools that call your Ruby methods, agents, prompt caching and fallbacks; separate calls generate images, video, speech, embeddings and rerankings. In [Rails](https://talira.ai/catalog/ruby-on-rails-xkdcpj5k.md) it saves chats with Active Record (`acts_as_chat`), streams replies with Hotwire and has generators for a chat UI. It also has evaluations, cost tracking, OpenTelemetry tracing and a model registry with capabilities and prices.

## Links

- Website: https://rubyllm.com/
- GitHub: https://github.com/crmne/ruby_llm
- Docs: https://rubyllm.com/getting-started/

## Problems it solves

- one Ruby API for OpenAI, Claude and Gemini so I can switch models without rewriting code
- save LLM conversations in my Rails database and stream replies to the page with Hotwire
- add a chat interface to my Rails app quickly
- let the model call Ruby methods in my app as tools
- get structured data back from an LLM as a Ruby object that matches my schema
- track how much each AI conversation costs in my Ruby app
- fall back to another model when the first provider fails
- ask a model about an uploaded PDF, image or audio file from Ruby
- run a local model through Ollama from my Ruby code with the same API as hosted ones
- test my AI agent's answers against a dataset from RSpec or Minitest
- generate embeddings and rerank search results from Ruby
- build reusable AI agents with instructions and tools in a Rails app

## Features

- 23 providers and any OpenAI-compatible API
- chat with streaming through a block
- attachments: images, video, audio, PDFs and other documents
- structured output with with_schema and response.parsed
- tools, tool approval, provider tools and MCP connectors
- RubyLLM::Agent and a step-by-step agentic loop
- image and video generation, transcription and speech, OCR, embeddings, reranking, moderation
- prompt caching, compaction, token counting, fallbacks and cancellation
- Rails: Active Record persistence (acts_as_chat), Active Storage, Hotwire streaming, generators and chat UI
- evaluations with datasets, model criteria and Ruby assertions; judgments
- per-attempt cost tracking, instrumentation and OpenTelemetry tracing
- model registry with capabilities, limits and pricing
- fiber-based async; provider batch processing
- code execution sandbox and skills in the Agent Skills format (2.2)

## Limitations

- Doesn't support Ruby versions before 3.2[^1]

## Trust

Overall: 0.23 out of 1.
Signals: backing 0.20, extensibility 0.00.

- created by Carmine Paolino (crmne)

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [OpenAI Ruby SDK](https://talira.ai/catalog/openai-ruby-sdk-8bnqs7b1.md): Official Ruby SDK for the OpenAI API
- [ruby-openai](https://talira.ai/catalog/ruby-openai-3ac0fca8.md): Use the OpenAI API with Ruby

## Sources

[^1]: https://rubygems.org/gems/ruby_llm (checked 20 Nov 2026)
[^2]: https://github.com/crmne/ruby_llm/blob/main/LICENSE (checked 20 Nov 2026)
[^3]: https://github.com/crmne/ruby_llm (checked 20 Nov 2026)
