error_from_stream_payload() converts error.get("code") with int(...). The rest of the SDK treats error.code as a string code, and stream error frames can carry symbolic codes; in that case iter_sse_models()/aiter_sse_models() raise ValueError instead of GlobalRouterError. A minimal reproducer is an SSE frame like data: {"error":{"code":"rate_limit_error","message":"limited"}}, which reaches this line and fails during int conversion.
File: src/globalrouter/_errors.py
Line: 69
Severity: medium
Summary: int cast of stream error code
error_from_stream_payload() converts error.get("code") with int(...). The rest of the SDK treats error.code as a string code, and stream error frames can carry symbolic codes; in that case iter_sse_models()/aiter_sse_models() raise ValueError instead of GlobalRouterError. A minimal reproducer is an SSE frame like data: {"error":{"code":"rate_limit_error","message":"limited"}}, which reaches this line and fails during int conversion.
File:
src/globalrouter/_errors.pyLine: 69
Severity: medium
Summary: int cast of stream error code