end_turnMaps to stopThe assistant naturally finished its turn.
Different protocols use different names for “the model stopped producing output”. ProxAI treats these as related protocol concepts, not interchangeable raw fields.
| Protocol | Terminal fields or events | Meaning |
|---|---|---|
| OpenAI Responses | status, output items, response.completed | The response envelope and typed events describe completion. |
| OpenAI Chat Completions | choices[].finish_reason, [DONE] | Each choice has a finish reason; the stream ends with [DONE]. |
| Anthropic Messages | stop_reason, stop_sequence, message_stop | The final message carries stop metadata; streaming ends with message_stop. |
end_turnMaps to stopThe assistant naturally finished its turn.
max_tokensMaps to lengthGeneration stopped because the token budget was reached.
stop_sequenceMaps to stopA configured stop sequence was generated. stop_sequence may identify the matched sequence.
tool_useMaps to tool_callsThe assistant produced a tool-use request and expects the client/tool loop to continue.
pause_turnMaps to stop or protocol-specific continuationProvider asks the client to continue later; conversion must be careful not to pretend it is a normal final answer.
refusalMaps to refusal metadata / completed Responses with refusal contentA model refusal is a terminal assistant turn, not a provider/request failure.
stopMaps to end_turn / stop_sequenceThe model stopped normally or hit an explicit stop condition.
lengthMaps to max_tokensThe model stopped because the token budget was exhausted.
tool_callsMaps to tool_useThe assistant emitted tool calls.
content_filterMaps to refusal / incomplete ResponsesThe provider stopped output for safety or policy reasons. Treat as policy stop/truncation, not transport failure.
Wire structs mirror official field contracts rather than accepting missing and null interchangeably:
| Case | Representation or handling |
|---|---|
| Official required-nullable field | RequiredNullable<T>: missing is rejected, explicit null and values are accepted. |
| Official optional field | Option<T> with explicit serde presence handling. |
| Known provider omits a required-nullable field | A narrow provider normalization may insert explicit null before protocol deserialization when a measured fixture documents the deviation. |
| Streaming state before a terminal event | Internal accumulation state uses its own optional fields; the official wire event remains strict. |
A successful final Anthropic message therefore follows the official requiredness of stop fields. Failed or interrupted upstream responses are handled as errors rather than by weakening the protocol carrier or inventing a stop reason.
code, param, or matched stop sequences.failed.failed is a response lifecycle/error state and should not be fabricated as Anthropic refusal without refusal content.