Repository navigation
feat: --base-url for any OpenAI-compatible endpoint - #10
Merged
Merged
Conversation
--base-url (or OPENAI_BASE_URL) now works with any server that speaks the OpenAI chat completions API, not just ones serving OpenAI-style ids. With no OpenRouter key every model goes to the endpoint; with one, only OpenAI-style and openai/-prefixed ids do. Keyless local servers work.
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.
Adds a
--base-urlflag (same asOPENAI_BASE_URL) so a scan can run against any server that speaks the OpenAI chat completions API: Ollama, vLLM, LM Studio, llama.cpp, LiteLLM, Azure, Together, Groq.Before this,
OPENAI_BASE_URLonly applied to ids that looked like OpenAI models (gpt-*,o3-*,openai/*) and only whenOPENAI_API_KEYwas set. A localllama3.1:8bwent to OpenRouter instead.Routing
With a base URL set:
openai/to force it to the endpoint; the prefix is stripped, soopenai/llama3.1:8barrives asllama3.1:8b.OPENAI_API_KEYis needed. Keyless local servers work.Without a base URL, nothing changes.
The CLI rejects a
--base-urlthat isn't an http(s) URL before scanning, and shows the endpoint in the scan configuration box.Behavior change
If you already set
OPENAI_BASE_URLwithout an OpenRouter key, non-OpenAI ids now go to that endpoint instead of to OpenRouter. Before, those calls failed for lack of an OpenRouter key, so nothing that used to work breaks. The e2e test "the models named on screen are the models tested" relied on that failure. It now checks that the requests the mock receives use the models shown on screen.Tests
New e2e tests against the mock server, using ids that don't look like OpenAI's:
--base-urlwith no keys sends every model to the endpoint, and the scan completes as secure.openai/-prefixed ids still reach the endpoint with the prefix stripped.--base-urlis rejected before any request.bun run lint,bun run typecheck,bun test(34 pass) andbun run buildall pass locally.