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

Open Interpreter can't identify API key in .zshrc file #1328

Open
aldkfjwe opened this issue Jun 26, 2024 · 9 comments
Open

Open Interpreter can't identify API key in .zshrc file #1328

aldkfjwe opened this issue Jun 26, 2024 · 9 comments

Comments

@aldkfjwe
Copy link

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

I'm running the command interpreter --os and type in a question regarding time in Berkeley. Then, I got this error

**openai.openaiError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

There might be an issue with your API key(s).

To reset your API key (we'll use OPENAI_API_KEY for this example, but you may need to reset your ANTHROPIC_API_KEY, HUGGINGFACE_API_KEY, etc):
Mac/Linux: 'export OPENAI_API_KEY=your-key-here'. Update your ~/.zshrc on MacOS or ~/.bashrc on Linux with the new key if it has already been persisted there.,
Windows: 'setx OPENAI_API_KEY your-key-here' then restart terminal.**

Before that, I add the api key to .zshrc file and it looks like this:
export OPENAI_API_KEY=* **

Describe the solution you'd like

Because I add api key to .zshrc, it should work by now according to the error.

Describe alternatives you've considered

I've tried to use several User API keys and Project API keys. None of them work. I also use sudo to run the command. It also doesn't work. I really don't know why this happens.

Additional context

No response

@adriens
Copy link

adriens commented Jun 30, 2024

Hi, did you try to put it this way in your .zshrc :

# OPENAI
export OPENAI_API_KEY="sk-*****"

@kasjfksj
Copy link

image I've already done it. But still can't identify the key. It still reports "There might be an issue with your API key(s)."

@Notnaton
Copy link
Collaborator

Notnaton commented Jul 2, 2024

If you run interpreter with --api_key sk-your-key
Does it work?

@JSee98
Copy link
Contributor

JSee98 commented Jul 14, 2024

@kasjfksj did you source the file after exporting??
Also, you don't need to add quotes to env vars not that it will affect it but just a suggestion.

@danielbowne
Copy link

I am having the same issue, every other tool that I use the key works fine. Seems to be related to .zshrc

@MikeBirdTech
Copy link
Collaborator

@danielbowne did you try @Notnaton's suggestion?

@danielbowne
Copy link

@danielbowne did you try @Notnaton's suggestion?

Of course, I read the docs :) I know how to make the tool work, I am suggesting the tool to work as expected.

@MikeBirdTech
Copy link
Collaborator

@danielbowne Then share more information to allow us to assist you. OI reads from my zshrc without issue

@Notnaton
Copy link
Collaborator

Notnaton commented Aug 20, 2024

Of course, I read the docs :) I know how to make the tool work, I am suggesting the tool to work as expected.

@danielbowne
Can you run this in you shell:
echo $OPENAI_API_KEY

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

No branches or pull requests

7 participants