Follow Discord
Sweep 25 Sep 2026 · 19:33Z Build v2.1.283 504 read Stable v2.1.274 Latest v2.1.283 Next v2.1.283 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

handle-streaming-refusals changedtest-and-evaluate/strengthen-guardrails/handle-streaming-refusals

Nearest release: v2.1.281, published 5 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+15added
Lines−3removed
From line 60 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits6to this page, all time

The whole hunk

from line 60, old and new numbered
/
lines
from line 60
6060 
6161<CodeGroup>
6262 ```bash cURL
63 # Stream request and check for refusal
6463 response=$(curl -N https://api.anthropic.com/v1/messages \
6564 -H "anthropic-version: 2023-06-01" \
6665 -H "content-type: application/json" \
from line 71
7271 "stream": true
7372 }')
7473 
75 # Check for refusal in the stream
76 if echo "$response" | grep -q '"stop_reason":"refusal"'; then
74 if echo "$response" | jq -R -e 'select(startswith("data: "))
75 | sub("^data: "; "") | fromjson
76 | select(.delta.stop_reason == "refusal")' >/dev/null; then
77 echo "Response refused - resetting conversation context"
78 # Reset your conversation state here
79 fi
80 ```
81 
82 ```bash CLI
83 response=$(ant messages create --stream --format jsonl \
84 --model claude-opus-5-5 \
85 --max-tokens 1024 \
86 --message '{role: user, content: Hello}')
87 
88 if echo "$response" | jq -e 'select(.delta.stop_reason == "refusal")' >/dev/null; then
7789 echo "Response refused - resetting conversation context"
7890 # Reset your conversation state here
7991 fi
Feedback