Fix StreamService key detection after free quota is used (#1080)#1081
Merged
tisfeng merged 1 commit intotisfeng:devfrom Feb 2, 2026
Merged
Fix StreamService key detection after free quota is used (#1080)#1081tisfeng merged 1 commit intotisfeng:devfrom
tisfeng merged 1 commit intotisfeng:devfrom
Conversation
StreamService defaults apiKeyRequirement to .userProvided but inherits hasPrivateAPIKey() returning false. When local free quota is exhausted, services like CustomOpenAI/DeepSeek/Groq/Zhipu/GitHub/Gemini/OpenAI incorrectly report a missing key even if the user set one. Override hasPrivateAPIKey() in StreamService to return !apiKey.isEmpty so user-supplied keys are recognized and quota checks don't misfire.
Owner
|
Thanks your PR, looks good |
tisfeng
approved these changes
Feb 2, 2026
tisfeng
pushed a commit
that referenced
this pull request
Feb 2, 2026
StreamService defaults apiKeyRequirement to .userProvided but inherits hasPrivateAPIKey() returning false. When local free quota is exhausted, services like CustomOpenAI/DeepSeek/Groq/Zhipu/GitHub/Gemini/OpenAI incorrectly report a missing key even if the user set one. Override hasPrivateAPIKey() in StreamService to return !apiKey.isEmpty so user-supplied keys are recognized and quota checks don't misfire.
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.
What’s the issue?
QueryService blocks requests when a service requires a user-
provided API key, hasPrivateAPIKey() returns false, and the local
free quota is exhausted.
For StreamService-based providers, apiKeyRequirement() defaults
to .userProvided, but hasPrivateAPIKey() was never overridden, so
it always returned false even when users entered a key. This
triggers the “please register and apply for a personal API key”
error after free quota is used.
Impacted cases
Any service inheriting from StreamService (including
OpenAIService / BaseOpenAIService) can be affected, e.g.:
Root cause
StreamService inherits hasPrivateAPIKey() from QueryService, which
returns false by default, while the API key requirement
is .userProvided.
Fix
Override hasPrivateAPIKey() in StreamService to return !
apiKey.isEmpty, so user-supplied keys are recognized and the quota
guard no longer misfires.
Fixes #1080