paul-gauthier / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
12.46k stars 1.19k forks source link

Set OPENAI_API_KEY/OPENAI_API_BASE in .env file #706

Closed Batyan45 closed 1 day ago

Batyan45 commented 1 week ago

Issue

In Aider 0.38.0, I was able to set the OPENAI_API_KEY and OPENAI_API_BASE variables in the .env file and load them using the "env-file" field in the .aider.conf.yml file.

For 0.39.0 it is not working:

Model gpt-4o: Missing these environment variables:
- OPENAI_API_KEY
https://aider.chat/docs/llms/warnings.html
Model gpt-3.5-turbo: Missing these environment variables:
- OPENAI_API_KEY
https://aider.chat/docs/llms/warnings.html

Can it be fixed?

Version and model info

Aider v.0.39.0

paul-gauthier commented 6 days ago

Thanks for trying aider and filing this issue. There was a bug introduced in a recent change to how aider loads .env files. I just pushed a fix.

The change is available in the main branch. You can get it by installing the latest version from github:

python -m pip install --upgrade git+https://github.com/paul-gauthier/aider.git

If you have a chance to try it, let me know if it works better for you.

Batyan45 commented 6 days ago

Works great, thanks!

paul-gauthier commented 1 day ago

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.