Repository navigation
feat: multiple keyed endpoints per platform (multi base URL + keys) - #2
Open
andyfan1094 wants to merge 1 commit into
Open
andyfan1094 wants to merge 1 commit into
andyfan1094 wants to merge 1 commit into
Conversation
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
Allow each provider platform (openai / claude / grok / gemini) to register multiple keyed endpoints - e.g. a second sub2api server, a spare group, or a dedicated image-generation key - instead of being limited to one key and one shared base URL per platform.
endpoints[]onProviderProfile: each entry carries its ownname,apiKeyEnv(credential ref), optionalbaseURLoverride (may point at a different gateway), optional wire-protocol override, and its own model catalog.sub2api-openai); every named endpoint registers assub2api-openai-<name>(namevalidated against[A-Za-z0-9_-]+). Endpoint credential refs are stored asSUB2API_<PLATFORM>_<NAME>_API_KEY.(name)suffix when a platform has several endpoints); endpoints without key + models are skipped, so partial/empty forms never surface dead routes.#<endpoint>segment (provider: openai#backup) so analyze/generate can pin a specific endpoint; resolution falls back to whichever endpoint carries the model when omitted.endpointparameter, use that endpoint's stored credential, and probe the endpoint's own base URL when it overrides the global one.Backward compatibility
Existing single-key configs keep working untouched: no
endpoints[]means exactly one route per platform, same route names, same settings shape. The settings schema treats all new fields as optional.Testing
npm run typecheckandnpm run buildpass.sub2api-openai,sub2api-openai-backup,sub2api-openai-other-host; keyless/model-less entries are skipped; baseURL/protocol overrides land in the pi-ai profile; image-tool refs resolve to the named endpoint.