mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 12:22:14 +03:00
When users configured `visionBridgeModel: "gemini/gemini-2.0-flash"` (or any non-Anthropic prefix like `openrouter/...`, `google/...`), every request failed with `Vision API error 401: You didn't provide an API key` from OpenAI. The helper hardcoded `https://api.openai.com/v1` as the base URL and `OPENAI_API_KEY` as the auth header for any model that wasn't `anthropic/*`, so users without an OpenAI key (or who wanted to use Gemini/OpenRouter/OmniRoute self-loop) had no path that worked. This change adds two env vars: - VISION_BRIDGE_BASE_URL — alternate OpenAI-compatible base URL. Priority: VISION_BRIDGE_BASE_URL → legacy OpenAI URL env → api.openai.com (default). - VISION_BRIDGE_API_KEY — alternate API key for that endpoint. Priority: explicit caller arg → VISION_BRIDGE_API_KEY → per-provider env (Anthropic/Google/OpenAI) → OpenAI fallback. Anthropic models (anthropic/*) keep their dedicated `x-api-key` path with the Anthropic env key unchanged — the override only affects the OpenAI-compat branch, since the wire format differs. Operators now have stable paths to: - Route through OmniRoute itself (any registered model works): VISION_BRIDGE_BASE_URL=http://localhost:20128/v1 VISION_BRIDGE_API_KEY=sk-<omniroute-key> - Use Google's Gemini OpenAI-compat endpoint directly: VISION_BRIDGE_BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai - Use OpenRouter directly: VISION_BRIDGE_BASE_URL=https://openrouter.ai/api/v1 Reported by @kapustacool-lgtm. Documented in `.env.example` and `docs/reference/ENVIRONMENT.md`. 11 unit tests cover env precedence and the Anthropic-bypass guarantee. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>