# Handle new \`refusal\` stop reason from Claude 4 models \(\#31217\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/5c0b1615634006c94a095bf5def1045b4393f1b6)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 5c0b1615634006c94a095bf5def1045b4393f1b6

Requested commit: 5c0b1615634006c94a095bf5def1045b4393f1b6

Commit: 5c0b1615634006c94a095bf5def1045b4393f1b6

Tree: b27e0e126d536f105982b7dc03e57a435778a2d0

Author: Marshall Bowers

Committer: GitHub

## Message

```
Handle new `refusal` stop reason from Claude 4 models (#31217)

This PR adds support for handling the new [`refusal` stop
reason](https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/handle-streaming-refusals)
from Claude 4 models.

<img width="409" alt="Screenshot 2025-05-22 at 4 31 56 PM"
src="https://github.com/user-attachments/assets/707b04f5-5a52-4a19-95d9-cbd2be2dd86f"
/>

Release Notes:

- Added handling for `"stop_reason": "refusal"` from Claude 4 models.
```

## Parents

- [ad4645c59bbcd56a612e59225a56b6e500e018eb](https://git.cafe/gitcafe/zed/commit/ad4645c59bbcd56a612e59225a56b6e500e018eb?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/5c0b1615634006c94a095bf5def1045b4393f1b6?format=markdown)
