OpenAI Python SDK streams hang or truncate after base_url switch
Repointing the OpenAI Python SDK to a new base_url can leave blocking calls working while streaming calls hang, truncate, or fail with an IndexError on the final event. The article argues the switch changes the whole transport stack, including proxies, TLS terminators and CDNs with different buffering and timeout behaviour, not just the hostname. It warns that a stale OPENAI_BASE_URL environment variable can silently override the intended endpoint and make a key problem look like a 401. It recommends printing resolved configuration and using an API subdomain rather than a CDN-fronted apex, which may buffer responses. A diagnostic curl command and a Python probe measure time-to-first-token and chunk arrival to tell buffering apart from slow starts.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in