Skip to content
Mastering Claude

Home / The Claude API for builders

The Claude API for builders9 minApplication

Choosing a model, switching models, and handling a refusal

The choice of a model is a trade-off between quality, speed and cost that gets revisited with every new generation, and a refusal returned by a safety classifier is handled as a normal case of the protocol, not as a failure.

Claude Sonnet 5 is billed at the price announced as temporary at this model's launch. That price was due to rise on a schedule fixed in advance, reverting to a higher standard rate. That rise did not happen: the launch price became the permanent price, with no new schedule announced. Choosing a model means choosing a point on three axes, response quality, speed and cost per token, and that point shifts with every new generation without warning.

An identifier without a date is already the reference

For a long time, the prudent practice was to pin a dated identifier in production, so as not to suffer a silent change the day the generic identifier came to point at a new model. Starting with generation 4.6, this precaution becomes lighter for the models concerned: every undated identifier from this generation and later already designates a fixed production snapshot. This rule does not hold for models earlier than generation 4.6, including claude-haiku-4-5, where the undated identifier remains a simple alias pointing to a separate dated snapshot. Among the models currently active, claude-fable-5-1 is the most recent and most capable in the range, claude-fable-5 remains active but moves to legacy model status, and claude-opus-5, claude-sonnet-5 and claude-haiku-4-5 are among the most used, without exhausting the full inventory, kept up to date on Anthropic's deprecations page. An older model in the Opus family has already stopped responding on the platforms operated by Anthropic, the timeline figure below situates this milestone. Comparing two models before migrating remains a useful move, but it bears on quality and cost, more than on the risk of an identifier changing behind your back.

Refusal, a normal case of the protocol

A safety classifier can stop a response before it is complete. This refusal does not present itself as a failure: the server responds with an HTTP 200 code, as for any successful response, and it is the stop_reason field that carries the information, with the value refusal rather than end_turn. The accompanying stop_details field specifies an open category, for example cyber, bio, or reasoning extraction, and a readable explanation.

{
  "stop_reason": "refusal",
  "stop_details": {
    "category": "cyber",
    "explanation": "La demande correspond à un usage exclu par la politique."
  }
}

Code that only handles end_turn and max_tokens, two values seen in the first lesson of this module, lets a refusal pass unnoticed. A server-side fallback mechanism exists: it activates via a beta header and a dedicated parameter, and it automatically routes to another model based on the refusal category, without needing to maintain your own list of backup models.

Revisiting the choice with every generation

Sonnet 5's price made permanent and Fable 5's reclassification as a legacy model since the release of a more recent model show the same thing from two different angles: the model comparison made a few months earlier is worthless today. The lesson on caching and batch processing reduces the cost of a model already chosen, this one is about the choice itself, to be redone with every generation rather than fixed once and for all.

Figure 1

Sonnet 5's launch price, now permanent

2dollars per million
Claude Sonnet 5 input price, permanent rate since 1 September 2026
https://platform.claude.com/docs/en/about-claude/pricing, 2026-09-01
10dollars per million
Claude Sonnet 5 output price, same permanent rate, the rise to fifteen dollars will not happen
https://platform.claude.com/docs/en/about-claude/pricing, 2026-09-01
The two values give the price per million tokens of Claude Sonnet 5 as it has applied since the launch price became permanent, without the rise that had been announced for the same date.
Figure 2

Three milestones in the current range

2026-06-05
Claude Opus 4.1 deprecation announced
The identifier claude-opus-4-1-20250805 is marked as deprecated, with retirement planned two months later.
2026-08-05
Claude Opus 4.1 retired
The identifier claude-opus-4-1-20250805 stops responding on the platforms operated by Anthropic, with Amazon Bedrock and Google Cloud setting their own retirement schedules.
2026-09-01
Sonnet 5's price made permanent
The input and output price announced as temporary at launch becomes the standard rate, without the rise that had been planned for the same date.
The timeline places the announcement and the actual retirement of a model in the Opus family side by side, then Sonnet 5's price shift, to show that the choice of a model is revisited at short intervals.
Calibrate it yourself

A developer adds a call to the Claude API to her service to generate an automatic summary. She reads the stop_reason field in the response and finds the value refusal accompanied by a safety category. She reruns her test with different input text and this time gets the value end_turn.

Write in one sentence what this situation establishes, and in one sentence what it does not establish.

What to remember
  • Claude Sonnet 5's launch price has become the permanent price, the rise that had been scheduled for the same date did not happen.
  • Starting with generation 4.6, an undated model identifier already designates a fixed production snapshot, the precaution of dating the identifier yourself has lost its usefulness, except for a model earlier than 4.6 such as Claude Haiku 4.5, where the undated identifier remains an alias.
  • Claude Fable 5.1 is now the most recent and most capable model in the range, Claude Fable 5 remains active but moves to legacy model status.
  • A safety refusal is signalled by a stop_reason field equal to refusal accompanied by a successful HTTP code, never by an exception that would interrupt the programme.
  • Claude Opus 4.1 stopped responding a few weeks after its deprecation was announced, its identifier no longer responds on the platforms operated by Anthropic, with Amazon Bedrock and Google Cloud setting their own schedules.
Do this now

Search your own code for every call to the Claude API and note the model identifier used, then check that your response handling does test the refusal value of the stop_reason field before treating a response as complete.

Check the source

Every datable claim in this lesson links here to the public text behind it. A source that does not open proves nothing.