class Riffer::Providers::OpenRouter
OpenRouter provider for the OpenRouter unified gateway (openrouter.ai).
Requires the openai gem to be installed. OpenRouter exposes an OpenAI-compatible Chat Completions endpoint, so this provider reuses the OpenAI Ruby SDK with a base_url override.
The api_key falls back to Riffer.config.openrouter.api_key and then to OPENROUTER_API_KEY.
Constants
- BASE_URL
Public Class Methods
Source
# File lib/riffer/providers/open_router.rb, line 21 def initialize(api_key: nil, **options) depends_on "openai" api_key ||= Riffer.config.openrouter.api_key || ENV["OPENROUTER_API_KEY"] @client = ::OpenAI::Client.new(api_key: api_key, base_url: BASE_URL, **options) end
Initializes the OpenRouter provider.