feat: add configurable base URL for LiteLLM proxy support#72
Open
RheagalFire wants to merge 1 commit into
Open
feat: add configurable base URL for LiteLLM proxy support#72RheagalFire wants to merge 1 commit into
RheagalFire wants to merge 1 commit into
Conversation
Author
|
cc @dabit3 |
Author
|
@dabit3 do you have any update on this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OPENAI_BASE_URLenv var, enabling routing through LiteLLM or any OpenAI-compatible proxy.gpt52/gpt5Minikeys), so users can use LiteLLM model IDs likeanthropic/claude-3-5-sonnet.Motivation
Currently
gpt.tshardcodeshttps://api.openai.com/v1/chat/completions. Users who want to use other providers (Anthropic, Azure, Bedrock, Groq, local Ollama, etc.) can't without modifying source code. By making the base URL configurable, users can point at a LiteLLM proxy that routes to 100+ providers through a single endpoint.Changes
server/src/chat/gpt.ts- extractedbaseUrlfromOPENAI_BASE_URLenv var (defaults tohttps://api.openai.com/v1), usebaseUrlin fetch URL instead of hardcoded string. Also falls back to rawmodelvalue if not found in the models map, so arbitrary model IDs work.Tests
Live E2E - streaming via LiteLLM proxy routing to Claude Sonnet 4.6:
Streaming SSE chunks parse correctly through the same code path in
gpt.ts.Risk / Compatibility
OPENAI_BASE_URLset, defaults tohttps://api.openai.com/v1(existing behavior).Example usage
Start a LiteLLM proxy:
Devin Review