marcolardera / chatgpt-cli

Simple yet effective command line client for chatting with ChatGPT using the official API
MIT License
460 stars 80 forks source link

OpenAI chatgpt 156 chars api-key compatibility? #77

Open Gigithecode opened 2 weeks ago

Gigithecode commented 2 weeks ago

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

marcolardera commented 1 week ago

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 commented 1 week ago

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.