[Bug] Anthropic API Credential Restriction Preventing API Requests
Bug Description I always got this message when request to do something: "This credential is only authorized for use with Claude Code and cannot be used for other API requests"
Environment Info
- Platform: darwin
- Terminal: WarpTerminal
- Version: 1.0.120
- Feedback ID: d283f24e-36b3-445f-a47c-2a3cd427c3fd
Errors
[{"error":"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_011CTQmv1MVzrMnxDP9yRrLF\"}\n at i9.generate (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:992:2412)\n at IP.makeStatusError (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1009:2131)\n at IP.makeRequest (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1009:5344)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async RJB.ZI1.showErrors (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:29907)\n at async ZI1 (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:18054)\n at async RJB (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:29690)\n at async file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:24439\n at async aq0 (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:4362)\n at async u01 (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:24409)","timestamp":"2025-09-23T05:24:32.974Z"},{"error":"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_011CTQmwFaHqwWFkrKLKXHox\"}\n at i9.generate (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:992:2412)\n at IP.makeStatusError (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1009:2131)\n at IP.makeRequest (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1009:5344)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async RJB.ZI1.showErrors (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:29907)\n at async ZI1 (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:18054)\n at async RJB (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:29690)\n at async file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:24439\n at async aq0 (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:4362)\n at async u01 (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:24409)","timestamp":"2025-09-23T05:24:49.873Z"},{"error":"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_011CTQnAR1BkGSfwnuM36VMN\"}\n at i9.generate (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:992:2412)\n at IP.makeStatusError (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1009:2131)\n at IP.makeRequest (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1009:5344)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async RJB.ZI1.showErrors (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:29907)\n at async ZI1 (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:18054)\n at async RJB (file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:29690)\n at async file:///Users/macbookpro16m2max/.nvm/versions/node/v22.17.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1919:24439\n at async aq0 (file:///Users/macboo
Note: Error logs were truncated.
started this morning
same here
Windows VSCode
Using Claude Code
> claude doctor ⎿ 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_011CTQxWurzPBesaHzT67FW6"}
UPD: relogin helped
I've tried running claude setup-token again and the issue still persists. Started this morning for me too.
Yes, I see the same error. Yesterday it worked fine.
I see this error (Mac VSCode, using claude code)
Seems to be affecting zed through ACP too.
My experience is that when Claude fixed Claude App and API connectivity errors, certain users are required to re-anthentic their account but the API error didn't prompt that. The workaround is to run claude /login
My experience is that when Claude fixed Claude App and API connectivity errors, certain users are required to re-anthentic their account but the API error didn't prompt that. The workaround is to run
claude /login
This worked for me. Just re-login.
My experience is that when Claude fixed Claude App and API connectivity errors, certain users are required to re-anthentic their account but the API error didn't prompt that. The workaround is to run
claude /loginThis worked for me. Just re-login.
Yes, work for me too with re-login.
Not for me. After Re-Login it's the same
Still failing after claude setup-token
still failing after re-login here, but I still had an export for an existing CLAUDE_CODE_OAUTH_TOKEN. Once I removed that export and tried "claude /login" it worked for me.
Also affects the Claude GitHub integration for PR reviews
Hi, also fixed with claude /login, thanks
Also having the problem seems today with OpCode (name was 'Claudia' before), re-logged in without any better result. It seems I can still use Claude Code by selecting Claude Sonnet 4 but not anymore using Claude Opus 4.1 where I do have this error 400.
Confirming claude /login fixes this problem for me in Claude Code.
Hi, Confirming as well that claude /logout and then claude /login fixes in Claude Code.
I can confirm that logging out and then back in (claude /logout and then claude /login) resolved the issue.
By the way, before it was fixed, I had access to Opus 4.1 despite being only on the Pro plan. Now back to normal.
I found the cause of the problem, because after the claude code update, the recommended configuration was updated, but this recommended configuration is not applicable to Pro subscribers. You can use the /model command to see the model currently used by Claude Code, which will output:
│ Select Model │
│ Switch between Claude models. Applies to this session and future Claude │
│ Code sessions. For custom model names, specify with --model. │
│ │
│ 1. Default (recommended) Opus 4.1 for up to 50% of usage limits, │
│ then use Sonnet 4 │
│ 2. Opus Opus 4.1 for complex tasks · Reaches usage │
│ limits faster │
│ ❯ 3. Sonnet Sonnet 4 for daily use ✔ │
│ 4. Opus Plan Mode Use Opus 4.1 in plan mode, Sonnet 4 │
│ otherwise
The default configuration uses the Opus 4.1 model, which is not available for the pro subscription, which is also the root cause of the error. Select "3. Sonnet", problem solving.
@zorth44 Thank you, this works! So it's only a problem for Pro users.