[Bug] Anthropic API Error: Credential Authorization Restriction
Bug Description ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"This credential is only authorized for use with Claude Code and cannot be used for other API requests."},"request_id":"req_011CTRRgxPidZvEEirG5recn"}
Environment Info
- Platform: darwin
- Terminal: iTerm.app
- Version: 1.0.120
- Feedback ID:
Errors
[{"error":"AxiosError: Request failed with status code 403\n at MN (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:715:1077)\n at Unzip.J0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:716:9955)\n at Unzip.emit (node:events:519:35)\n at Unzip.emit (node:domain:489:12)\n at endReadableNT (node:internal/streams/readable:1701:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:90:21)\n at OQ1.request (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:718:2088)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async KB5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1986:480)\n at async Promise.all (index 0)\n at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1972:6855","timestamp":"2025-09-23T13:41:16.505Z"}]
I'm also seeing this inside the anthropic github actions.
"result": "API Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"This credential is only authorized for use with Claude Code and cannot be used for other API requests.\"},\"request_id\":\"req_011CTRTnR1ym12LUXqdSxo7B\"}",
https://github.com/anthropics/claude-code/issues/8042 https://github.com/anthropics/claude-code/issues/8046 some people have fixed the issue by logging out (/logout) and logging back in others have fixed the issue by switching their model to sonnet (/model)
Changing the model to sonnet with /model fixed this for me
@JWBWork You're an officer and a gentleman.
@JWBWork fixed it for me. Thank you
Im getting this error in GitHub action after Claude set up on code review and when i mention Claude on on issues
the /model solve the error in my cli but not in GitHub action
For @JoniUzan and others experiencing this error during the setting the GitHub Actions Workflow can resolve the issue by modifying the model with claude_args as follows: --model claude-sonnet-4-20250514
for the recently released sonnet 4.5, use this instruction to fix it. Tell this to your Claude Code or Codex Cloud
- Open
.github/workflows/claude.yml. In theRun Claude Codestep, setclaude_argsto--model claude-sonnet-4-5-20250929, preserving every other setting in the workflow. - Open
.github/workflows/claude-code-review.yml. In theRun Claude Code Reviewstep, update theclaude_argsstring so it starts with--model claude-sonnet-4-5-20250929while leaving the quoted--allowed-toolslist untouched. - Save both workflow files, commit with a message such as
Add model argument to Claude workflows, and push the branch. - Open a PR describing that the general and review Claude workflows now request the Sonnet 4.5 model.
We have the same error, but the default model for us was claude-3-5-haiku-20241022. We are using this version: anthropics/[email protected]
same here...
Changing the model to sonnet with
/modelfixed this for me
I got this error when i tried to switch from sonnet to opus; is there a solution to this error that lets me use opus instead?
I did see this warning: Approaching Opus usage limit · /model to use best available model but I'd hope for a different error if I hit my Opus token limit.
Changing the model to sonnet with
/modelfixed this for me
@JWBWork why we need to change the modal to fix this issue?
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
im facing the same issue just today, same with my brothers and sisters. using opencode too guys.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.