Mag1cFall/AIStudio2API

AI Engineering

Expose Google AI Studio as OpenAI, Anthropic or Gemini-compatible APIs for existing clients and agents.

599
145
Go
MIT
1 year old

This Go service turns the Google AI Studio web protocol into API endpoints that existing OpenAI, Responses, Anthropic and Gemini clients can call. It is most useful when you already have accounts and want a locally hosted endpoint rather than a new SDK integration: you add a Google account in the management page, start the service, and point a client at http://127.0.0.1:2048 with the configured PROXY_API_KEY. The project presents itself as a proxy/reverse-engineering layer, not an official Google API.

How it works

The Go side handles protocol adaptation, scheduling and the management UI. Requests that need the protected upstream flow go through a per-account browser-like environment: by default Camoufox, or, with WAA_BACKEND=spidermonkey, an in-process SpiderMonkey runtime that avoids downloading and launching a browser. Multiple accounts can be rotated (round-robin) or kept sticky (fill-first), with warm workers and per-account concurrency limits. Models are discovered from the live AI Studio catalogue, so client model lists come from upstream rather than a fixed table.

What you can connect

The main draw is that four protocol families are exposed: OpenAI Chat Completions, OpenAI Responses, Anthropic Messages and Gemini GenerateContent. The README documents configuration for Claude Code, Codex and omp, so coding agents can use their normal wire protocols while the backend resolves models such as Gemini variants. Beyond text, the service covers image generation (Nano Banana), video (Veo/Omni), TTS, transcription, embeddings, Files and Live/Robotics WebSocket endpoints; each has its own protocol documentation.

Requirements and setup paths

There are four documented paths, with different prerequisites. Windows users can download a Release package and add accounts through a desktop window; macOS needs 12 or later and Linux desktop needs GTK 4 and WebKitGTK 6.0, with AppImage also requiring Camoufox runtime libraries. Running from source needs Go 1.27+, Node.js 22.18+/24.11+/26+, a C/C++ compiler (llvm-mingw UCRT clang on Windows, Xcode tools on macOS or Zig 0.16 on Linux) and the matching SpiderMonkey static library. Docker supports linux/amd64 and linux/arm64 and keeps .env, auth/ and runtime/ under data/. Source builds and Docker are the practical route for headless servers.

Account authentication is the first real task. The service needs a Google account with AI Studio access, added by browser login, Chrome import, cookie import, fingerprint-browser import or remote pairing. On headless servers the Camoufox login runs without a visible browser and is shown in the management page. Chrome-imported accounts retain OAuth refresh material that refreshes on Windows; on Linux, macOS or Docker those accounts must be copied again from Windows after expiry. Accounts that read as unsupported in the current region stay marked with that failure reason.

Boundaries to know before using

This is explicitly not an official Google API. It depends on AI Studio's web behavior and anti-automation protections; upstream changes can break it. The README states that the Build application proxy is an old channel whose generation has been disabled for accounts (PROXY_GENERATION_DISABLED), and that -build models inject the Build coding assistant's own system prompt into every request. Build usage counts against Build conversation quota. Free accounts share the same daily per-model request count across the two channels. Responses previous_response_id does not survive a process restart. When PROXY_API_KEY is empty, only local browser pages can call the API without a key, so set it for web and desktop clients. Opening the management page remotely requires admin authentication. The README notes that the local proxy password is not exposed to Camoufox, but the unauthenticated loopback relay is reachable by other local processes while running.

Licensed under MIT. Funding, account terms and compliance with Google's AI Studio usage rules are the operator's responsibility; the README does not describe Google's official policy on this kind of proxy.

Project source and documentation

Written by AI from the project's README, updated October 31, 2026. The project's own docs are the source of truth.