Open BootsOfTango opened 6 days ago
You should enter the entire API key, including the sk-proj-
prefix. The entire API key looks like this: sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
, where xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
is the rest of the key.
Here's how to do it:
Open the configuration file (config.py
) in your text editor.
Find where you define your OpenAI API key.
Enter entire API key:
Replace "your_api_key"
with your full API key, including the sk-proj-
prefix. Example:
classConfig:
def __init__(self):
load_dotenv()
self.verbose = False
self.openai_api_key = "sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # Enter your entire API key here
self.google_api_key = None
self.anthropic_api_key = None
.env
file:Create an .env
file in the root of your project if you don't already have one.
Add the API key to the .env
file:
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Load the environment variable in config.py
:
Make sure load_dotenv()
is used to load environment variables and openai_api_key
is set with os.getenv()
:
from dotenv import load_dotenv
import pers
classConfig:
def __init__(self):
load_dotenv()
self.verbose = False
self.openai_api_key = os.getenv("OPENAI_API_KEY")
self.google_api_key = None
self.anthropic_api_key = None
.env way works for me.
im getting the same msg after i tried your first config method
i dont even understand what you mean with env,
Im not good with computers but I really want this for my grandma
Found a bug? Please fill out the sections below. 👍
Describe the bug
[Self-Operating Computer | claude-3] Hello, I can help you with anything. What would you like done? [User] move mouse little to the right [Self-Operating Computer][claude-3] That did not work. Trying another method [Self-Operating Computer][Operate] That did not work. Trying again Error code: 401 - {'error': {'message': 'Incorrect API key provided: google/g*****free. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}} [Self-Operating Computer][Error] -> cannot access local variable 'content' where it is not associated with a value PS C:\Users\Tango>
Steps to Reproduce
Expected Behavior
work normally
Actual Behavior:
msg above
Environment