The Ruby guide makes the same honest move as the other language guides: there is no nRouter Ruby gem to learn. You add the standard ruby-openai gem β the one Ruby and Rails teams already reach for β and point it at the gateway.
Disclosure: I work on nRouter. The guide is here: https://nrouter.ai/docs/sdks/ruby
Two lines of configuration
Add the gem:
gem "ruby-openai"
Enter fullscreen mode
Exit fullscreen mode
Then build the client with the gateway as its uri_base and your virtual key from the environment:
client = OpenAI :: Client . new ( access_token : ENV . fetch ( "NROUTER_API_KEY" ) , uri_base : "https://api.nrouter.ai/v1" , )
Enter fullscreen mode
Exit fullscreen mode
Calls are plain ruby-openai: client.chat(parameters: { model: ..., messages: [...] }) , and the response is a plain hash you read with response.dig("choices", 0, "message", "content") .β¦