// the find
alexrudall/ruby-openai
OpenAI API + Ruby! 🤖❤️ GPT-5 & Realtime WebRTC compatible!
A community-maintained Ruby client for the OpenAI API, wrapping everything from chat completions to Assistants, Realtime WebRTC, and the newer Responses API. It's the de facto choice for Rails developers who want OpenAI integration without rolling their own HTTP layer. Not affiliated with OpenAI officially.
1. API coverage is genuinely broad and up-to-date — Responses API, Conversations API, Realtime sessions, and vector stores are all present, not just chat completions. 2. The Faraday middleware passthrough is a pragmatic decision: you get request logging, proxy support, and observability tool integration without the gem needing to reinvent any of that. 3. VCR cassette-based test suite means specs run without live API calls and the fixture files double as documentation of exactly what the API returns. 4. The `uri_base` override works cleanly for Ollama, Groq, Deepseek, and Gemini — one gem covers the whole OpenAI-compatible ecosystem.
1. `rough_token_count` is a rough approximation, not a real tokenizer — the README even tells you to use tiktoken_ruby instead, which raises the question of why the method exists at all. 2. The response objects are plain Ruby Hashes, so you're writing `response.dig('choices', 0, 'message', 'content')` everywhere — no typed response objects, no autocomplete, no compile-time safety. Fine for scripting, annoying in a larger codebase. 3. No built-in retry logic or rate-limit handling; you get a Faraday error and that's your problem. For anything running in production you'll need to wrap calls yourself. 4. Community-maintained, not official — OpenAI ships breaking changes without coordinating with this gem, and there's been periods in the past where the gem lagged behind new model/API additions.