talira

ruby-openai

Use the OpenAI API with Ruby

open sourceMITself-hostablefree

ruby-openai is a community Ruby gem for the OpenAI API by Alex Rudall, separate from OpenAI's own OpenAI Ruby SDK (the openai gem). Built on Faraday, it covers chat with streaming through a proc, JSON mode, functions, the Responses API, embeddings, batches, files, fine-tunes, vector stores, assistants, image generation, Whisper transcription and Realtime WebRTC sessions, and it can point at Azure OpenAI or OpenAI-compatible APIs such as Ollama, Groq, Deepseek and Gemini. Its support policy says one volunteer maintainer keeps it, with the 8.x line supported; the latest release is 8.3.0 from August 2025.

Problems it solves

  • call OpenAI's chat API from Ruby with streaming through a block
  • point the same Ruby OpenAI client at Ollama, Groq or Deepseek
  • add Faraday middleware such as logging to my Ruby OpenAI calls
  • use Azure OpenAI deployments from a Ruby app
  • keep an existing Rails integration that was written against the ruby-openai gem working

Features

  • chat completions with streaming procs
  • JSON mode and functions
  • Responses API and conversations
  • embeddings, batches, files, fine-tunes, vector stores
  • assistants, threads and runs
  • image generation, edits and variations; moderations; Whisper
  • Realtime WebRTC sessions
  • Azure OpenAI and OpenAI-compatible providers (Ollama, Groq, Deepseek, Gemini)
  • Faraday middleware and configurable logging of errors

Alternatives

The same job

These do what ruby-openai does.

  1. OpenAI Ruby SDK Official Ruby SDK for the OpenAI API
  2. RubyLLM The Ruby AI framework

Compare ruby-openai with the top 3