All posts
Build a chatbot in Rails — Hotwire streaming
Tutorials 10 min read· 11 Aug 2026· By Tutorials

Build a chatbot in Rails — Hotwire streaming

Turbo Streams + TokenBaazar for a Ruby-native chat UI.

Rails 7's Turbo Streams pair beautifully with LLM streaming. Broadcast chunks to a partial as they arrive.

ruby
client = OpenAI::Client.new(access_token: ENV["TB_KEY"], uri_base: "https://tokenbaazar.in/api/public/v1")
client.chat(parameters: { model: "openai/gpt-5.4-mini", messages: msgs, stream: ->(chunk) { broadcast(chunk) } })

Ready to build?

Grab a key, keep your OpenAI SDK, and pay in INR.

Start free