Skip to content

Commit 69092f7

Browse files
imcfadyen-cfsdnts
authored andcommitted
[AI Gateway] OpenAI SDK example fix (cloudflare#22907)
* Update chat-completion.mdx * Fix typo
1 parent 9a0b3ce commit 69092f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/content/docs/ai-gateway/chat-completion.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ Specify the model using `{provider}/{model}` format. For example:
3333
import OpenAI from "openai";
3434
const client = new OpenAI({
3535
apiKey: "YOUR_PROVIDER_API_KEY", // Provider API key
36-
baseURL:
37-
"https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/compat/chat/completions",
36+
// NOTE: the OpenAI client automatically adds /chat/completions to the end of the URL, you should not add it yourself.
37+
baseURL: "https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/compat",
3838
});
3939

4040
const response = await client.chat.completions.create({

0 commit comments

Comments
 (0)