AgentGPT icon indicating copy to clipboard operation
AgentGPT copied to clipboard

[Enhancement] Add API key validation

Open APiTJLillo opened this issue 2 years ago • 3 comments

Problem Users seem to have a hard time with OpenAI API keys working, improperly inputting API keys, or obtaining the proper subscription.

Suggested Solution(s) The following would provide more clear instruction and error handling to make API keys more intuitive.

  • [ ] Add more clear instructions for setting up the OpenAI API key and obtaining the payment/subscription requirements.
  • [ ] Modify the setup.sh process to include regex key validation. Example: ^sk-[a-zA-Z0-9]{40}$
  • [ ] Add field validation to the settings menu
  • [x] Add key validation by doing a test call after the key is provided

APiTJLillo avatar Apr 15 '23 17:04 APiTJLillo

I can work on this tonight. @yourepicservices do you know if the open API key uses a standard I can reference for the validation?

matthope1 avatar Apr 16 '23 18:04 matthope1

Awesome! I think that Regex might do the trick

Updated error message based on actually calling the API last night so at least that's out of the way already

asim-shrestha avatar Apr 16 '23 21:04 asim-shrestha

@asim-shrestha,

I covered these two here

  1. Modify the setup.sh process to include regex key validation.
  2. Add field validation to the settings menu

matthope1 avatar Apr 18 '23 00:04 matthope1

Nice! Just Add more clear instructions for setting up the OpenAI API key and obtaining the payment/subscription requirements. left then

asim-shrestha avatar Apr 25 '23 21:04 asim-shrestha