You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Question] How did you get Anthropic OAuth credentials? #1461
As the title says, I was wondering how did OpenCode manage to obtain OAuth credentials from Anthropic, which are then used to log into the API and enable Claude Code usage.
My apologies if this has already been answered but I haven't been able to find any documentation about this anywhere and the Anthropic documentation doesn't mention any procedure to obtain OAuth credentials.
I'm asking because OpenCode seems to be the only third-party tool that supports using a Claude Pro/Max subscription (other tools like Cline delegate authentication and usage to the Claude Code CLI itself and don't have direct API access).
Does both Anthropic and OpenAI so you can funnel all of your usage through the one gateway which with the internal token system also allows you to monitor usage both in web ui and grafana by model/app for global or specific 5h/7d sessions.
This also makes an alternative to ccusage that does not rely on file storage.
Activity
johanp95 commentedon Aug 4, 2025
Lookng at https://github.com/sst/opencode/tree/dev/packages/opencode/src/auth/anthropic.ts, seems like OpenCode is basically copying Claude-Codes's credential flow. the client-id is the same as can be found in claude-code's cli.js.
rmonvfer commentedon Aug 4, 2025
I guess it makes sense to use the same client-id if there is no way to get one. Thank you!
johanp95 commentedon Aug 7, 2025
There is more to it than just the client ID though. Message me on twitter and I can let you know all the deets - YohaanhP
jiyans commentedon Aug 7, 2025
I was interested in this as well, but I couldn't message you on twitter.. i followed you though
psense-account commentedon Nov 1, 2025
If anyone is interested in how this is done, I've got it all documented with proof-of-concept code:
https://github.com/nsxdavid/anthropic-oauth-max-plan
You can also just follow along in the codebase here, but honestly, the nuances take some explanation.
YlanAllouche commentedon Nov 7, 2025
I guess we've all been working on the same thing.
Here is mine: https://github.com/YlanAllouche/ClaudeBridge
Does both Anthropic and OpenAI so you can funnel all of your usage through the one gateway which with the internal token system also allows you to monitor usage both in web ui and grafana by model/app for global or specific 5h/7d sessions.
This also makes an alternative to
ccusagethat does not rely on file storage.fix(automations): clear stale scheduler install gate (anomalyco#1461)