The pick-one-layer rule is the right one. We run traffic through an LLM gateway with per-tenant metering, so the gateway owns retries and the client sets max_retries=0. A client that cannot see the full attempt budget should not be retrying on its own.
Timeouts, retries and streaming with the OpenAI Python SDK: the defaults that surprised me
2 Comments
apigoto
•
@manojkagitha Agreed, and the gateway is the better owner because it sees the whole attempt budget. Two things that bit us with that setup (I work on the APIGOTO team, an independent gateway):
- Keep the client timeout longer than the gateway's total retry budget. Otherwise the client gives up mid-retry, the user resubmits, and you pay for both.
- With streaming, the gateway can only safely retry before the first token. After that it's better to surface the error and let the app decide.
Do you pass the attempt count or a Retry-After back to the client so it can show something useful?
Please log in to add a comment.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- You Tube
- Tiktok
- Premium Subscription
- Terms of Service
- Early Builders
chevron_left
Related Jobs
- Python DeveloperTriOptus LLC · Full time · Jersey City, NJ
- Python DeveloperCoda Search¦Staffing · Full time · New York, NY
- Python Developer / programmerSonsoft · Full time · Houston, TX
Commenters (This Week)
bryanhamiltondevverified
2 comments
SMRN75
1 comment
Sergey Kornilov
1 comment
Contribute meaningful comments to climb the leaderboard and earn badges!