Skip to content

Commit b99eb74

Browse files
authored
fix: update key validation to work with OpenAI's new project keys (#98)
fixes #97 OpenAI has introduced project keys as the new default over user keys (See: https://help.openai.com/en/articles/9186755-managing-your-work-in-the-api-platform-with-projects). This was a breaking change for those with old 'user keys', causing the validation to fail. Change itself was simple, consisting of 1 line at /src/utils/apikey.ts
1 parent 193b862 commit b99eb74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/apikey.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export function isValidAPIKey(apiKey: string | null) {
2-
return apiKey?.length == 51 && apiKey?.startsWith("sk-");
2+
return (apiKey?.length === 51 && apiKey.startsWith("sk-")) || (apiKey?.length === 56 && apiKey.startsWith("sk-proj-"));
33
}

0 commit comments

Comments
 (0)