claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] Anthropic API Error: Credential Authorization Restriction

Open kummar opened this issue 1 year ago • 16 comments

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"}]

kummar avatar Sep 23 '25 13:09 kummar

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\"}",

rawestmoreland avatar Sep 23 '25 14:09 rawestmoreland

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)

ksarangmath avatar Sep 23 '25 16:09 ksarangmath

Changing the model to sonnet with /model fixed this for me

JWBWork avatar Sep 23 '25 21:09 JWBWork

@JWBWork You're an officer and a gentleman.

JoshuaMarden avatar Sep 24 '25 09:09 JoshuaMarden

@JWBWork fixed it for me. Thank you

Y2Data avatar Sep 26 '25 03:09 Y2Data

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

JoniUzan avatar Sep 26 '25 12:09 JoniUzan

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

alperensert avatar Sep 28 '25 13:09 alperensert

for the recently released sonnet 4.5, use this instruction to fix it. Tell this to your Claude Code or Codex Cloud


  1. Open .github/workflows/claude.yml. In the Run Claude Code step, set claude_args to --model claude-sonnet-4-5-20250929, preserving every other setting in the workflow.
  2. Open .github/workflows/claude-code-review.yml. In the Run Claude Code Review step, update the claude_args string so it starts with --model claude-sonnet-4-5-20250929 while leaving the quoted --allowed-tools list untouched.
  3. Save both workflow files, commit with a message such as Add model argument to Claude workflows, and push the branch.
  4. Open a PR describing that the general and review Claude workflows now request the Sonnet 4.5 model.

PabloLION avatar Oct 01 '25 13:10 PabloLION

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]

BOLT04 avatar Oct 01 '25 15:10 BOLT04

same here...

haddock-development avatar Oct 05 '25 20:10 haddock-development

Changing the model to sonnet with /model fixed 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.

paultiplady avatar Oct 12 '25 20:10 paultiplady

Changing the model to sonnet with /model fixed this for me

@JWBWork why we need to change the modal to fix this issue?

RimshaKhanSherwani avatar Oct 22 '25 06:10 RimshaKhanSherwani

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.

github-actions[bot] avatar Dec 08 '25 10:12 github-actions[bot]

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.

github-actions[bot] avatar Jan 08 '26 10:01 github-actions[bot]

im facing the same issue just today, same with my brothers and sisters. using opencode too guys.

engrjcrv avatar Jan 09 '26 03:01 engrjcrv

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.

github-actions[bot] avatar Jan 16 '26 14:01 github-actions[bot]