ScrapeGraphAI / Scrapegraph-ai

Python scraper based on AI

Home Page:https://scrapegraphai.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect API Key Error with OpenAI Proxy

PandaPan123 opened this issue · comments

Description
I am encountering an issue while using an OpenAI proxy. The error message indicates that the provided API key is incorrect, even though I have verified that both the proxy URL and the API key work in other projects.

Configuration
Here is the relevant portion of my configuration:

  graph_config = {
     "llm": {
        "api_key": "sk-QDYpP****************************************07dY",
        "model": "gpt-3.5-turbo",
        "openai_api_base": "https://4.0.wokaai.com/v1",
     },
  }

Error Message
The following error message is returned:

openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-QDYpP****************************************07dY. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}

Steps Taken

  • I have verified that the API key and the proxy URL are correct by using them in other projects, where they work without any issues.
  • I have double-checked the configuration and ensured that the API key is correctly copied.

Request
Could you please help me identify what might be causing this issue and how to resolve it? Any guidance or suggestions would be greatly appreciated.

Thank you!

have you tried just with the api key?
Like this configuration

  graph_config = {
     "llm": {
        "api_key": "sk-QDYpP****************************************07dY",
        "model": "gpt-3.5-turbo",
     },
  }

have you tried just with the api key? Like this configuration

  graph_config = {
     "llm": {
        "api_key": "sk-QDYpP****************************************07dY",
        "model": "gpt-3.5-turbo",
     },
  }

I live in a country where OpenAI services are not supported, and I am unable to top up my account normally. Therefore, I am using a proxy OpenAI service. To use OpenAI properly, I need to replace all instances of https://api.openai.com with the proxy address.

Could you please guide me on how to make these changes or if there is any existing configuration to support this?

Excuse me, have you solved this problem

Excuse me, have you solved this problem

I have not yet solved this problem. I am still investigating the issue and haven't received a reply from the repository's maintainer yet.

If I find a solution or if I get any updates, I will make sure to update this issue accordingly.

@VinciGit00
I'm following up on my issue to see if there are any updates or progress on the matter. I'm still waiting for a response and would greatly appreciate your guidance or any suggestions you might have.

Thank you for your time and attention to this issue.

hi. Pls contact me through email, if you can send me a key and the base_url we can make the trials

hi. Pls contact me through email, if you can send me a key and the base_url we can make the trials

Thank you for your attention to my issue. I have just sent you the email with the requested API key and base URL for testing.

Please look at the email

@PandaPan123 I'm in the same boat as you. Did you solve it?

Please update at the new version, we probabilmente fix it

Please update at the new version, we probabilmente fix it

@VinciGit00 could you give me link commit to fix it?

did you mean this?

pip install scrapegraphai==1.5.7

@PandaPan123 Have u solved this problem? I have installed scrapegraphai==1.6.0. But still got the same issue: openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-x2Gdd***************************************30C3. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}

你解决了这个问题吗?我已经安装了scrapegraphai==1.6.0。但仍然遇到同样的问题:openai。AuthenticationError: Error code: 401 - {'error': {'message': '提供的 API 密钥不正确:sk-x2Gdd***************************************30C3.您可以在 https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}} 找到您的 API 密钥

I have stopped using the proxy and have successfully recharged OpenAI using other methods.

Could u pls tell me what other methods did u use to successfully connect to OpenAI?

hi, please try the new beta to see if it works