Skip to content

Treat empty OPENAI_BASE_URL as unset#2994

Open
LittleChenLiya wants to merge 1 commit intoopenai:mainfrom
LittleChenLiya:fix-empty-openai-base-url-fallback
Open

Treat empty OPENAI_BASE_URL as unset#2994
LittleChenLiya wants to merge 1 commit intoopenai:mainfrom
LittleChenLiya:fix-empty-openai-base-url-fallback

Conversation

@LittleChenLiya
Copy link

Summary

Treat an empty OPENAI_BASE_URL environment variable as unset so the client falls back to the default API endpoint.

Previously, OPENAI_BASE_URL="" bypassed the default fallback and produced an invalid empty base URL.

Changes

  • normalize empty OPENAI_BASE_URL environment values to None
  • apply the fix to both sync and async clients
  • add sync and async regression tests covering the empty-env fallback

Testing

  • python -m pytest tests/test_client.py -k "base_url_empty_env_falls_back_to_default or test_base_url_env" -n 0
  • python -m pytest tests/test_module_client.py -n 0

Closes #2927

@LittleChenLiya LittleChenLiya requested a review from a team as a code owner March 20, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty OPENAI_BASE_URL prevents fallback to default API endpoint

1 participant