LLM model/API behavior drift

Anthropic Claude API stop_reason refusal stop reason Messages API documentation

Application maps the response to an unknown enum and retries indefinitely.

Claude APIHosted AI APIsLLM model/API behavior driftanthropic_migrate

Agent Quick Fix

Repair against the current Claude API contract, then keep the change narrow and source-backed.

Product: Claude API
Current-contract area: New `refusal` stop reason breaks exhaustive parser
Likely root cause: Application maps the response to an unknown enum and retries indefinitely.
Repair direction: Verifier checks current model ID, accepted payload, structured output/tool parsing, and behavior under retries.

Symptom

Application maps the response to an unknown enum and retries indefinitely.

Why This Happens

SDK types may still accept fields that the selected hosted model rejects; model retirement, tokenizer, thinking, and tool behavior are external and fast-moving.

Common Wrong Fixes

  • Changing local code without checking the current external contract.
  • Retrying the same install, build, or API call with no version/source change.
  • Applying a broad unsafe bypass when a narrow compatibility fix is available.

Codex Search Keywords

These are the search terms observed in a neutral Codex validation run for this failure shape.

Anthropic Claude API stop_reason refusal stop reason Messages API documentation
site:docs.anthropic.com stop_reason refusal Anthropic Messages API
Anthropic Messages API stop_reason values docs
https://docs.anthropic.com/en/api/messages
https://docs.anthropic.com/llms.txt
github anthropic openapi messages stop_reason refusal

Source Trail