Invalid API Model Name in Request

Resolved 💬 25 comments Opened Jun 4, 2025 by sskw-ugo Closed Jun 5, 2025
💡 Likely answer: A maintainer (dicksontsai, collaborator) responded on this thread — see the highlighted reply below.

Bug Description
Fail to call API with the error below\
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"system: Invalid model name"}}

Environment Info

  • Platform: linux
  • Terminal: vscode
  • Version: 1.0.10
  • Feedback ID: 47bd7819-a6e7-46da-a512-c9ef5a4715b2

Errors

[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"system: Invalid model name\"}}\n    at Y5.generate (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1336:12578)\n    at Qw.makeStatusError (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1351:2082)\n    at Qw.makeRequest (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1351:5257)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async Xz2.Me.showErrors (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:20217)\n    at async Me (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:12044)\n    at async Xz2 (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:20080)\n    at async file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:16842\n    at async Yo1 (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:5204)\n    at async Ld (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:16812)","timestamp":"2025-06-04T22:53:59.838Z"},{"error":"Error: Another process is currently installing an update\n    at RH1 (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1923:1587)\n    at file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2217:6307\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-06-04T22:54:10.370Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"system: Invalid model name\"}}\n    at Y5.generate (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1336:12578)\n    at Qw.makeStatusError (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1351:2082)\n    at Qw.makeRequest (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1351:5257)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async Xz2.Me.showErrors (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:20217)\n    at async Me (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:12044)\n    at async Xz2 (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:20080)\n    at async file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:16842\n    at async Yo1 (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:5204)\n    at async Ld (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:16812)","timestamp":"2025-06-04T22:54:17.961Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"system: Invalid model name\"}}\n    at Y5.generate (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1336:12578)\n    at Qw.makeStatusError (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1351:2082)\n    at Qw.makeRequest (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1351:5257)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async Xz2.Me.showErrors (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:20217)\n    at async Me (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:12044)\n    at async Xz2 (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:20080)\n    at async file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:16842\n    at async Yo1 (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:5204)\n    at async Ld (file:///home/sskw/.nvm/versions/node/v22.9.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1614:16812)","timestamp":"2025-06-04T22:56:01.590Z"}]

View original on GitHub ↗

25 Comments

dicksontsai collaborator · 1 year ago

Thanks for your report. Can you share the output of /status (related to the model and account type, redact your email and other sensitive info) before and after your error?

Also, if you're on a Claude Pro plan, you should try using 1.0.11 instead.

gunpal5 · 1 year ago

Try to switch your model to sonnet with pro plan

marco-serenelli · 1 year ago

I can confirm that switching to sonnet works!
Thanks @gunpal5

abhagsain · 1 year ago
Try to switch your model to sonnet with pro plan

!Image

It's not working. I'm on the @anthropic-ai/claude-code@1.0.11

!Image
@dicksontsai

gunpal5 · 1 year ago

@abhagsain
Exit your current session, then type in:


claude --model claude-sonnet-4-20250514

abhagsain · 1 year ago
@abhagsain Exit your current session, then type in: claude --model claude-sonnet-4-20250514

It's working now. Thank you 🫡

dicksontsai collaborator · 1 year ago

I will close this bug out with a couple recommendations:

  1. To use a Claude Pro subscription with Claude Code, you must be on version 1.0.11 or later.
  2. Once you are on version 1.0.11 or later, you will need to run /logout then /login for your Claude Pro subscription to take effect properly.
  3. If the above fails, claude --model claude-sonnet-4-20250514 is a workaround, but we do not recommend it, since it masks the underlying issue that your local account state is incorrect.
kenn · 1 year ago

I get the same error with Cursor / Mac.

Claude Code v1.0.16

jpmottin · 1 year ago

Same error on Claude Code v1.0.34 (MacOS), the fix is still working (using model "claude-sonnet-4-20250514")

Mazyod · 1 year ago

~I'm on the latest version of Claude Code (1.0.35) and I have a Pro subscription, yet the problem persists. When I switch to API pricing it works without a hitch. I uninstalled and reinstalled Claude Code without any luck...~

~It worked a week back, I think it was using the global npm installation, and might've broken when using the recommended local installation.~

Opened a new terminal session to double check /status and /doctor output, everything works fine now without overriding any models.

socialmediarefugee · 1 year ago

Unfortunately, I also have this error on a fresh, first time installation of Claude Code after upgrading my account. It is worked around by claude --model <aformentionedmodelstring> . This is a VM so, I had to install npm first and then Ubuntu required me to use sudo to install claude. Afterwards, running claude doctor prompted me to move the claude install to my home folder. Not sure if any of this is useful.

csmarku · 1 year ago

After my Max plan expired, I chose to downgrade from the Max plan to the Pro plan, and the problem occurred

aleybovich · 1 year ago

I can confirm the problem after downgrading from Max to Pro. I am on Mac

claude --version
1.0.35 (Claude Code)

The workaround works for now but please find a real solution

Mistic92 · 1 year ago

I'm on pro and today I have issues. For /model I see this

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"system: Invalid model name"}}
│  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 for up to 50% of usage limits, then use Sonnet 4✔                                                               │
│     2. Opus                   Opus 4 for complex tasks · Reaches usage limits ~5x faster                                                             │
│     3. Sonnet                 Sonnet 4 for daily use    
╰─ claude --version                                                                                                                                  ─╯
1.0.40 (Claude Code)
att3 · 1 year ago
I'm on pro and today I have issues. For /model I see this `` API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"system: Invalid model name"}} ` ` │ 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 for up to 50% of usage limits, then use Sonnet 4✔ │ │ 2. Opus Opus 4 for complex tasks · Reaches usage limits ~5x faster │ │ 3. Sonnet Sonnet 4 for daily use ` ` ╰─ claude --version ─╯ 1.0.40 (Claude Code) ``

same. but this workaround still works:
claude --model claude-sonnet-4-20250514

But note what dick above said
If the above fails, claude --model claude-sonnet-4-20250514 is a workaround, **but we do not recommend it**, since it masks the underlying issue that your local account state is incorrect.

cagnulein · 1 year ago

i also have the issue on windows

sandriverfish · 1 year ago

i have the same issue on windows

API Error: 400 {"type":"error","error":{"type
    ":"invalid_request_error","message":"system: 
    Invalid model name"}}
beesandtrees · 1 year ago

run /status and then follow whatever instructions it gives you. After downgrading I was seeing an npm mismatch issue but running /status and following the prompts fixed it.

co-marat-y · 1 year ago

Fails for me on Mac when calling Opus. Using Max account. Started today the moment I've started new session. Worked fine at least on Friday, can't really remember when I've started the old session, but definitely last week. Works fine with Sonnet.

are you here? ⎿  API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"system: Invalid model name"}}
thefourthhorseman · 1 year ago

For info i had the same issue today after 3 weeks of intense use without problem. Here is my config:
Claude Code Status v1.0.43
Model • /model
L Default Opus 4 for up to 50% of usage limits, then use Sonnet 4 (currently Opus)

I then switched to claude-sonnet-4-20250514 and the problem went away.

dicksontsai collaborator · 1 year ago

@co-marat-y and @thefourthhorseman , can you email me (dickson@anthropic.com) the email and org info you see when you run /status? Assuming you have already run /logout then /login, then what you have seen is unexpected.

dicksontsai collaborator · 1 year ago

Claude Pro subscriptions can only access Sonnet in Claude Code.

xalil8 · 11 months ago

shut close the claude code and run it back it solved my problem

ekhc · 11 months ago

I have the same problem on Pro Max subscription

All of a sudden I get API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"system: Invalid model name"}}

Claude Code Status v1.0.60

L Session ID: 138a4664-90a6-4237-a4b2-3d3e0be86a9d

Working Directory

MCP servers • /mcp
✔ zen

Account • /login
L Login Method: Claude Max Account
L Organization:
L Email:

Memory • /memory
L project: CLAUDE.md

Model • /model
L claude-opus-4-0

I've also tried logging out and logging in and I can only get it to work when I specify the model name

I've also tried uninstalling and installing

github-actions[bot] · 11 months ago

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.