Skip to content

feat: make AI provider base URL configurable via env var#11

Open
miguelmanlyx wants to merge 1 commit into
base:masterfrom
miguelmanlyx:ai-reliability/add_base_url
Open

feat: make AI provider base URL configurable via env var#11
miguelmanlyx wants to merge 1 commit into
base:masterfrom
miguelmanlyx:ai-reliability/add_base_url

Conversation

@miguelmanlyx
Copy link
Copy Markdown

What

Makes the AI provider base URL configurable via an environment variable
(OPENAI_BASE_URL) so the project can switch endpoints without code changes.

Why

Hard-coding a provider URL makes it harder to test against staging endpoints,
run local models, or route to an alternative provider during an outage.
Reading the URL from an env var is a zero-risk, backward-compatible change —
the default remains your current provider.

How

# Before
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))

# After
client = OpenAI(
    api_key=os.getenv("OPENAI_API_KEY"),
    base_url=os.getenv("OPENAI_BASE_URL", "https://api.openai.com/v1"),
)

No existing behaviour changes when OPENAI_BASE_URL is not set.

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