Skip to content

feat(config): make API base URLs and model names configurable via env#46

Draft
subashrijal5 wants to merge 1 commit into
federicodeponte:masterfrom
subashrijal5:feat/support-compactiable-api
Draft

feat(config): make API base URLs and model names configurable via env#46
subashrijal5 wants to merge 1 commit into
federicodeponte:masterfrom
subashrijal5:feat/support-compactiable-api

Conversation

@subashrijal5

Copy link
Copy Markdown

Summary

Makes the Anthropic and OpenAI API base URLs configurable via environment
variables (with sensible defaults), and reworks model-name resolution so each
provider has its own configurable model name. This unblocks using proxies,
gateways, or self-hosted/OpenAI-compatible endpoints without code changes.

Changes

  • Configurable base URLs — add anthropic_base_url and openai_base_url
    to AppConfig, sourced from ANTHROPIC_BASE_URL / OPENAI_BASE_URL and
    defaulting to the official endpoints (https://api.anthropic.com,
    https://api.openai.com/v1).
  • Per-provider model names — replace the gemini/openai-only model selector
    with a _default_model_name() resolver driven by AI_PROVIDER, reading
    GEMINI_MODEL / OPENAI_MODEL / ANTHROPIC_MODEL. Fixes a gap where the
    claude provider had no model env var and silently fell back to the Gemini
    default.
  • Relaxed validation — drop the hard-coded OpenAI model whitelist (it only
    permitted gpt-4.1-nano, which conflicts with custom/gateway endpoints).
    OpenAI and Claude now just require a non-empty model name; the Gemini
    whitelist is unchanged.
  • Docs — document the new variables in .env.example.

Defaults / backwards compatibility

All new variables are optional and fall back to the previous behavior, so
existing Gemini-based setups are unaffected.

Notes

These values are now available on get_config(), but no Anthropic/OpenAI
client is wired into the generation pipeline yet — the active path remains
Gemini. This PR is the config groundwork for that future wiring.

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