When making requests to OpenAI, replace https://api.openai.com/v1 in the URL you’re currently using with https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/openai.
Prerequisites
When making requests to OpenAI, ensure you have the following:
Your AI Gateway Account ID.
Your AI Gateway gateway name.
An active OpenAI API token.
The name of the OpenAI model you want to use.
Examples
cURL
Use OpenAI SDK with JavaScript
If you are using a library like openai-node, set the baseURL to your OpenAI endpoint like this:
Was this helpful?
What did you like?
What went wrong?
Thank you for helping improve Cloudflare's documentation!