# RubyLLM

> A single Ruby framework for building AI applications across all major providers including OpenAI, Anthropic, Gemini, Bedrock, and more.

RubyLLM is an open-source Ruby gem maintained by Carmine Paolino that provides a single, unified interface for interacting with all major AI providers. Released under the MIT License and available on RubyGems, it is described by its author as "battle tested" at Chat with Work, a fully private work AI product. The project has accumulated over 4,000 GitHub stars since its creation in January 2025.

## What It Is

RubyLLM is an AI development library for Ruby that abstracts away the differences between AI provider APIs — OpenAI, Anthropic, Gemini, VertexAI, Bedrock, DeepSeek, Mistral, Ollama, OpenRouter, Perplexity, GPUStack, xAI, and any OpenAI-compatible API — behind one consistent Ruby interface. Developers use it to build chatbots, AI agents, RAG applications, content generators, and multimodal workflows without writing provider-specific client code. The library intentionally keeps its dependency footprint minimal: just Faraday, Zeitwerk, and Marcel.

## Core Capabilities

RubyLLM covers a broad surface area of AI tasks through a clean, expressive API:

- **Chat:** Conversational AI via `RubyLLM.chat` with full message history
- **Vision:** Analyze images, videos, PDFs, CSVs, and arbitrary file types
- **Audio:** Transcribe speech with `RubyLLM.transcribe` and generate it with `RubyLLM.speak`
- **Image generation:** Create images with `RubyLLM.paint`
- **Embeddings:** Generate vector embeddings with `RubyLLM.embed`
- **Moderation:** Content safety checks with `RubyLLM.moderate`
- **Tools:** Let AI call arbitrary Ruby methods via `RubyLLM::Tool`
- **Agents:** Reusable assistants with instructions and tools via `RubyLLM::Agent`
- **Structured output:** JSON schema enforcement via `RubyLLM::Schema`
- **Streaming:** Real-time response chunks via Ruby blocks
- **Extended thinking:** Control, view, and persist model deliberation steps
- **Citations:** Normalized source citations from documents, search, and grounding
- **Batches:** Provider-side batch processing via `RubyLLM.batch`
- **Model registry:** 800+ models with capability detection

## Rails Integration

RubyLLM ships a first-class Rails integration that goes beyond a simple wrapper. Running `bin/rails generate ruby_llm:install` and `bin/rails db:migrate` sets up ActiveRecord-backed chat persistence. The `acts_as_chat` concern turns any model into a persistent conversation. An optional `ruby_llm:chat_ui` generator scaffolds a ready-to-use chat interface at `/chats`. The `ruby_llm:load_models` task (introduced in v1.13) syncs the model registry to the database.

## Architecture and Deployment Model

RubyLLM is a Ruby gem installed via Bundler (`gem 'ruby_llm'`). It runs in any Ruby environment — standalone scripts, Rack apps, Rails monoliths, or background job workers. Async support uses fiber-based concurrency for scaling concurrent AI calls without threads. There is no hosted service or SaaS layer; all API calls go directly from the application to the chosen AI provider using the developer's own API keys.

## Update: Version 1.16.0

The latest stable release is **1.16.0**, published on June 9, 2026. A **2.0 development branch** is actively maintained and accessible at `rubyllm.com/next`, signaling a major version in progress. The repository was last pushed to on June 23, 2026, and shows active issue tracking with 65 open issues and 466 forks, indicating a healthy open-source contributor base.

## Features
- Chat with conversational AI
- Vision: analyze images, videos, and documents
- Audio transcription and speech synthesis
- Image generation
- Embeddings generation
- Content moderation
- Tool calling (let AI call Ruby methods)
- Agents with instructions and tools
- Structured output via JSON schemas
- Streaming responses
- Rails ActiveRecord integration with acts_as_chat
- Fiber-based async concurrency
- Model registry with 800+ models
- Extended thinking support
- Citations from documents and search
- Provider-side batch processing
- Support for 13+ AI providers
- OpenAI-compatible API support

## Integrations
OpenAI, Anthropic, Google Gemini, Google VertexAI, AWS Bedrock, DeepSeek, Mistral, Ollama, OpenRouter, Perplexity, GPUStack, xAI, Azure AI, Ruby on Rails, ActiveRecord, Faraday, Zeitwerk, Marcel, RubyGems

## Platforms
API, CLI, DEVELOPER_SDK

## Pricing
Open Source

## Version
1.16.0

## Links
- Website: https://rubyllm.com
- Documentation: https://rubyllm.com/getting-started/
- Repository: https://github.com/crmne/ruby_llm
- EveryDev.ai: https://www.everydev.ai/tools/rubyllm
