> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ag2.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.oai.openai_utils.is_valid_api_key

<code class="doc-symbol doc-symbol-heading doc-symbol-function" />

#### is\_valid\_api\_key

```python theme={null}
is_valid_api_key(api_key: str) -> bool
```

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.<br />Keys are known to start with "sk-", "sk-proj", "sk-None", and "sk-svcaat"

<b>Parameters:</b>

| Name      | Description                                               |
| --------- | --------------------------------------------------------- |
| `api_key` | An input string to be validated.<br /><br />**Type:** str |

<b>Returns:</b>

| Type | Description                                                      |
| ---- | ---------------------------------------------------------------- |
| bool | bool: A boolean that indicates if input is valid OpenAI API key. |

<br />
