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

failed while calling AI provider openai #946

Closed
Aman123lug opened this issue Feb 11, 2024 · 3 comments
Closed

failed while calling AI provider openai #946

Aman123lug opened this issue Feb 11, 2024 · 3 comments

Comments

@Aman123lug
Copy link

failed while calling AI provider openai: error, status code: 401, message: Incorrect API key provided: fake. You can find your API key at https://platform.openai.com/account/api-keys.

I changed the Openai API key three to four times again and again it showed the same error that I mentioned.
command of adding API key k8sgpt auth add openai

image

Why it's happening ? how to fix this

@VaibhavMalik4187
Copy link
Contributor

The backend configs are stored in the following fashion:

ai:
    providers:
        - name: openai
          password: pass
          model: gpt-3.5-turbo
          temperature: 0.7
          topp: 0.5
          maxtokens: 2048
    defaultprovider: ""

However, running k8sgpt auth add again and again would modify the config file in the following manner:

ai:
    providers:
        - name: openai
          password: pass
          model: gpt-3.5-turbo
          temperature: 0.7
          topp: 0.5
          maxtokens: 2048
        - name: openai
          password: pass2
          model: gpt-3.5-turbo
          temperature: 0.7
          topp: 0.5
          maxtokens: 2048
    defaultprovider: ""

And it'll keep using the old API key as password and this is why you're getting the same error again and again.

I'm working on adding many to one auth: provider mapping to k8sgpt. I've already addressed this issue in #929

@VaibhavMalik4187
Copy link
Contributor

To fix this, you should directly update the config file or you can also delete the openai backend until there's no config left and then add a fresh config with the right API key.

@Aman123lug
Copy link
Author

Understood! you explained very well
Thanks @VaibhavMalik4187
Means a lot!

@github-project-automation github-project-automation bot moved this from Proposed to Done in Backlog Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants