Rails + OpenAI API — Build a Streaming Chat Interface with Turbo
ruby
dev.to
You've got Rails down. You've got Hotwire, Stimulus, and background jobs wired up. Now let's wire in actual AI. This post builds a working chat interface that streams OpenAI responses in real-time using Turbo Streams. No JavaScript frameworks. No React. Just Rails doing what Rails does best. What We're Building A simple chat UI where users type messages and get AI responses streamed word-by-word. The kind of thing you'd see in ChatGPT, but built with Rails in under 100 lines of code