OpenGenerativeUI icon indicating copy to clipboard operation
OpenGenerativeUI copied to clipboard

Support OpenAI-compatible gateways (OpenRouter) via vendor/model names

Open kannan983 opened this issue 1 month ago • 0 comments

Problem

build_model only accepts claude-*, gpt-* and chat-latest. OpenAI-compatible gateways such as OpenRouter use vendor/model names (e.g. deepseek/deepseek-chat, anthropic/claude-sonnet-...), so they're rejected at startup with "LLM_MODEL must name a supported provider", even though ChatOpenAI can already talk to them.

Proposal

Route LLM_MODEL values containing / through ChatOpenAI as well. The OpenAI SDK already reads OPENAI_BASE_URL, so a self-hoster sets:

OPENAI_API_KEY=<gateway key>
OPENAI_BASE_URL=https://openrouter.ai/api/v1
LLM_MODEL=deepseek/deepseek-chat

No new settings or dependencies. Existing prefixes behave as before. BYOK browser keys keep using OpenAI, since request_model pins https://api.openai.com/v1.

This makes it easy to self-host with cheaper or alternative models. I have a small PR ready (factory change, a test, and .env.example/docs updates) and am happy to adjust it.

kannan983 avatar Oct 10 '26 08:10 kannan983