RubyLLM - a single, beautiful Ruby framework for all major AI providers

Lobsters Hottest Tools

Summary

RubyLLM is a unified Ruby framework for interacting with multiple AI providers, supporting chatbots, agents, RAG, and more with a consistent API.

<p><a href="https://lobste.rs/s/ph49qi/rubyllm_single_beautiful_ruby_framework">Comments</a></p>
Original Article
View Cached Full Text

Cached at: 06/24/26, 03:59 PM

# RubyLLM Source: [https://rubyllm.com/](https://rubyllm.com/) ## ![RubyLLM](https://rubyllm.com/assets/images/logotype.svg) A single, beautiful Ruby framework for all major AI providers\. Easily build chatbots, AI agents, RAG applications, content generators, and every AI workflow you can think of\. Battle tested at[![Chat with Work](https://chatwithwork.com/logotype.svg)](https://chatwithwork.com/)*\- Fully private work AI* ## [https://rubyllm.com/#build-a-working-ruby-ai-chat-in-two-minutes](https://rubyllm.com/#build-a-working-ruby-ai-chat-in-two-minutes)Build a working Ruby AI chat in two minutes Using RubyLLM?[Share your story](https://tally.so/r/3Na02p)\! Takes 5 minutes\. --- ## [https://rubyllm.com/#why-rubyllm](https://rubyllm.com/#why-rubyllm)Why RubyLLM? Every AI provider ships their own bloated client\. Different APIs\. Different response formats\. Different conventions\. It’s exhausting\. RubyLLM gives you one beautiful framework for all of them\. Same interface whether you’re using GPT, Claude, or your local Ollama\. Just three dependencies: Faraday, Zeitwerk, and Marcel\. That’s it\. ## [https://rubyllm.com/#show-me-the-code](https://rubyllm.com/#show-me-the-code)Show me the code ``` # Just ask questions chat = RubyLLM.chat chat.ask "What's the best way to learn Ruby?" ``` ``` # Analyze any file type chat.ask "What's in this image?", with: "ruby_conf.jpg" chat.ask "What's happening in this video?", with: "video.mp4" chat.ask "Describe this meeting", with: "meeting.wav" chat.ask "Summarize this document", with: "contract.pdf" chat.ask "Explain this code", with: "app.rb" ``` ``` # Multiple files at once chat.ask "Analyze these files", with: ["diagram.png", "report.pdf", "notes.txt"] ``` ``` # Stream responses chat.ask "Tell me a story about Ruby" do |chunk| print chunk.content end ``` ``` # Generate images RubyLLM.paint "a sunset over mountains in watercolor style" ``` ``` # Create embeddings RubyLLM.embed "Ruby is elegant and expressive" ``` ``` # Transcribe audio to text RubyLLM.transcribe "meeting.wav" ``` ``` # Moderate content for safety RubyLLM.moderate "Check if this text is safe" ``` ``` # Let AI use your code class Weather < RubyLLM::Tool desc "Get current weather" def execute(latitude:, longitude:) url = "https://api.open-meteo.com/v1/forecast?latitude=#{latitude}&longitude=#{longitude}&current=temperature_2m,wind_speed_10m" JSON.parse(Faraday.get(url).body) end end chat.with_tool(Weather).ask "What's the weather in Berlin?" ``` ``` # Define an agent with instructions + tools class WeatherAssistant < RubyLLM::Agent model "gpt-5-nano" instructions "Be concise and always use tools for weather." tools Weather end WeatherAssistant.new.ask "What's the weather in Berlin?" ``` ``` # Get structured output class ProductSchema < RubyLLM::Schema string :name number :price array :features do string end end response = chat.with_schema(ProductSchema).ask "Analyze this product", with: "product.txt" ``` ## [https://rubyllm.com/#features](https://rubyllm.com/#features)Features - **Chat:**Conversational AI with`RubyLLM\.chat` - **Vision:**Analyze images and videos - **Audio:**Transcribe and understand speech with`RubyLLM\.transcribe` - **Documents:**Extract from PDFs, CSVs, JSON, any file type - **Image generation:**Create images with`RubyLLM\.paint` - **Embeddings:**Generate embeddings with`RubyLLM\.embed` - **Moderation:**Content safety with`RubyLLM\.moderate` - **Tools:**Let AI call your Ruby methods - **Agents:**Reusable assistants with`RubyLLM::Agent` - **Structured output:**JSON schemas that just work - **Streaming:**Real\-time responses with blocks - **Rails:**ActiveRecord integration with`acts\_as\_chat` - **Async:**Fiber\-based concurrency - **Model registry:**800\+ models with capability detection and pricing - **Extended thinking:**Control, view, and persist model deliberation - **Providers:**OpenAI, xAI, Anthropic, Gemini, VertexAI, Bedrock, DeepSeek, Mistral, Ollama, OpenRouter, Perplexity, GPUStack, and any OpenAI\-compatible API ## [https://rubyllm.com/#installation](https://rubyllm.com/#installation)Installation Add to your Gemfile: Then`bundle install`\. Configure your API keys: ``` # config/initializers/ruby_llm.rb RubyLLM.configure do |config| config.openai_api_key = ENV['OPENAI_API_KEY'] end ``` ## [https://rubyllm.com/#rails](https://rubyllm.com/#rails)Rails ``` # Install Rails Integration bin/rails generate ruby_llm:install bin/rails db:migrate bin/rails ruby_llm:load_models # v1.13+ # Add Chat UI (optional) bin/rails generate ruby_llm:chat_ui ``` ``` class Chat < ApplicationRecord acts_as_chat end chat = Chat.create! model: "claude-sonnet-4" chat.ask "What's in this file?", with: "report.pdf" ``` Visit`http://localhost:3000/chats`for a ready\-to\-use chat interface\! ---

Similar Articles

BerriAI/litellm

GitHub Trending (daily)

LiteLLM 是一个开源 AI 网关,提供统一接口以 OpenAI 格式调用 100 多个 LLM 提供商,可作为 Python SDK 或自托管代理服务器使用,面向企业级部署。

LLM-as-a-Verifier (GitHub Repo)

TLDR AI

LLM-as-a-Verifier is a general-purpose verification framework that provides fine-grained feedback for AI agents, achieving state-of-the-art performance on benchmarks like Terminal-Bench and SWE-Bench.