Parse SSE by hand when the SDK isn't there
Sometimes you don't want the SDK in the loop — you're proxying, you're on a tiny container, you're calling the OAuth-only endpoint that the official SDK doesn't fully support. The SSE format is simple enough to parse directly: lines starting with data:, blank line between events, JSON payload after the prefix.
The dual-adapter pattern
Wrap both auth paths behind a single interface. The caller asks for a stream; the adapter picks API key or OAuth based on availability + recent failure history. The fallback is sticky for a session: once you flip from OAuth to API key (e.g., on a 401), stay on API key for the rest of the session. Otherwise you bounce.