How to better freeload Gemini:
Google has released Gemini for a while now, and Gemini Pro allows 60 calls for free in 1 minute. It's already very comfortable for personal use. However, due to network issues in China, many people cannot easily use it.
If we have Cloudflare, it would be easier. I assume you already have a domain hosted on CF.
- Open dash.cloudflare.com and click on Workers and Pages in the left menu.
- Click on the "Create an Application" button, then click on "Create Worker".
- Give your worker a name, such as "gemini-pro-proxy", and click on "Deploy".
- You will see a page indicating successful deployment, then click on the "Edit Code" button, modify the code to the following, and click on "Save and Deploy".
export default {
async fetch(request, env) {
const url = new URL(request.url);
url.host = 'generativelanguage.googleapis.com';
return fetch(new Request(url, request))
}
}
- Finally, on this worker page, click on "Triggers", add a custom domain, bind your domain, such as gemini-pro-proxy.abc.com, and click on "Add".
The API key for Gemini Pro can be obtained at makersuite.google.com.