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

OpenAI chatgpt 156 chars api-key compatibility? #77

Closed
Gigithecode opened this issue Nov 6, 2024 · 5 comments
Closed

OpenAI chatgpt 156 chars api-key compatibility? #77

Gigithecode opened this issue Nov 6, 2024 · 5 comments

Comments

@Gigithecode
Copy link

Gigithecode commented Nov 6, 2024

Hello,
Since openai change to 156 chars long their so-called secret key, chatgpt-cli doesn't seem to work.
"Invalid API Key"

@marcolardera marcolardera added bug Something isn't working and removed bug Something isn't working labels Nov 10, 2024
@marcolardera
Copy link
Owner

Hi @Gigithecode , I'm using 156 char api keys without problems. There are no length check for the key.

The error "Invalid API Key" is a 401 status code, meaning that the provided key is invalid. Can you try with a new key or check if the one you are using is correct?

@Gigithecode
Copy link
Author

Gigithecode commented Nov 11, 2024

Hello, I tries with three new keys... no success.
The config.yaml is as follow :

# Supplier: openai, azure
supplier: "openai"

# If supplier is OpenAI, please set this value
api-key: "my 156 key here"
model: "gpt-3.5-turbo"

# If supplier is Azure, please set this value
azure_endpoint: "https://xxxx.openai.azure.com/"
azure_api_version: "2023-07-01-preview"
azure_api_key: "<INSERT YOUR AZURE API KEY HERE>"
azure_deployment_name: "gpt-35-turbo"
azure_deployment_name_eb: "text-embedding-ada-002"

# Settings
temperature: 1
#max_tokens: 500 
markdown: true
easy_copy: true

# proxy setting
use_proxy: false
proxy: "socks5://127.0.0.1:2080" # supports http socks4 socks5

(venv3) gigi@gigi-Sky-X4E2G:~/chatgpt-cli$ ./src/chatgpt.py 
ChatGPT CLI                                                                                                                
Supplier: openai                                                                                                           
Model in use: gpt-3.5-turbo                                                                                                
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[0] >>> hi
Invalid API Key                                                                                                            
                                                                                                                           
Total tokens used: 0                                                                                                       
Estimated expense: $0.000000     

I've $5 on my account.

@marcolardera
Copy link
Owner

Is possible that you have also set the OPENAI_API_KEY environment variable to an invalid key?

The priority order is:

command line argument > env variable > config file

In this case it would overwrite your config.yaml config.

@Gigithecode
Copy link
Author

Hi,
U got it! thank you a lot!
But it wasn't enough to unset OPENAI_API_KEY while having the right key on config.yaml
I must also export OPENAI_API_KEY=my_key and then it worked!
it Seems that something is wrong reading such a long key in config.yaml...

@Gigithecode
Copy link
Author

Would be great to verify if something is wrong reading a long key from config.yaml (ok from 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

2 participants