We are using OpenAI API using the fantastic RubyLLM gem from @paolino.
Build AI features the Ruby way
RubyLLM is the Ruby-native AI framework. Work with models, tools, and agents through one consistent API, in plain Ruby or Rails.
RubyLLM is the Ruby-native AI framework. Work with models, tools, and agents through one consistent API, in plain Ruby or Rails.
Build with the models you want. Move between hosted and local providers without rewriting your application, or connect an OpenAI-compatible endpoint.
chat = RubyLLM.chat(model: "claude-opus-5")
chat.ask "Hello!"
Browse models and pricing · Track usage and costs
Scaffold a provider gem with the same infrastructure as RubyLLM: configuration, tests, release setup, and a model registry that plugs into RubyLLM at runtime. Reuse a supported protocol without writing protocol code.
Provider gem guideAsk a question, then ask again. The chat keeps the conversation history, so every follow-up has context.
Chat guidePass a block to display the response as it arrives, in your terminal or a Rails view.
Streaming guideAsk about an image, a recording, or a PDF. Pass local paths, URLs, or several files at once with with: and RubyLLM prepares them for the model.
Describe a tool in a Ruby class and implement execute. RubyLLM runs the tool calls and sends the results back to the model.
Describe a Model Context Protocol server in a Ruby class. Its tools become the model's tools, and you choose which ones it sees.
MCP client guideDefine the fields you want in a Ruby schema. Read the result as a Hash with response.parsed.
Give an agent its model and instructions in a Ruby class. Create an instance whenever you need it.
Agents guideRun your agent against a dataset of questions and expected answers. RubyLLM checks correctness by default. Use the same evaluation from Ruby, RSpec, Minitest, or Rake.
Evaluations guideAgents, evaluations, workflows, RAG, images, audio, and video. Built in, with usage tracking, OpenTelemetry tracing, and Rails integration to bring them into your app.
class IssueRefund < RubyLLM::Tool
description "Issues a refund for an order"
requires_approval
def execute(order_id:) = Refunds.issue!(order_id)
end
chats = documents.map do |doc|
RubyLLM.chat(model: "claude-sonnet-5")
.with_instructions("Summarize in one paragraph.")
.ask_later(doc.text)
end
batch = RubyLLM.batch(chats)
chat = RubyLLM.chat(model: "claude-sonnet-5")
.with_caching
chat.with_instructions(File.read("review.md"))
.cache_until_here
chat.ask "Review this diff", with: "large_diff.patch"
response = RubyLLM.chat
.with_provider_tools(:web_search)
.ask "What's the latest stable Ruby? Cite sources."
response.citations
documents = ["Ruby is expressive", "Python uses indentation"]
embeddings = RubyLLM.embed(documents)
ranked = RubyLLM.rerank("Ruby language", documents, model: "rerank-v3.5")
class Urgency < RubyLLM::Judge
model "jev-latest"
probability :urgent, "Does this need action today?"
end
Urgency.judge("My account is locked!").urgent.probability
response = chat.ask "Explain embeddings"
response.tokens.output
response.cost.total
transcript = RubyLLM.transcribe "meeting.wav"
RubyLLM.speak(transcript.text).save "transcript.mp3"
document = RubyLLM.ocr "scanned-contract.pdf"
puts document.markdown
RubyLLM.paint "a sunset over mountains in watercolor style"
RubyLLM.animate "a paper boat sailing down a rainy gutter"
RubyLLM.moderate("Some user-generated content").flagged?
RubyLLM.chat(model: "gpt-5.6-luna")
.with_fallbacks("claude-sonnet-5")
.ask("Explain Ruby blocks")
Coordinate agents with workflows, give them memory, and resume their work across jobs and deploys. Use separate configurations for each tenant and retries when requests fail. Follow requests with instrumentation, or explore community gems for monitoring dashboards.
Save conversations with Active Record and stream replies with Hotwire. The generators give you a working chat UI. Watch the two-minute demo.
chat = Chat.create! model: "claude-opus-5"
chat.ask "What's in this file?", with: "report.pdf"
bin/rails generate ruby_llm:agent Support
bin/rails generate ruby_llm:tool Weather
bin/rails generate ruby_llm:schema Product
Keep your agents, tools, and schemas in app/. Store files with Active Storage and write your prompts in ERB templates. Use Turbo Streams to show replies and Active Job to run agents in the background.
The RubyLLM gem includes a skill for your coding agent. Give it the API, examples, and Rails conventions that match your application.
Run this from your application after installing RubyLLM. Choose your coding assistant when prompted. Skill setup and updates
Used in production by the teams behind these products.
Using RubyLLM? Get featured or Sponsor us
Their support helps fund RubyLLM's development. Thank you for investing in AI for Ruby.
We are using OpenAI API using the fantastic RubyLLM gem from @paolino.
Our Langgraph agent was failing. I took a gamble and rebuilt it using RubyLLM. Not only was it far simpler, it performed better.
It feels natural. At Yuma, serving over 100,000 end users, our unified AI interface had accumulated so much cruft. RubyLLM is so much nicer than all of that.
We got our proof of concept up in one day and the first beta in about a week. Really impressive.
Most tools add layers. This one removes them. It keeps the mental load low.
The speed of development and the closest thing to the AI SDK in JavaScript land. Easiest Rails integration.
Multi-provider support. Agentic loop support. Can we sponsor?
I replaced my internal provider implementation with RubyLLM and it just worked nicely. Deleted a lot of code.
Ruby-esque DSL and the right level of abstraction: composable, flexible on architecture, opinionated on lower-level implementation.
Love deleting code when adding a library, and love the thought that goes into the gem.
RubyLLM is pretty much the devise of this generation. Adding it to any application is pretty much a no-brainer.
Love how Ruby-like it feels. The DSL is incredibly intuitive and follows all the conventions I would expect.
RubyLLM is awesome, easy and intuitive. You should try it, even if you don’t work with Ruby.
If you can find a better Ruby AI library than RubyLLM, I will only write JavaScript for the rest of the year!
We built our own quick and dirty wrapper, then your project came up and rocked it.
Implementation-agnostic access to models helps us simplify our flow and experiment with agentic systems.
When a tool removes noise instead of adding it, you get to stay focused on the real work.
Super easy way to start adding magic to our app. Love the speed of improvements.
Just having a framework to structure all our LLM processes is gigantic value. Tool integration works like a charm.
It just works. I do not want to keep dealing with wrappers and fast-moving provider changes.
I delivered a lot of value to my customers because of your work.
Letting someone else manage the fast-moving infrastructure of the LLM API landscape allowed me to focus on applications.
Really solid overall, well thought out, and seamless across Rails model-backed chats and one-off chats.
My clients and my clients' clients are very happy because we can iterate and improve our system quickly.
RubyLLM made the future of Ruby and AI feel easier, more accessible, and completely within reach.
Foundational tooling for working with AI in Ruby and Rails applications.
I’m kinda fitting RubyLLM into all of my projects.
Using RubyLLM? Share your story! Takes 5 minutes.