diff --git a/public/_redirects b/public/_redirects index a889f52c3efa66..64d34d976beffc 100644 --- a/public/_redirects +++ b/public/_redirects @@ -102,6 +102,7 @@ /ai-gateway/integration/vercel-ai-sdk/ /ai-gateway/integrations/vercel-ai-sdk/ 301 /ai-gateway/integration/aig-workers-ai-binding/ /ai-gateway/integrations/aig-workers-ai-binding/ 301 /ai-gateway/integration/ /ai-gateway/integrations/ 301 +/ai-gateway/providers/open-router/ /ai-gateway/providers/openrouter/ 301 # analytics /analytics/migration-guides/zone-analytics/ /analytics/graphql-api/migration-guides/zone-analytics/ 301 diff --git a/src/content/docs/ai-gateway/providers/open-router.mdx b/src/content/docs/ai-gateway/providers/openrouter.mdx similarity index 73% rename from src/content/docs/ai-gateway/providers/open-router.mdx rename to src/content/docs/ai-gateway/providers/openrouter.mdx index 83af082da10d52..ec0f0abd063590 100644 --- a/src/content/docs/ai-gateway/providers/open-router.mdx +++ b/src/content/docs/ai-gateway/providers/openrouter.mdx @@ -43,24 +43,24 @@ curl -X POST https://gateway.ai.cloudflare.com/v1/ACCOUNT_TAG/GATEWAY/openrouter If you are using the OpenAI SDK with JavaScript, you can set your endpoint like this: ```js title="JavaScript" -import OpenAI from 'openai'; +import OpenAI from "openai"; const openai = new OpenAI({ - apiKey: env.OPENROUTER_TOKEN, - baseURL: "https://gateway.ai.cloudflare.com/v1/ACCOUNT_TAG/GATEWAY/openrouter" + apiKey: env.OPENROUTER_TOKEN, + baseURL: + "https://gateway.ai.cloudflare.com/v1/ACCOUNT_TAG/GATEWAY/openrouter", }); try { - const chatCompletion = await openai.chat.completions.create({ - model: "openai/gpt-3.5-turbo", - messages: [{ role: "user", content: "What is Cloudflare?" }] - }); + const chatCompletion = await openai.chat.completions.create({ + model: "openai/gpt-3.5-turbo", + messages: [{ role: "user", content: "What is Cloudflare?" }], + }); - const response = chatCompletion.choices[0].message; + const response = chatCompletion.choices[0].message; - return new Response(JSON.stringify(response)); + return new Response(JSON.stringify(response)); } catch (e) { - return new Response(e); + return new Response(e); } - -``` \ No newline at end of file +```