Skip to content

Commit 8467c0a

Browse files
fix: accept x-api-key header for anthropic-messages auth format
Made-with: Cursor
1 parent e763f41 commit 8467c0a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/app/api/gateway/proxy/route.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,14 @@ export async function POST(request: NextRequest) {
8585
const subPath = request.nextUrl.searchParams.get('path') || 'chat/completions'
8686

8787
const authHeader = request.headers.get('authorization')
88+
const xApiKey = request.headers.get('x-api-key')
8889
const token = authHeader?.startsWith('Bearer ')
8990
? authHeader.slice(7)
90-
: null
91+
: xApiKey ?? null
9192

9293
if (!token) {
9394
return NextResponse.json(
94-
{ error: 'Missing Authorization header' },
95+
{ error: 'Missing authorization' },
9596
{ status: 401 },
9697
)
9798
}

0 commit comments

Comments
 (0)