API Key Error.
I provided the api key in the .env file but the following error is thrown.
Error: invalid_request_error: You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.
If you did change .env.example to .env and provided the OPENAI_API_KEY that should be ok. Can you give more context like
- your OS
- the command you ran
Running into the same issue.
- Installed
browser-agentviacargo install browser-agent - I have a
.envfile in the current folder with my key - Running
browser-agent --visual visit google
Building the package myself via cargo build and then cargo run did the trick 👍🏻
Yes, this would work because it would take the variable from your .env file when been run as build. If you are running browser-agent as a CLI (after cargo install), it would make sense to add it as an environment variable (i.e OPENAI_API_KEY=sk-blahblah browser-agent dostuff )