Skip to content

fix(client): fall back when OPENAI_BASE_URL is empty#2988

Open
theamodhshetty wants to merge 1 commit intoopenai:mainfrom
theamodhshetty:codex/fix-empty-openai-base-url-env
Open

fix(client): fall back when OPENAI_BASE_URL is empty#2988
theamodhshetty wants to merge 1 commit intoopenai:mainfrom
theamodhshetty:codex/fix-empty-openai-base-url-env

Conversation

@theamodhshetty
Copy link

Summary

  • treat an empty OPENAI_BASE_URL environment value the same as an unset one
  • keep explicit base_url arguments unchanged
  • add sync and async regressions for the empty-env case

Why

OPENAI_BASE_URL="" currently bypasses the default API URL fallback because os.environ.get(...) returns an empty string rather than None. That leaves the client with an invalid base URL even though this path is meant to be the environment defaulting logic.

Testing

  • ./.venv/bin/pytest tests/test_client.py -k "base_url_env" -n0
  • ./.venv/bin/ruff check src/openai/_client.py tests/test_client.py
  • ./.venv/bin/mypy src/openai/_client.py
  • ./.venv/bin/pyright -p pyproject.toml src/openai/_client.py

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.

1 participant