Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support api_key and base_url in config.yaml #228

Open
3 tasks done
johnd0e opened this issue Feb 12, 2024 · 2 comments
Open
3 tasks done

Support api_key and base_url in config.yaml #228

johnd0e opened this issue Feb 12, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@johnd0e
Copy link

johnd0e commented Feb 12, 2024

Is your feature request related to a problem? Please describe.

I'm aware of set OPENAI_API_KEY and OPENAI_API_BASE env vars, but I'd rather set those in config.

Describe the solution you'd like

Describe alternatives you've considered

No response

Search

  • I did search for other open and closed issues before opening this

Project

  • I have verified that I am using the Go implementation of SGPT (this project) and that it is not another project

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

@johnd0e johnd0e added the enhancement New feature or request label Feb 12, 2024
@tbckr tbckr removed their assignment Feb 24, 2024
@norrybul
Copy link

norrybul commented Apr 5, 2024

I'd be nice if it also supports custom OPENAI_API_KEY and OPENAI_API_BASE (or OPENAI_BASE_URL/Host) in User environment variables in Windows. Standard OpenAI APIs work fine though.
I was more thinking of these base on the request title.
https://litellm.vercel.app/docs/providers/openai
https://litellm.vercel.app/docs/providers/custom_openai_proxy
Anyway, tinkering a bit might make sgpt work.

@ilya-bystrov
Copy link

ilya-bystrov commented Oct 5, 2024

Here is a workaround to avoid using an environment variable.

Add the directory with the following content into your PATH:

./
├── config.json
└── sgpt.sh
$ cat config.json
{"openai_api_key": "<value>"}

$ cat sgpt.sh
OPENAI_API_KEY=$(cat $(dirname ${BASH_SOURCE[0]})/config.json | jq -r .openai_api_key) sgpt "$@"

Now you can use sgpt.sh instead of sgpt to run your scripts/commands without exposing the API key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants