content is empty and content[0] throws? That is a model refusal, not an API failure
From a real support ticket: a batch job asked Claude whether code snippets contain vulnerabilities, and some samples came back within 1–2 seconds as HTTP 200 with an empty content array and output_tokens of 0, crashing the script on message.content[0]. The requests had triggered the provider’s cyber safeguards: stop_reason is refusal and stop_details.category is cyber. In the OpenAI-compatible format you get an empty string with finish_reason: "refusal".
The new FAQ shows measured output for native / OpenAI-compatible and streaming / non-streaming calls, the five refusal categories, billing under the provider’s rules (pre-output refusals in cyber and general_harms are not billed), and detection code for both SDKs: Why Does a Claude Refusal Return Empty Content?. A new “Claude FAQ” sub-section has been added under “Claude Official” in the sidebar.
← Back to Live · 📚 Monthly archive