Python 88.3%
TypeScript 7.6%
Shell 4.1%
1#!/usr/bin/env bash2# Raw SSE stream of POST /v1/messages (stream=true) with curl; prints the ordered event list.3# STATUS: LIVE_VERIFIED 2026-09-18. Observed: message_start, content_block_start, ping, content_block_delta×N, content_block_stop, message_delta, message_stop.4# Run: bash examples/anthropic/streaming/raw_sse.sh5set -eo pipefail6source "$(dirname "$0")/../../../scripts/lib.sh"7out="$(mktemp)"8curl -sS -N https://api.anthropic.com/v1/messages -H "x-api-key: $ANTHROPIC_API_KEY" -H "anthropic-version: $ANTHROPIC_VERSION" \9 -H "content-type: application/json" -H "accept: text/event-stream" \10 -d '{"model":"claude-haiku-4-5-20251001","max_tokens":16,"stream":true,"messages":[{"role":"user","content":"Reply with OK."}]}' > "$out"11mask < "$out" | grep -E '^(event|data):' | cut -c1-20012echo "--- event order:"; grep '^event:' "$out" | cut -d' ' -f2 | paste -sd' ' -13log_request anthropic POST /v1/messages 200 0.00004 "example raw_sse.sh"; rm -f "$out"14