openai_utils
autogen.oai.openai_utils.is_valid_api_key
is_valid_api_key
Determine if input is valid OpenAI API key. As of 2024-09-24 there’s no official definition of the key structure so we will allow anything starting with “sk-” and having at least 48 alphanumeric (plus underscore and dash) characters. Keys are known to start with “sk-”, “sk-proj”, “sk-None”, and “sk-svcaat”
Parameters:Name | Description |
---|---|
api_key | An input string to be validated. Type: str |
Type | Description |
---|---|
bool | bool: A boolean that indicates if input is valid OpenAI API key. |