preliminary
It is not suitable for white people to operate, gemini directly used as a translation effect compared to other free translation tools do not have an advantage. The same way this method can do a lot of things.
1. Install the "Immersive Translation" plug-in
2. Have an independent domain name (first level and second level can be)
3. Have a cloudflare account
4. Have a Google account
workflow
1.Apply for gemini key
Visit https://ai.google.dev/ and click Get API key in Google AI Studio to start requesting a KEY:
Enter the default dialog debug page after confirming the agreement for the first time:
Click Get API key in the upper right corner, then click Create API key, and finally click Create API key in new project:
Wait for the KEY to be generated and remember to copy and save it:
2. Establish API access agent
High-frequency multi-user access and domestic IP access will lead to gemini key failure and even account blocking, so you need to hang a proxy access key
Login to cloudflare, and create works
Edit the code, paste the following code into worker.js to 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))
}
}
Remember to bind the domain name (binding the domain name in the country in order to be able to access normally), you can bind it here directly, or in the DNS to resolve and set up their own routing forwarding:
3. Get a free domain name and set up route forwarding
https://www.cloudns.org/ can apply for permanent (believe it or not?) Free second level domain name, complicated to set up.
Because it's not a top level domain, it can't can't be configured as shown above.
For more information on how cloudns is configured in cloudflare please do your own tubing.
Simple configuration instructions:
1. will cloudns apply for a second-level domain name set cloudflare's NS record
2. Add A record in cloudflare, A record can fill in the "preferred IP", which can enhance the domestic access speed
3. After setting A record in DNS, select "Workers Routing" from the left side: "Fill in the second-level domain name /*", select the created Worker.
4. A records added in cloudflare may need to be added again in cloudns.
4. Splicing API address
Back to Google AI Studio
See the full address format here: https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=YOUR_API_KEY
Let's make a substitution.
https://你的域名/v1beta/models/gemini-pro:generateContent?key={KEY}
5. Final configuration in immersive translation
Select the Immersive Translation plugin and choose Settings:
Select Gemini:
Fill in the key, address and finally click Test: