Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

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

Closed
miguelmanlyx wants to merge 1 commit into
savannahostrowski:mainfrom
miguelmanlyx:ai-reliability/add_base_url
Closed

feat: make AI provider base URL configurable via env var#18
miguelmanlyx wants to merge 1 commit into
savannahostrowski:mainfrom
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.

@savannahostrowski
Copy link
Copy Markdown
Owner

Thanks for the PR. However, I'm actually going to archive this repo, given that Codex/Claude/pick your flavour of LLM do this quite seamlessly now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants