-
Notifications
You must be signed in to change notification settings - Fork 37
fix: claude oauth by renaming tools on in/out #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: claude oauth by renaming tools on in/out #10
Conversation
- Prefixes tool names with "oc_" in outgoing requests - Strips the "oc_" prefix from tool names in streaming responses Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
608bd96 to
12dbe92
Compare
|
I can confirm this works |
|
|
Here's how to run this patch locally: (since anomalyco/opencode#5957 isn't merged yet, we cannot override built-in plugins so we need to built both opencode and the anthropic plugin to test) Updated (After 0.0.7 got released)Just add ( Archived1. Plugin: Clone and Checkout the PR Branchgit clone https://github.com/anomalyco/opencode-anthropic-auth.git # if not already cloned
cd opencode-anthropic-auth
gh pr checkout 10 # or: git fetch origin fix/claude-oauth-tools && git checkout fix/claude-oauth-tools
bun install2. OpenCode: Modify opencode to Use Local PluginIn - const BUILTIN = ["opencode-copilot-auth@0.0.9", "opencode-anthropic-auth@0.0.5"]
+ const BUILTIN = ["opencode-copilot-auth@0.0.9", "file:///path/to/opencode-anthropic-auth/index.mjs"]3. Run opencodecd /path/to/opencode
bun install
bun dev4. To Run Globallycd packages/opencode && bun run build -- --single
export PATH=$PWD/dist/opencode-darwin-arm64/bin/:$PATH |
|
So, after this, there will be no issue about "This credential is only authorized for use with Claude Code and cannot be used for other API requests."? |
|
Claude bypass written by claude 🤣 |
|
FWIW, renaming the tools to match claude code's tools exactly also fixes it. i.e. use PascalCase for tool names |
|
what are the actual tool names in CC? I feel matching them would be better than a prefix that cna easily blcok again |
So they're creating a signature at their end to verify the client? |
anomalyco/opencode#7410 (comment) It's mostly: |
|
Legendary! |
|
캬 |
|
wow thats fast |
|
This would still be easy to catch server side. [Well, that only works till the lawyers get involved, but still] |
|
Issues with Claude Opus and Oh My Opencode sent me here. Now that it's merged, anyone know how we can test it out with oh my opencode? Pretty new to how all this stuff is connected tbh |
|
if this was the best they could come up with to stop third party users then i think we are safe for a while |
@devxoul you saved my life, thanks |
|
Re: #10 (comment) — you can override the plugin via config now (no core source edits needed):\n\n\n\nThis loads the local plugin without modifying opencode source. |
how do i do this? |
Just add |
Oh yeah, 0.0.7 has released recently so that would work now. |
I'm not finding "opencode.json" but "package.json" |
|
please update in here if someone gets banned using this method |
Fixes Claude Code OAuth token authentication issues by aligning the request shape with what Anthropic's API expects for OAuth tokens. Changes: - Update User-Agent to match Claude CLI format: "claude-cli/VERSION (external, cli)" - Remove fine-grained-tool-streaming beta header (incompatible with OAuth) - Add tool name prefixing with "oc_" prefix to bypass tool validation - Strip prefix from tool names in responses for internal consistency - Prefix tool names in conversation history to match tool definitions The tool name prefixing is necessary because Anthropic's API validates tool names against a known list when using OAuth tokens. By prefixing with "oc_" we can use custom tool names while maintaining compatibility. Inspired by fixes from: - anomalyco/opencode-anthropic-auth#10 - anomalyco/opencode-anthropic-auth#11 Thanks to @anomalyco for the original research and implementation.
@MickBuilder Check your config file locations. |
|
does this actually work? I implemented it and oauth works, however, i can only use Sonnet. Even though I see full list of Anthropic models I can use, no matter which I select (like Opus 4.5), when I asked the model which model it is, it says Sonnet. I ask the same question on Claude Code after selecting Opus 4.5 and the output is Opus 4.5. Anyone else experiencing this? |
|
Is anyone else experiencing this again? (2:30 PM Friday, Jan 9, 2026 UTC) |
|
It worked great for me at first, but my Claude Code OAuth access seems to be blocked again now. |
Same here |
|
Some guy solve that problem do this |
Fixes Claude Code OAuth token authentication issues by aligning the request shape with what Anthropic's API expects for OAuth tokens. Changes: - Update User-Agent to match Claude CLI format: "claude-cli/VERSION (external, cli)" - Remove fine-grained-tool-streaming beta header (incompatible with OAuth) - Add tool name prefixing with "oc_" prefix to bypass tool validation - Strip prefix from tool names in responses for internal consistency - Prefix tool names in conversation history to match tool definitions The tool name prefixing is necessary because Anthropic's API validates tool names against a known list when using OAuth tokens. By prefixing with "oc_" we can use custom tool names while maintaining compatibility. Inspired by fixes from: - anomalyco/opencode-anthropic-auth#10 - anomalyco/opencode-anthropic-auth#11 Thanks to @anomalyco for the original research and implementation.
|
does it still work? |
Summary
oc_in outgoing requestsoc_prefix from tool names in streaming responsesTest plan
Tested with
opencode run -m anthropic/claude-sonnet-4-5and verified tool calls work correctly.