Most OpenAI clients do not support Azure OpenAI Service, but the application for Azure OpenAI Service is very simple, and it also provides free quotas. This script uses a free Cloudflare Worker as a proxy, allowing OpenAI-supported clients to directly use Azure OpenAI Service.
This script proxies requests to Azure OpenAI Service for OpenAI clients. The code deployment steps are as follows:
Register and log in to your Cloudflare account.
- Create a new Cloudflare Worker.
- Copy and paste cf-openai-azure-proxy.js into the Cloudflare Worker editor.
- Modify the corresponding resourceName and deployName.
- Save and deploy the Cloudflare Worker.
- haibbo#3 Optional: Bind a custom domain name: Add a custom domain name for this worker in the Worker details page -> Trigger -> Custom Domains.
For step 4, resourceName and deployName must be selected correctly. Log in to the Azure backend:
Take OpenCat as an example: fill in the custom API domain name with the domain name bound in step 6:
I have tried multiple clients. If you encounter problems with other clients, please feel free to create an issue.QA:
- Do I need a server to use this?
- This script runs on Cloudflare Worker and does not require a server or a bound card. It is free for up to 100,000 requests per day.
- Do I need my own domain name to use this?
- No, it is not necessary. Refer to: haibbo#3