PentestGPT icon indicating copy to clipboard operation
PentestGPT copied to clipboard

The OPENAI API key is not properly configured.

Open jcpp96 opened this issue 1 year ago • 12 comments

I have no idea how to fix this, I have tried reinstalling and starting from scratch and I don't know what to do, any advice please? Captura de pantalla 2023-06-27 161757

jcpp96 avatar Jun 27 '23 21:06 jcpp96

me too

837599951 avatar Jun 28 '23 16:06 837599951

Read the last line. The errors say that you are not using the cookie and you dont have access to gpt-4, then it check if GPT 3.5 is available and it is! You should be able to run pentestgpt --reasoning_model=gpt-3.5-turbo --useAPI

00-Python avatar Jun 28 '23 16:06 00-Python

Hello, I do have a similar issue, i tried for hours to fix this but no use Note : i do have OpenAI membership , so i do have access to ChatGPT-4 I think i setup my API key correctly : image But i am getting the following error : image from the logs : image I haven't exceed any daily quota , i also waited more then 24 hours and getting same isses. Any advises ?

SmailDH avatar Jul 13 '23 18:07 SmailDH

There is no free OpenAI API usage now. You need to link a payment method in order to use OpenAI API. @SmailDH

GreyDGL avatar Jul 15 '23 09:07 GreyDGL

Same error here - I have GPT4 membership.

$ export OPENAI_KEY="..."
$ pentestgpt-connection
Your CHATGPT_COOKIE is not set. Please set it in the environment variable.
#### Test connection for chatgpt cookie
The cookie is not properly configured with ChatGPT Cookie. Please follow README to update cookie through `export CHATGPT_COOKIE=<your cookie>`
#### Test connection for OpenAI api (GPT-4)
The OpenAI API key is not properly configured. Please follow README to update OpenAI API key through `export OPENAI_KEY=<>`.
The error is below: 'ChatGPTAPI' object has no attribute 'token_compression'
#### Test connection for OpenAI api (GPT-3.5)
The OpenAI API key is not properly configured. Please follow README to update OpenAI API key through `export OPENAI_KEY=<>`
The error is below: 'ChatGPTAPI' object has no attribute 'config'

::::::::::::::
chatgpt_connection_test.log
::::::::::::::
2023-07-22 14:00:32.532 | ERROR    | pentestgpt.utils.chatgpt:get_authorization:127 - Expecting value: line 1 column 1 (char 0)
2023-07-22 14:00:32.533 | ERROR    | pentestgpt.utils.chatgpt:get_authorization:128 - You encounter an error when communicating with ChatGPT. The most likely reason is that your cookie expired.
2023-07-22 14:00:32.664 | ERROR    | pentestgpt.utils.chatgpt:get_conversation_history:293 - Failed to retrieve history
2023-07-22 14:00:32.918 | ERROR    | pentestgpt.utils.APIs.chatgpt_api:_chat_completion:96 - Token size error; will retry with compressed message
2023-07-22 14:00:33.082 | ERROR    | pentestgpt.test_connection:main:87 - 'ChatGPTAPI' object has no attribute 'config'
::::::::::::::

What about the cookie ? Error says "The cookie is not properly configured with ChatGPT Cookie. Please follow README to update cookie " but README says "The ChatGPT cookie solution is deprecated and not recommended.". I'm lost :)

adrastee avatar Jul 22 '23 12:07 adrastee

@adrastee I'll update the documentation accordingly. Please use OpenAI API access for now. The cookie usage is depracated because OpenAI blocks the cookie access to ChatGPT. I guess by "GPT4-membership", you mean that you have an access to ChatGPT plus; it does not provide you the access to GPT4 API. To use the tool now, you need an OpenAI API key.

GreyDGL avatar Jul 23 '23 08:07 GreyDGL

I don't understand what is being said here. Apologies in advance if you already covered this, but it's just not clear.

I do NOT have a paid account, but I still have an API key from OpenAI.

I run export OPENAI_KEY='<key>' inside the venv. All good so far, but when I try pentestgpt-connection, I get this:

image

Just to clarify, are you saying that this API Key from OpenAI only becomes active after giving them my payment information?

xpelican avatar Jul 25 '23 11:07 xpelican

@xpelican Yes the key is only active once you provide the payment methods.

GreyDGL avatar Jul 25 '23 12:07 GreyDGL

Hello, I have a paid subscription and I get the GPT-3.5 version to work, however, the GPT-4 is throwing an error something about token_compression: The error is below: 'ChatGPTAPI' object has no attribute 'token_compression'

In the log I see this line: 2023-08-04 14:01:05.075 | ERROR | pentestgpt.utils.APIs.chatgpt_api:_chat_completion:97 - Token size error; will retry with compressed message

What could be the issue?

pavelrozenberg avatar Aug 04 '23 12:08 pavelrozenberg

Would these deprecated cookie functions be removed at a later version? I got a bit confused as too the warnings being spit out I thought I was missing something in the config but nvm @GreyDGL Do you want me to open a pull request with this modification? (Cookie function removal //comment out)

SATUNIX avatar Sep 16 '23 11:09 SATUNIX

Screenshot 2023-10-09 171750

I'm having this issue? i am using windows 11. I am using ChatGPT 3.5 key. can you help me with this?

Umer009 avatar Oct 09 '23 13:10 Umer009

I don't understand what is being said here. Apologies in advance if you already covered this, but it's just not clear.

I do NOT have a paid account, but I still have an API key from OpenAI.

I run export OPENAI_KEY='<key>' inside the venv. All good so far, but when I try pentestgpt-connection, I get this:

image

Just to clarify, are you saying that this API Key from OpenAI only becomes active after giving them my payment information?

Same issue, any solution so far?

Umer009 avatar Oct 09 '23 13:10 Umer009