Support env-based API key, base_url, and model defaults for all LLM providers#21
Open
XOTaichi wants to merge 2 commits intoResearAI:mainfrom
Open
Support env-based API key, base_url, and model defaults for all LLM providers#21XOTaichi wants to merge 2 commits intoResearAI:mainfrom
XOTaichi wants to merge 2 commits intoResearAI:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds
.env-based defaults for all supported LLM providers so the CLI can fall back to provider-specific configuration when explicit flags are not passed.What Changed
autofigure2.pyPROVIDER_CONFIGSsoopenrouter,bianxie, andgeminican read defaultAPI_KEY,BASE_URL,IMAGE_MODEL, andSVG_MODELvalues from environment variablesmethod_to_svg()to fall back to provider-specific env defaults when--api_key,--base_url,--image_model, or--svg_modelare omitted.env.exampleOPENROUTER_API_KEYOPENROUTER_BASE_URLOPENROUTER_IMAGE_MODELOPENROUTER_SVG_MODELBIANXIE_API_KEYBIANXIE_BASE_URLBIANXIE_IMAGE_MODELBIANXIE_SVG_MODELGEMINI_API_KEYGEMINI_BASE_URLGEMINI_IMAGE_MODELGEMINI_SVG_MODELdocker-compose.yml.envdefaults work in Docker deploymentsREADME.mdREADME_ZH.mdWhy
Previously, only hardcoded provider defaults were available in code, and custom provider config had to be passed manually every time. With this change, provider settings can be managed centrally through
.env, which is morepractical for local and Docker-based workflows.
Testing
python3 -m py_compile autofigure2.pydocker composeto verify the compose file and env expansionNotes