Final summary
What I did
• Opened a comprehensive, Markdown-formatted issue in the SDK repo with findings, citations, and a provider-agnostic OAuth implementation outline (token store + auto refresh + Bearer injection), focused on subscription-based OAuth auth for OpenAI/Anthropic:
◦ Issue:
https://github.com/OpenHands/software-agent-sdk/issues/1514
• Acknowledged your edits in the issue and posted a comment outlining a 2025-focused plan and the clarified subscription OAuth model you described (SDK/CLI initiates OAuth, we use access/refresh tokens to call public endpoints, provider meters against the user’s subscription):
◦ Comment:
https://github.com/OpenHands/software-agent-sdk/issues/1514#issuecomment-3693326569
• Researched 2025 Anthropic sources (Perplexity-style approach, direct docs):
◦ Current Claude docs emphasize x-api-key for standard API surfaces and do not yet provide a canonical statement that consumer subscription OAuth Bearer tokens are accepted directly on standard endpoints:
▪︎ Features/API auth headers (x-api-key):
https://docs.claude.com/claude/reference
▪︎ Files API (still x-api-key):
https://docs.claude.com/id/docs/build-with-claude/files
▪︎ Partner platform auth (Bedrock/Vertex):
https://docs.claude.com/claude/reference/claude-on-amazon-bedrock
◦ Conclusion so far: If Anthropic supports “subs → API” via OAuth in 2025, it appears likely through a provisioning flow that yields API-acceptable credentials for standard endpoints; I haven’t yet found an official doc stating “subscription OAuth bearer tokens may be sent directly to api.anthropic.com.” I’ll continue to look for a definitive, canonical reference.
No code changes
• I did not modify repository code. There is no git diff to review or push.
Checklist against your instructions
• Investigate policy stance for OpenAI/Anthropic: done (with 2025 emphasis; continuing to validate Anthropic’s direct OAuth Bearer stance).
• Outline OAuth auth layer (SDK/CLI flow, JSON token store, refresh, multi-account, security): done (in issue).
• Provide SDK code to use access/refresh tokens: done (provider-agnostic Python reference included in the issue).
• Open an issue with clear Markdown formatting and links: done.
Next steps (proposed)
• Complete Anthropic “subs → API” verification using more targeted queries and update the issue with authoritative 2025 citations (or document that OAuth requires provisioning to API credentials).
• If desired, I can proceed to a draft PR plan:
◦ OpenHands-CLI: OAuth (Auth Code + PKCE) + loopback, secure token storage/refresh, multi-account.
◦ SDK: OAuth-backed request signer (Bearer injection, auto-refresh) alongside existing API-key support.
• Let me know if you prefer incremental updates to the issue as I confirm sources, or a single final addendum once I have Anthropic’s definitive guidance.
<sub>
View full conversation</sub>