Gemini API Reverse Proxy

A reverse proxy for the Google Gemini API, running on Cloudflare Workers.

GitHub Repository

Usage Example

Install the Google Generative AI SDK:

npm install @google/genai

Generate API Key (JWT):

Use the proxy in your code:

import { GoogleGenAI } from "@google/genai";

const client = new GoogleGenAI({
    apiKey: "YOUR_API_KEY_HERE",
    httpOptions: {
        baseUrl: "https://your-worker.workers.dev/",
    },
});

(async () => {
    const response = await client.models.generateContent({
        model: "gemini-2.5-pro",
        contents: ["hi"],
    });
    console.log(JSON.stringify(response, null, 2));
})();

Test Request

Try a simple test request to the proxy. The button attempts a request from the browser.

Dashboard

Go to Configuration Dashboard