ruby_llm: OpenRouter config not working in 1.3.0.rc1
Up until now, I’ve been using OpenRouter via:
RubyLLM.configure do |config|
config.openai_api_key = "..."
config.openai_api_base = "https://openrouter.ai/api/v1"
end
Now that 1.3.0.rc1 has added proper OpenRouter support, I changed it to:
RubyLLM.configure do |config|
config.openrouter_api_key = "..."
end
but it fails with:
'RubyLLM::Connection#ensure_configured!': openai provider is not configured. Add this to your initialization: (RubyLLM::ConfigurationError)
RubyLLM.configure do |config|
config.openai_api_key = ENV['OPENAI_API_KEY']
end
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (10 by maintainers)
I added a rake task to automatically generate
aliases.jsonso we’ll not need to update it manually ever again, solving the issue withgpt-4.1-nanoabove 120526c38a53f29408be2f59453a9b9cc3298548FYI the reason you need the full model id is that nano is not here – https://github.com/crmne/ruby_llm/blob/main/lib/ruby_llm/aliases.json
And provider is optional if you are giving a full model id (which is specific to that provider).
That fails, but this works:
It seems the
providerargument is not actually needed, as this also works:Because a single model (Claude) is available via Anthropic, Bedrock, and OpenRouter. The library needs to know which one you want to use. Once you tell it, it will use the corresponding key(s) you have configured.
Got it! I’ll fix it first thing tomorrow!