Skip to content

Commit cb900af

Browse files
Update authentication.mdx to use correct auth header for OpenAI and Vercel SDKs (#18937)
Using `cf-aig-token` results in Error: 401 [{"code":2009,"message":"Unauthorized"}]. From my tests this is fixed if we use header name `cf-aig-authorization` instead
1 parent 40fb685 commit cb900af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/content/docs/ai-gateway/configuration/authentication.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const openai = new OpenAI({
4141
apiKey: process.env.OPENAI_API_KEY,
4242
baseURL: "https://gateway.ai.cloudflare.com/v1/account-id/gateway/openai",
4343
defaultHeaders: {
44-
"cf-aig-token": `Bearer {token}`,
44+
"cf-aig-authorization": `Bearer {token}`,
4545
},
4646
});
4747
```
@@ -54,7 +54,7 @@ import { createOpenAI } from "@ai-sdk/openai";
5454
const openai = createOpenAI({
5555
baseURL: "https://gateway.ai.cloudflare.com/v1/account-id/gateway/openai",
5656
headers: {
57-
"cf-aig-token": `Bearer {token}`,
57+
"cf-aig-authorization": `Bearer {token}`,
5858
},
5959
});
6060
```

0 commit comments

Comments
 (0)