fix: add models.providers.*.apiKey fallback to getApiKey()#179
Closed
catgodtwno4 wants to merge 1 commit intoMartian-Engineering:mainfrom
Closed
fix: add models.providers.*.apiKey fallback to getApiKey()#179catgodtwno4 wants to merge 1 commit intoMartian-Engineering:mainfrom
catgodtwno4 wants to merge 1 commit intoMartian-Engineering:mainfrom
Conversation
…eApiKey() getApiKey() and requireApiKey() were missing the models.providers config fallback that complete() already had (line 1217-1231). This caused 401 auth errors for providers like MiniMax whose API keys are stored in openclaw.json under models.providers.<provider>.apiKey rather than in process.env or keychain. The fix adds the same provider config lookup as the last fallback step in both getApiKey() and requireApiKey(), matching the existing behavior in complete(). Fixes: LCM 401 auth errors when summaryProvider uses a proxy provider (e.g. MiniMax via api.minimaxi.com/anthropic) with keys only in config.
Author
|
Closing — v0.5.1 already contains |
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
Relates to #177 — LCM summarizer cannot resolve provider credentials when API key is configured via
models.providers.*.apiKeyrather than environment variables or auth profiles.Problem
getApiKey()andrequireApiKey()walk a fallback chain:modelAuth.getApiKeyForModel()resolveApiKey(provider, readEnv)→ env vars →authProfilesBut they never read
models.providers.<provider>.apiKeyfrom the config. The main model'scomplete()function (line ~1217) has this fallback, but the LCM summarizer'sgetApiKey()does not.Impact
When a provider's API key is only configured in
models.providers.*.apiKey(common for non-built-in providers like MiniMax), the main model works fine but LCM compaction fails with 401.Adding the env var to launchd plist doesn't fully help because
getApiKey()may use a startup-time snapshot ofprocess.env.Fix
Add a 6th fallback layer to
getApiKey()andrequireApiKey()that readsmodels.providers.<provider>.apiKeyfrom the config, matching thecomplete()function's behavior.Verified On
models.providers.minimax.apiKey