Skip to content

apiKeyHelper support for claude code#285

Draft
airhorns wants to merge 2 commits intorivet-dev:mainfrom
airhorns:api-key-helper-support
Draft

apiKeyHelper support for claude code#285
airhorns wants to merge 2 commits intorivet-dev:mainfrom
airhorns:api-key-helper-support

Conversation

@airhorns
Copy link
Copy Markdown

Claude Code supports a credential method that doesn't store an oauth key on disk or an ANTHROPIC_API_KEY in the environment in the form of apiKeyHelper. Read more about the settings here: https://code.claude.com/docs/en/settings#available-settings

This teaches sandbox-agent to consider claude as having credentials when this setting is configured. Without this change, one can't use sandbox-agent with claude code when using these kinds of enterprise-friendly cred setups.

Assuming that the apiKeyHelper is 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 the ANTHROPIC_API_KEY env var being present but incorrect, so I think its ok to just assume its gonna work like we do for that.

airhorns and others added 2 commits March 20, 2026 08:01
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]>
@airhorns airhorns marked this pull request as draft March 26, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant