OmniscioGuidesCouldn't confirm model with the API
Claude Code: Couldn't confirm model with the API
This one arrives when a program switches models for you, through the Agent SDK or an app that runs the Claude Code CLI such as the Desktop app. A switch you type with /model produces a different message when it fails. The CLI is the claude command, the Agent SDK is Anthropic's library for driving it from your own code, and an endpoint here is the address your requests go to, Anthropic's by default.
Last checked against Anthropic's documentation on November 26, 2026. By the Omniscio team. Updated .
What is the exact message?
Couldn't confirm model "claude-sonnet-5" with the API. Try again, or run /model to see available models.Anthropic writes claude-sonnet-5 as the example. Yours names the model that was being switched to.
In a session the Desktop app starts for you, the same message ends at Try again. without the /model hint.
What does it mean?
Something asked Claude Code to switch models, and Claude Code asks your API endpoint to confirm the model ID before it commits. Anthropic says this message means that request got no answer within 15 seconds.
Two things follow from that. The switch did not happen, so the session keeps its current model. And the failure is about the answer, not about the name: a model that does not exist on your endpoint produces a different refusal with its own wording.
Who asks for the switch narrows it down. Anthropic names the Agent SDK's setModel() method and apps that run the Claude Code CLI for you, such as the Desktop app.
How do I fix it?
- Switch to the model again through the same app or SDK call. Anthropic's first step, and the right one when the cause was a single slow answer.
- If it keeps failing, check the path to your endpoint. Anthropic's second step is to confirm Claude Code can reach your API endpoint, because a blocked or slow connection produces this without anything wrong with the model. The connection errors guide is the one for that check.
- On a gateway or proxy, confirm it answers a model request promptly. A gateway that holds requests until they complete is one reason a 15-second confirmation never arrives.
Which model-switch messages are not this one
- A 429 or a 5xx with
model not changed. The message readsAPI error: 429 <the server's explanation> · model not changed. That is the same confirmation request refused with a reason, and the middle of the message is the server's status and explanation. - Model not found. Usually the endpoint saying it has no such model, though a name that cannot be a model ID at all, such as one with spaces, gets the same message from Claude Code itself.
- Model is restricted by your organization's settings. The name exists and policy refuses it.
The surrounding message set is on the guide to models that do not show up or are refused.
How do I know it is fixed?
- The switch completes, and the model shown in the session or in
/statusis the one you asked for. - Repeating the switch a second time succeeds when the cause was a transient timeout.
- If the cause was the connection, a plain prompt in a new session is answered normally at the same moment.
Where these answers come from
- Anthropic's error reference, read November 26, 2026: the message, the 15-second deadline, who triggers the switch, the shorter Desktop-app form, and the fix steps.
- the sibling entry, read November 26, 2026: the same confirmation request refused with a status and the server's explanation.
Common questions
Did my model change anyway?
No. Anthropic says the session keeps its current model when this appears, so the switch did not happen and you are still on the model you were using.
Why does Claude Code check a model name with the API at all?
Because a name a client passes may not exist on the endpoint in front of it. Anthropic describes this as the request that confirms the model ID with your API endpoint, and it is the same check that produces the other model-switch refusals with their own wording.
What is the 15 seconds about?
It is the deadline for that confirmation request. Anthropic says the message appears when the request got no answer within 15 seconds, so a slow or blocked path to the endpoint produces it without anything being wrong with the model.
Why is my message shorter than the one on this page?
In a session the Desktop app starts for you, Anthropic says the message ends at Try again. and leaves out the /model hint. Same failure, fewer words.