Skip to content

Add first-class LLMGateway.io provider#822

Open
goianiense wants to merge 1 commit into
crmne:mainfrom
goianiense:feature/821-llm-gateway-provider
Open

Add first-class LLMGateway.io provider#822
goianiense wants to merge 1 commit into
crmne:mainfrom
goianiense:feature/821-llm-gateway-provider

Conversation

@goianiense

Copy link
Copy Markdown

Summary

  • Add a dedicated :llm_gateway provider (modeled on OpenRouter) for LLMGateway.io, an OpenAI-compatible gateway for 35+ upstream providers.
  • Register config options llm_gateway_api_key / llm_gateway_api_base (default https://api.llmgateway.io/v1) so the gateway can be used alongside the real OpenAI provider instead of hijacking openai_api_base.
  • Include chat completions, models catalog parsing, streaming, image generation, and files support, with unit coverage for config, API base resolution, and error parsing.

Closes #821.

Usage

RubyLLM.configure do |config|
  config.openai_api_key = ENV["OPENAI_API_KEY"]
  config.llm_gateway_api_key = ENV["LLM_GATEWAY_API_KEY"]
end

# Gateway and OpenAI work independently
RubyLLM.chat(model: "gpt-4o", provider: :llm_gateway)
RubyLLM.chat(model: "gpt-4o", provider: :openai)

Test plan

  • bundle exec rspec spec/ruby_llm/providers/llm_gateway/parse_error_spec.rb spec/ruby_llm/provider_spec.rb spec/ruby_llm/configuration_spec.rb (25 examples, 0 failures)
  • Smoke test: separate API bases/keys for :llm_gateway and :openai
  • Optional: live chat against LLMGateway.io with LLM_GATEWAY_API_KEY set

Introduce a dedicated :llm_gateway provider modeled on OpenRouter so
users can route through LLMGateway.io without hijacking the OpenAI
provider config. Closes crmne#821.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add LLMGateway.io as a built-in provider

1 participant