Home / The Claude API for builders
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.
Sonnet 5's launch price, now permanent
Three milestones in the current range
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 this establishes: This second attempt establishes that the same endpoint can return either a refusal or a normally completed response depending on the content sent, and that the refusal is read from the stop_reason field rather than through a network error.
What this does not establish: It does not establish which specific part of the input text triggered the refusal, nor whether the same text would produce a refusal again at another time.
The three most common miscalibrations
- Too broad This result shows that the API now refuses every summary request, regardless of the text provided.
- Too narrow This result shows nothing, since a single attempt is never enough to draw a conclusion about an API's behaviour.
- Beside the point This result shows that the API documentation lists every possible refusal category for this type of request in advance.
- 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.
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.
Every datable claim in this lesson links here to the public text behind it. A source that does not open proves nothing.
- Anthropic, Claude API pricing, price per million tokens consultée le 2026-09-02
- Anthropic, Claude model comparison, identifiers and status consultée le 2026-09-02
- Anthropic, Claude model deprecations and retirements consultée le 2026-09-02