GreyDGL / PentestGPT

A GPT-empowered penetration testing tool
MIT License
7.29k stars 886 forks source link

The OPENAI API key is not properly configured. #129

Closed jcpp96 closed 2 months ago

jcpp96 commented 1 year ago

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

837599951 commented 1 year ago

me too

00-Python commented 1 year ago

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

SmailDH commented 1 year ago

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 ?

GreyDGL commented 1 year ago

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

adrastee commented 1 year ago

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 :)

GreyDGL commented 1 year ago

@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.

xpelican commented 1 year ago

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?

GreyDGL commented 1 year ago

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

pavelrozenberg commented 1 year ago

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?

SATUNIX commented 1 year ago

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)

Umer009 commented 1 year ago
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 commented 1 year ago

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?