apiKeyHelper support for claude code#285
Draft
airhorns wants to merge 2 commits intorivet-dev:mainfrom
Draft
Conversation
Claude Code now stores OAuth credentials in the macOS Keychain (service "Claude Code-credentials") instead of JSON files on disk. This adds a macOS-only fallback that reads from the Keychain via the `security` CLI when the file-based credential paths are not found. Also refactors the OAuth JSON parsing into a shared helper that handles both RFC 3339 string and epoch-millis number expiry formats, matching the Keychain entry's numeric expiresAt field. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
When Claude Code is configured with an apiKeyHelper in ~/.claude/settings.json (e.g. for corporate proxies like Shopify's llm-gateway), treat that as having valid Anthropic credentials so the agents manifest endpoint reports credentials_available=true. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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.
Claude Code supports a credential method that doesn't store an oauth key on disk or an
ANTHROPIC_API_KEYin the environment in the form ofapiKeyHelper. Read more about the settings here: https://code.claude.com/docs/en/settings#available-settingsThis teaches
sandbox-agentto consider claude as having credentials when this setting is configured. Without this change, one can't usesandbox-agentwith claude code when using these kinds of enterprise-friendly cred setups.Assuming that the
apiKeyHelperis present means that we're authed is a little bit wrong, in that the api key helper might be busted somehow or another when you run it. I think that is the same as theANTHROPIC_API_KEYenv var being present but incorrect, so I think its ok to just assume its gonna work like we do for that.