diff --git a/app/api/auth.ts b/app/api/auth.ts index 6703b64bd..86ec5a4d5 100644 --- a/app/api/auth.ts +++ b/app/api/auth.ts @@ -25,7 +25,8 @@ function parseApiKey(bearToken: string) { } export function auth(req: NextRequest, modelProvider: ModelProvider) { - const authToken = req.headers.get("Authorization") ?? ""; + const authToken = + req.headers.get("Authorization") ?? req.headers.get("x-api-key") ?? ""; // check if it is openai api key or user token const { accessCode, apiKey } = parseApiKey(authToken);