Skip to content
Projects

About

Reverse-proxy AI Studio Playground and Build as APIs | AI Studio to OpenAI-, Anthropic-, and Gemini-compatible APIs

Systems & Infrastructure

How these counts are measured

Measured star growth

in 24h
+13
in 7 days
+86
in 15 days
+272
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README_en.md

Original

AI Studio to OpenAI, Anthropic & Gemini Compatible API

中文  |  English

A High-Performance Go Proxy Server
Converts the Google AI Studio web protocol into OpenAI, Responses, Anthropic, and Gemini compatible APIs

Playground Generation Channel  •  Build Code Assistant Chat Channel  •  High-Concurrency Multi-Account
Camoufox and SpiderMonkey WAA Backends  •  Claude Code, Codex, and Other Agent Clients  •  Nano Banana, TTS, and Omni

Accounts
Accounts
Tier, state
Usage
Usage
Cost, latency
Logs
Logs
Per request
Models
Models
Live catalog
Settings
Settings
All options
Images
Images
Create, edit
API playground
API playground
AI Studio chat with thinking and code

Get started in three steps: download a release and launch it → add a Google account on the Accounts page → click "Start service" and use http://127.0.0.1:2048 as the Base URL of your OpenAI, Anthropic or Gemini client

🧩 The Google proxy family

The three projects connect to AI Studio, the Gemini web app and Antigravity, and serve their models through OpenAI, Anthropic and Gemini compatible APIs for Agent clients such as Claude Code and Codex and for chat front ends such as SillyTavern.

AIStudio2API
AIStudio­2API

Camou­fox or in-process Spider­Monkey generates the official WAA proof, so accounts chat as on the website

Gemini-Web2API
Gemini-Web­2API

Imports accounts from the local Chrome in one click and runs on plain HTTP, with a guest session when signed out

Antigravity2API
Antigravity­2API

Emulates only the official Windows client, matching TLS, request envelope and companion requests field by field

Core Capabilities

  • Dual Channels: Every account generates through the Playground; the Build app proxy is the legacy channel whose generation upstream has disabled for accounts (PROXY_GENERATION_DISABLED), off by default and enabled in UPSTREAM_CHANNELS; once enabled, generation requests sent through Build return the upstream reason; on free accounts both channels share one daily request count per model
  • Build Chat Models: Every model selectable in the Build chat panel is also listed as <model>-build (for example gemini-3.8-flash-build; can be turned off under “Runtime & channels” in Settings), answered by the Build code assistant with its system prompt, with function calling, tool-result continuation, and Google Search, and billed to the Build chat quota (free requests or the Google AI subscription); each account uses one Build app, and the same conversation continues in that app, including after a service restart. ⚠️ Every request to these models carries the Build code assistant's own injected system prompt, which shapes the answer's style, format, and persona. Accounts that used -build models were once restricted from AI Studio by Google in a batch
  • High-Concurrency Multi-Account: Detects Free, Pro, Ultra, and Plus benefits and routes across accounts by the live model catalog with round-robin or fill-first
  • Two WAA Backends: By default, SpiderMonkey (the Firefox JavaScript engine) generates the official proof inside the service process and no browser is downloaded or launched at runtime; with WAA_BACKEND=camoufox, Camoufox holds the official WAA lifecycle
  • Four API Protocols: OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Gemini GenerateContent; Responses supports context compaction through /v1/responses/compact and compaction and compaction_trigger input items, and Anthropic Messages supports context_management tool-result and thinking clearing and threshold compaction
  • Mainstream Agent Clients: Works with Claude Code, Codex, OpenCode, pi, omp, dsh, OpenClaw, Magpie, and Antigravity CLI, including file read and write tool calls; native web search works in Claude Code, Codex, and omp

Features

  • Native Streaming: Text, reasoning summaries, function calls, Google tools, media, and usage
  • Function Tools: Tool calls, continuation, selection, and strict argument validation across all four protocols, including union types and open parameter schemas
  • TTS Speech Generation: Gemini TTS models for single-speaker and multi-speaker audio
  • Image Generation: Nano Banana image generation
  • Video Generation: Gemini Omni generates video tasks and image-to-video; Gemini Omni accepts text, image, and video input and returns text and MP4 video through the four generation APIs
  • Deep Research: Pro and Ultra accounts can run Deep Research through the four generation APIs and the Interactions agent field, returning the research process, a cited report, and charts
  • Decision Model: gemini-decision-1 answers many yes/no, choice, and score questions about one shared input in a single call to /v1beta/decisions, returning calibrated probabilities and confidence; input can be text, images, audio, video, and PDF, and only input tokens are billed; this model is hidden on the AI Studio website, where choosing it only shows sample apps, and this service can use it directly
  • YouTube Input: YouTube video URLs are read as external video attachments; with YOUTUBE_LINKS enabled, YouTube links in message text are read as video too
  • Video Understanding Controls: Gemini and Interactions support per-video start/end offsets, sampling rates greater than 0 and up to 24 FPS, and static/agentic processing; agentic results preserve server-side processing steps and conversation history
  • Smart Model Switching: Discover models from AI Studio and route through the model field; with DISCOVER_HIDDEN_MODELS enabled, models that AI Studio hasn't made public yet are added to the model list once the account is confirmed to be able to use them; the Model catalog page chooses per model whether it is shown in the API
  • Google Tools: Search, Image Search, URL Context, Code Execution, and Maps
  • Files and Transcribe: File upload, metadata, content, deletion, and audio transcription
  • Live and Robotics: WebSocket text, audio, JPEG images, media end, tool calls, resumption, and interruption; Live clients of the Google Gen AI SDKs connect directly
  • Anti-Fingerprinting: Each account keeps a stable Firefox fingerprint and network exit, and the official WAA runs in the Firefox page environment of SpiderMonkey or in a Camoufox page
  • GUI Launcher: Manage accounts, service controls, live logs, models, requests, usage statistics (broken down by API key once several keys are in use), account pool quota by model and by account, and configuration in the web UI, with dark and light color themes and seven languages: 简体中文, 繁體中文, English, 日本語, 한국어, Français, and Deutsch
  • Desktop App: Windows, macOS, and Linux desktop apps show the management UI in a window and keep running in the system tray after the window is closed
  • Online Update: The Version page shows the latest release and its notes; the desktop apps and the Linux and macOS command-line builds download, verify, and restart into the new version in one click, and a Linux deb install asks for administrator authentication; if the new version has not started within a minute, the admin page open in a browser says to reopen the app and where the logs are
  • Modular Architecture: Go handles protocols, scheduling, APIs, and management; SpiderMonkey or Camoufox hosts WAA, and Camoufox hosts isolated login

System Requirements

  • Windows Release Runtime: Windows 10 or later
    • On systems without the WebView2 Runtime, the desktop app asks whether to download it from Microsoft; the Microsoft installer shows the progress in its own window
    • During the installation the management UI can be opened in the browser from the tray; the desktop window opens once it finishes
    • If you cancel or the installation fails, the management UI opens in the default browser
  • macOS Desktop App: macOS 13 or later, universal for Apple silicon and Intel
  • Linux Desktop App: GTK 3 and WebKitGTK 4.1, such as Ubuntu 22.04, Debian 12, or later; the deb installs these and the Camoufox libraries, while the AppImage also needs the Camoufox libraries listed on the next line
  • Linux Release Runtime: Extract linux-amd64.tar.gz and run ./aistudio2api; Camoufox needs the Firefox system libraries and Xvfb, on Debian/Ubuntu run sudo apt-get update && sudo apt-get satisfy -y "libgtk-3-0, libasound2t64 | libasound2, libx11-xcb1, xvfb"
  • Source Build:
    • Go 1.27.4+, Node.js 22.18+, 24.11+, or 26+, and its bundled npm
    • A C/C++ compiler: the UCRT clang from llvm-mingw on Windows, Xcode Command Line Tools on macOS, Zig 0.16 on Linux
    • The SpiderMonkey and libwebp static libraries for the platform, from the Releases of Mag1cFall/firefox and Mag1cFall/libwebp
  • Operating System: Windows, macOS, Linux
  • Memory:
    • SpiderMonkey backend (default): one account takes about 100 MB on macOS and about 150 MB on Windows and Linux, plus about 55 MB for each additional resident prewarmed account
    • Camoufox backend: one account takes about 0.5 GB on Windows and macOS and about 0.7 GB on Linux, plus about 0.4 GB for each additional resident prewarmed account
  • CPU: the SpiderMonkey backend uses almost none while idle, and the Camoufox backend uses about 0.5% of one core per resident prewarmed account while idle; each request takes under 0.1 s of CPU time on either backend
  • Network: Stable internet connection to Google AI Studio

Installation

Method 1: Windows One-Click Start (Recommended)

Download the windows-amd64.zip package from Releases, extract it, and double-click aistudio2api.exe:

  • The management UI opens in a desktop window; at launch the window shows a startup screen until the management service is ready
  • Closing the window keeps the app running in the system tray: double-click the tray icon to show the window and right-click it for the tray menu; the menu shows the window, opens the management UI in the browser, turns start at login on or off, or quits
  • Double-clicking aistudio2api.exe again brings back the running window

To start from source:

git clone https://github.com/Mag1cFall/AIStudio2API.git
cd AIStudio2API
copy .env.example .env
cd web
npm ci
npm run build
cd ..
mkdir spidermonkey
curl.exe -L -o spidermonkey\windows.tar.gz https://github.com/Mag1cFall/firefox/releases/download/v158.0.1-aistudio2api.2/spidermonkey-v158.0.1-aistudio2api.2-windows-amd64.tar.gz
tar -xzf spidermonkey\windows.tar.gz -C spidermonkey
mkdir libwebp
curl.exe -L -o libwebp\libwebp.tar.gz https://github.com/Mag1cFall/libwebp/releases/download/v1.6.0-aistudio2api.1/libwebp-v1.6.0-aistudio2api.1-windows-amd64.tar.gz
tar -xzf libwebp\libwebp.tar.gz -C libwebp
$env:CC = "x86_64-w64-mingw32-clang"
$env:CXX = "x86_64-w64-mingw32-clang++"
$env:CGO_CPPFLAGS = "-I$PWD\spidermonkey\include -I$PWD\libwebp\include"
$env:CGO_LDFLAGS = "-L$PWD\spidermonkey\lib -L$PWD\libwebp\lib"
go build -o aistudio2api.exe ./cmd/aistudio2api
.\aistudio2api.exe

x86_64-w64-mingw32-clang comes from the llvm-mingw ucrt-x86_64 package; add its bin directory to PATH after extracting it.

With WAA_BACKEND=camoufox, the program downloads Camoufox for the current platform to runtime/camoufox/ in the background once the console is up, and the generation service becomes ready when the download finishes; the default SpiderMonkey backend downloads it on the first browser sign-in. The console shows the download progress, and public API requests during the download get a 503 that reports it:

  • The download goes through the first proxy in PROXY, or the system proxy when it is unset
  • When the download is interrupted or receives no data for 30 seconds, the console shows the reason and offers a retry, which resumes from the downloaded part
  • CAMOUFOX_PATH selects an existing executable of the same version; for a different version the console names the required version

Method 2: macOS and Linux Desktop App

On macOS, download darwin-universal.dmg from Releases, open it, and drag AIStudio2API.app into Applications. The app is ad-hoc signed; when the system blocks the first launch, click "Open Anyway" in System Settings → Privacy & Security, or run:

xattr -dr com.apple.quarantine /Applications/AIStudio2API.app

On macOS, closing the window keeps the app running in the menu bar: click the menu bar icon to show the window, right-click it to open its menu, and click the Dock icon or open the app from Applications again to show the window.

On Linux, make linux-amd64.AppImage executable and run it, or install linux-amd64.deb and start AIStudio2API from the application menu:

chmod +x aistudio2api-<version>-linux-amd64.AppImage
./aistudio2api-<version>-linux-amd64.AppImage
sudo apt install ./aistudio2api-<version>-linux-amd64.deb

The desktop app keeps .env, auth/, and runtime/ in:

  • macOS: ~/Library/Application Support/AIStudio2API/
  • Linux: ~/.config/AIStudio2API/

Run setup and other commands with the desktop executable in a terminal, such as /Applications/AIStudio2API.app/Contents/MacOS/aistudio2api setup --login; the deb installs the executable as aistudio2api.

Method 3: Linux and macOS Source Build

1. Install Dependencies

  • Go 1.27.4 or later
  • Node.js 22.18+, 24.11+, or 26+, with its bundled npm
  • A C/C++ compiler: Xcode Command Line Tools on macOS, Zig 0.16 on Linux

2. Clone the Project

git clone https://github.com/Mag1cFall/AIStudio2API.git
cd AIStudio2API
cp .env.example .env

3. Build and Run

cd web
npm ci
npm run build
cd ..
arch=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
platform=$([ "$(uname -s)" = Darwin ] && echo darwin || echo linux)
mkdir -p spidermonkey
curl -L https://github.com/Mag1cFall/firefox/releases/download/v158.0.1-aistudio2api.2/spidermonkey-v158.0.1-aistudio2api.2-$platform-$arch.tar.gz | tar -xz -C spidermonkey
mkdir -p libwebp
curl -L https://github.com/Mag1cFall/libwebp/releases/download/v1.6.0-aistudio2api.1/libwebp-v1.6.0-aistudio2api.1-$platform-$arch.tar.gz | tar -xz -C libwebp
export CGO_CPPFLAGS="-I$PWD/spidermonkey/include -I$PWD/libwebp/include" CGO_LDFLAGS="-L$PWD/spidermonkey/lib -L$PWD/libwebp/lib"
if [ "$platform" = darwin ]; then
  go build -o aistudio2api ./cmd/aistudio2api
else
  target=$(uname -m)-linux-musl
  CC="zig cc -target $target" CXX="zig c++ -target $target" go build -tags netgo,osusergo -ldflags="-linkmode external -extldflags -static" -o aistudio2api ./cmd/aistudio2api
fi
./aistudio2api

Linux and macOS also prepare the matching Camoufox build automatically when it is needed.

Method 4: Docker

mkdir aistudio2api && cd aistudio2api
curl -fsSLO https://raw.githubusercontent.com/Mag1cFall/AIStudio2API/main/docker-compose.yml
mkdir data
cat > data/.env <<'EOF'
PROXY_API_KEY=<API key>
ADMIN_AUTH_ENABLED=true
ADMIN_PASSWORD=<console password>
EOF
docker compose up -d

The image supports linux/amd64 and linux/arm64, and the service listens on 0.0.0.0:2048 inside the container. data/ holds .env, auth/, and runtime/; with the Camoufox backend, the first start downloads Camoufox to data/runtime/camoufox/. To migrate an existing installation, copy these three items into data/. The container runs as root, so files the service writes in data/ are owned by root; edit them with sudo on Linux hosts.

  • Set PROXY_API_KEY when the port is reachable from other machines. Opening the console from outside the container requires ADMIN_AUTH_ENABLED=true and a console password; the default username is admin.
  • Add accounts: choose "Sign in with browser" in "Add account" on the console and sign in to Google in the sign-in window that opens in the console; you can also paste cookies, or copy auth/<Google email>/ from a computer that can sign in to Google into data/auth/.
  • PROXY and account proxies are reached from inside the container; when the proxy runs on the host, use the host's LAN address and allow LAN connections on the proxy.
  • The container time zone is UTC. Log timestamps and daily usage totals follow the container time zone; add environment: { TZ: <IANA time zone> } to docker-compose.yml to use another one. New accounts take their locale and time zone from the location of the exit IP, and each account's time zone can also be set on the Accounts page.
  • Run docker compose restart after editing data/.env, docker compose pull && docker compose up -d to update the image, and docker compose up -d --build in the source directory to build from source.

Quick Start

First-Time Use (Authentication Required)

  1. Start the app:

    • Double-click aistudio2api.exe on Windows
    • Start the macOS or Linux desktop app from the application menu, or run ./aistudio2api for the command-line build
    • The desktop app opens the management UI in its window; the command-line build opens http://127.0.0.1:2048 in the browser
    • The initial state is STOPPED, with Logs open by default
  2. Add the first account: click "Add account" on the Accounts page

    • On Windows choose "Import from Chrome" and select a Google account signed in to Chrome on this computer
    • On macOS and Linux choose "Sign in with browser" and sign in to Google in the window that opens
    • Account Management covers the other methods; setup under Commands imports from the command line
  3. Start the API:

    • Click "Start service" to start the data plane
    • The state advances through LAUNCHING to RUNNING; "Stop service" cancels an in-progress launch
    • Use Logs to confirm account, model, and request status
    • The API listens on http://127.0.0.1:2048 by default
  4. Send a request: Configure your client as described in API Usage

Add more accounts on the same page; Account Management covers every method, the account states, and the actions available in each.

Daily Use (With Existing Authentication)

  1. Double-click aistudio2api.exe or start the desktop app from the application menu; run ./aistudio2api for the command-line build
  2. Click "Start service" to enable the APIs; with AUTO_START=true, the service starts together with the manager; while it starts or stops, the sidebar shows the current step and elapsed time
  3. "Stop service" cancels an in-progress launch or active requests and closes WAA workers while the management UI and Logs remain available
  4. Click "Start service" again to resume the APIs

When settings take effect:

  • On the next request as soon as they are saved: almost all settings (including PROXY_API_KEY, console login, default proxy and proxy pool, upstream channels, hidden model discovery, timeouts, first-event hedge, account switching policy, request rewrites, and logging); requests already in progress keep the settings they started with, and proxy changes drain and rebind affected account workers once their in-flight requests finish
  • After restarting the generation service: WAA_BACKEND and AISTUDIO_AUTH_STATES (when the generation service is running, Settings offers a button to restart it)
  • After restarting the management process: LISTEN_ADDR and PREVIEW_LISTEN_ADDR
  • On the next program start: AUTO_START

Exiting:

  • Closing the desktop window keeps the app running in the system tray; choose Quit in the tray menu to exit the manager
  • For the command-line build, press Ctrl+C in the launch window or close that window to exit the manager; closing the browser tab does not stop the manager

Commands

On Windows, run these commands for the desktop app as cmd /c start /wait aistudio2api.exe <arguments>; the command line returns after the program exits.

aistudio2api: Starts the manager and opens the management UI, in a window for the desktop app or in the browser for the command-line build.

aistudio2api -open-ui=false: Starts the manager without opening a window or the web UI; the desktop app shows only its tray icon.

aistudio2api setup: Imports accounts.

  • Without options it scans local Chrome accounts; --email or --profile selects a Chrome account
  • --locale and --timezone set the account locale and time zone; when omitted they follow the location of the exit IP
  • Isolated login: aistudio2api setup --login, which needs a graphical display; without one, start the service and sign in with "Sign in with browser" in the console
  • File import: aistudio2api setup --storage-state <file>
  • Cookie import: aistudio2api setup --cookie-file <file>, aistudio2api setup --cookie "<Cookie request header>", or aistudio2api setup --cdp <debugging address>
    • The account email is detected from the cookies, and an account imported with --cdp keeps the language and time zone of that browser
    • When the cookies come from a browser signed in to several Google accounts, --authuser N selects the account at /u/N/ on the official site

aistudio2api setup --remote https://<remote-instance>: Adds accounts to a remote instance.

  • Click "Add remotely" on the remote instance's Accounts page; the dialog shows the full command. Copy it with one click and run it on a computer that can sign in to Google: cmd /c start /wait aistudio2api.exe setup --remote <address> --token <token> on Windows, ./aistudio2api setup --remote <address> --token <token> on other systems
  • The account source is "That computer's Chrome accounts" or "Sign in in a new window" (which adds --login)
  • Without --token, the command reads the token from standard input
  • While the dialog is open it keeps a token that is still valid and replaces it when it expires; "New token" replaces it at once and the old token stops working
  • Only the computer that imported an account from its Chrome can renew that account: after uploading such accounts the command stays in the foreground, sends their new sessions to the remote instance right away and every 100 minutes, and retries 5 minutes after a failed renewal; it stops renewing an account once the remote instance has deleted it or its renewal credential is invalid
  • Keep that window open; after restarting the computer, run aistudio2api setup --remote <address> --renew to resume renewal

API Usage

OpenAI Compatible Interface

After starting the service, call OpenAI Chat Completions directly:

curl http://127.0.0.1:2048/v1/chat/completions \
  -H "Authorization: Bearer 123" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.8-flash",
    "messages": [{"role": "user", "content": "Hello, world!"}],
    "stream": true
  }'

Client Configuration Example

Protocol Base URL API key
OpenAI Chat / Responses http://127.0.0.1:2048/v1 PROXY_API_KEY from .env
Anthropic Messages http://127.0.0.1:2048 PROXY_API_KEY from .env
Gemini http://127.0.0.1:2048 PROXY_API_KEY from .env

Read model names from GET /v1/models or GET /v1beta/models.

  • When PROXY_API_KEY is empty, only pages on this machine can call the API from a browser; web clients and some desktop clients need PROXY_API_KEY set
  • Separate several keys with commas; any of them is accepted. On the Settings page you can tick which accounts handle each key's requests
  • A request with the header X-AIStudio-Account: <account> is handled only by that account, written as the email shown on the Accounts page; if that account fails, its error is returned directly instead of switching to another account

For Cherry Studio:

  1. Open Cherry Studio settings
  2. Add an OpenAI-compatible provider
  3. Set the API host to http://127.0.0.1:2048/v1
  4. Set the API key to PROXY_API_KEY from .env
  5. Load models from /v1/models, or add gemini-3.8-flash and gemini-3.5-flash-lite manually

Claude Code uses the Anthropic endpoint. Subagents pick models by the fable, opus, sonnet, and haiku tiers; the variables below map them to AI Studio models. WebSearch runs on Google Search:

$env:ANTHROPIC_BASE_URL = "http://127.0.0.1:2048"
$env:ANTHROPIC_API_KEY = "<PROXY_API_KEY>"
$env:ANTHROPIC_MODEL = "gemini-3.8-flash"
$env:ANTHROPIC_DEFAULT_FABLE_MODEL = "gemini-4-argon"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "gemini-3.1-pro-preview"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "gemini-3.8-flash"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "gemini-3.5-flash-lite"

Codex uses the Responses endpoint. Add a provider to ~/.codex/config.toml and put PROXY_API_KEY in the AISTUDIO2API_KEY environment variable. Codex's web_search tool runs on Google Search:

model = "gemini-3.8-flash"
model_provider = "aistudio"

[model_providers.aistudio]
name = "AIStudio2API"
base_url = "http://127.0.0.1:2048/v1"
env_key = "AISTUDIO2API_KEY"
wire_api = "responses"

omp runs its web_search tool with the model of the web role. Add a Gemini provider that points to this service in omp's models.yml (apiKey is the name of the environment variable holding PROXY_API_KEY), then set the web role to that model in config.yml:

# models.yml
providers:
  aistudio-gemini:
    baseUrl: http://127.0.0.1:2048/v1beta
    api: google-generative-ai
    apiKey: AISTUDIO2API_KEY
    models:
      - id: gemini-3.8-flash
# config.yml
modelRoles:
  web: aistudio-gemini/gemini-3.8-flash

Antigravity CLI (agy) uses the Gemini endpoint. Write {"modelProvider": "gemini"} to ~/.gemini/antigravity-cli/settings.json, set the variables below, run agy, and pick the model with /model in agy:

$env:GEMINI_API_KEY = "<PROXY_API_KEY>"
$env:GOOGLE_GEMINI_BASE_URL = "http://127.0.0.1:2048"
agy

Main endpoints:

Capability Endpoint
Models GET /v1/models, GET /v1/models/{model}, GET /v1beta/models, GET /v1beta/models/{model}
OpenAI Chat POST /v1/chat/completions
OpenAI Responses POST /v1/responses, POST /v1/responses/input_tokens, POST /v1/responses/compact, GET/DELETE /v1/responses/{id}, GET /v1/responses/{id}/input_items, POST /v1/responses/{id}/cancel
Files POST /v1/files, GET /v1/files, GET /v1/files/{id}, GET /v1/files/{id}/content, DELETE /v1/files/{id} (OpenAI and Anthropic formats); POST /upload/v1beta/files, GET /v1beta/files, GET/DELETE /v1beta/files/{id}
Anthropic POST /v1/messages, POST /v1/messages/count_tokens
Gemini POST /v1beta/models/{model}:generateContent, :streamGenerateContent, :countTokens; POST/GET /v1beta/cachedContents, GET/PATCH/DELETE /v1beta/cachedContents/{id}
Embeddings POST /v1/embeddings, POST /v1beta/models/{model}:embedContent, :batchEmbedContents
Images POST /v1/images/generations, POST /v1/images/edits, Imagen POST /v1beta/models/{model}:predict
Speech POST /v1/audio/speech; voices GET/POST /v1beta/voices, GET/DELETE /v1beta/voices/{id}
Transcription and translation POST /v1/audio/transcriptions, POST /v1/audio/translations
Music Gemini generateContent with responseModalities: ["AUDIO"]
Video POST /v1/videos, GET /v1/videos, GET/DELETE /v1/videos/{id}, GET /v1/videos/{id}/content
Gemini Video POST /v1beta/models/{model}:predictLongRunning, GET /v1beta/operations/{id}
Live (including live translation, live transcription, and live music) / Robotics GET /v1/live, GET /v1/robotics/stream
Gemini Live (Google Gen AI SDKs) GET /ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent; v1alpha and v1 also work

The Gemini /v1beta paths are also available under /v1, which Google Gen AI SDK 3.x uses by default. Requests to /v1/models and /v1/files that carry an x-goog-api-key header or a key parameter without Authorization get Gemini responses; all others get OpenAI responses.

All four generation APIs can enable Search, Image Search, URL Context, Code Execution, and Maps through their protocol fields. Request and event formats for Files, Transcribe, Live, and Robotics are documented in the Google AI Studio protocol specification.

Inline attachments in generation requests:

  • They are uploaded to the generating account's Drive first; later requests carrying the same attachment go first to the account that already holds it and reference the uploaded file, and files idle for 1 hour are deleted
  • If the account has not granted Drive access or has exceeded its storage quota, the original inline data is sent
  • Images, audio, video, PDFs, and other inputs must be supported by the selected model
  • Upload reusable attachments once through the Files API and reuse their file IDs

Attachment fields and encoding:

  • Gemini attachments and video image inputs accept inlineData / inline_data, fileData / file_data, mimeType / mime_type, and fileUri / file_uri
  • Base64 media data supports standard and URL-safe alphabets, padded and unpadded forms, and the data:<MIME>;base64, prefix; Markdown images in OpenAI assistant history also support URL-safe Base64 and CR/LF line breaks
  • Inline GIFs and GIFs uploaded through video multipart requests are converted to PNG using the first frame, preserving the logical canvas, frame position, and transparency; GIFs uploaded through the Files API are converted to JPEG on a white background using the first frame

TTS Speech Generation

TalkifyTTS and the Google Gen AI SDK can connect to http://127.0.0.1:2048/v1beta/interactions; the stable endpoint is /v1/interactions. Authenticate with x-goog-api-key. Both gemini-3.8-flash-tts and gemini-3.8-flash-lite-tts support single-speaker and multi-speaker synthesis.

from google import genai

client = genai.Client(api_key="123", http_options={"base_url": "http://127.0.0.1:2048"})
stream = client.interactions.create(
    model="gemini-3.8-flash-tts",
    input="Hello, this is a test.",
    response_format={"type": "audio"},
    generation_config={"speech_config": [{"voice": "Kore"}]},
    stream=True,
)
for event in stream:
    if event.event_type == "step.delta" and event.delta.type == "audio":
        print(event.delta.data)

Streaming defaults to Base64-encoded 24 kHz, 16-bit little-endian mono PCM. Non-streaming defaults to a complete WAV file, available through interaction.output_audio.data. Set response_format.mime_type to audio/l16 or audio/wav to select the format. See the Interactions protocol for style annotations and multi-speaker input.

curl http://127.0.0.1:2048/v1/audio/speech \
  -H "Authorization: Bearer 123" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.8-flash-tts",
    "input": "Hello, this is a test.",
    "voice": "Kore",
    "response_format": "wav"
  }' \
  --output speech.wav

Multi-speaker speech is available through Gemini generateContent with multiSpeakerVoiceConfig.

curl http://127.0.0.1:2048/v1beta/models/gemini-2.5-flash-preview-tts:generateContent \
  -H "x-goog-api-key: 123" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"parts": [{"text": "Joe: How are you?\nJane: I am fine, thanks!"}]}],
    "generationConfig": {
      "responseModalities": ["AUDIO"],
      "speechConfig": {
        "multiSpeakerVoiceConfig": {
          "speakerVoiceConfigs": [
            {"speaker": "Joe", "voiceConfig": {"prebuiltVoiceConfig": {"voiceName": "Kore"}}},
            {"speaker": "Jane", "voiceConfig": {"prebuiltVoiceConfig": {"voiceName": "Puck"}}}
          ]
        }
      }
    }
  }' --output speech.json
  • Available voices are returned by capability_options.voices in the live model catalog
  • Models with the speech_metadata capability, such as gemini-3.8-flash-tts, accept the same Speaker: line script; each text part can also set speechMetadata.speaker and speechMetadata.style, with multiSpeakerVoiceConfig.mode selecting VERBATIM or CONVERSATIONAL
  • OpenAI instructions become the speech style on these models
  • Custom voices (Voice Design): create one with POST /v1beta/voices and {"voice":{"type":"prompted","display_name":"Old Sailor","prompted":{"input":"<voice description>"}}}; the response carries a voice_... ID and a preview clip, and the ID works in the voice field of every protocol. The service picks the closest prebuilt voice for the description and sends the description as a speaking style. "New voice" on the playground speech page runs the same flow, with prompt improvement, remixing an existing voice and voice replication from a recording

Image Generation (Nano Banana)

curl http://127.0.0.1:2048/v1/images/generations \
  -H "Authorization: Bearer 123" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-nano-banana-2.1",
    "prompt": "A cute cat wearing a tiny hat",
    "n": 1,
    "size": "1024x1024"
  }'
  • size is the output width and height, such as 2560x1440: the service generates at the closest aspect ratio and the smallest resolution that covers the size, then scales the image to it
  • When size is auto or omitted, quality low, medium, and high generate at 1K, 2K, and 4K
  • output_format is png (default), jpeg, or webp
  • /v1/images/edits and the Responses image_generation tool take the same fields, and the native Gemini API uses imageConfig.aspectRatio and imageConfig.imageSize

Video Generation

curl http://127.0.0.1:2048/v1/videos \
  -H "Authorization: Bearer 123" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-omni-1.2-flash",
    "prompt": "A drone flying over a forest"
  }'

After creating the task, poll GET /v1/videos/{id} and download the result from GET /v1/videos/{id}/content; video-capable Omni models such as gemini-omni-1.2-flash also create tasks through :predictLongRunning.

Decisions (Gemini Decision)

curl http://127.0.0.1:2048/v1beta/decisions \
  -H "x-goog-api-key: 123" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-decision-1",
    "input": "I was charged twice for my order.",
    "questions": {
      "is_refund": {"type": "noul", "instructions": "Is the customer asking for money back?"},
      "department": {
        "type": "choice",
        "instructions": "Which department should handle this request?",
        "criteria": {"billing": "Payments and refunds.", "shipping": "Delivery and tracking.", "other": ""}
      }
    }
  }'
  • You name the keys of questions, and answers come back under the same keys; every answer includes confidence
  • noul: returns the probability noul that the statement holds, with optional true_description and false_description in criteria
  • choice: takes option IDs mapped to descriptions in criteria and returns choice plus probabilities for every option
  • score: takes level descriptions from low to high in criteria and returns the expected level score, per-level probabilities, and legend
  • input accepts a string or Interactions content blocks; images, audio, video, and PDF use data (Base64) or uri (an HTTPS URL or a file from this service's Files API) with mime_type
  • The Google Gen AI SDK calls it through client.decisions.create

gemini-decision-1 is hidden on the AI Studio website: choosing it in the official Playground only shows sample apps and doesn't open a chat. This service can use it directly and logs a reminder in the runtime log for every request.

Models

The model catalog follows AI Studio updates; clients read the current values from /v1/models or /v1beta/models. The table below lists common catalog models; runtime results are authoritative for model IDs and limits:

Model ID Name Type Input Output
gemini-4-hydrogen Gemini 4 Hydrogen Text 1048576 65536
gemini-4-carbon Gemini 4 Carbon Text 1048576 32768
gemini-4-neon Gemini 4 Neon Text 1048576 65536
gemini-4-argon Gemini 4 Argon Text 1048576 32768
gemini-3.8-flash Gemini 3.8 Flash Text 1048576 65536
gemini-3.5-flash-lite Gemini 3.5 Flash Lite Text 1048576 65536
gemma-4-31b-it Gemma 4 31B IT Text 262144 32768
gemini-omni-1.2-flash Gemini Omni 1.2 Flash Text and video 131072 65536
deep-research-preview-04-2026 Deep Research Preview Deep research 1048576 65536
deep-research-max-preview-04-2026 Deep Research Max Preview Deep research 1048576 65536
gemini-decision-1 Gemini Decision 1 Decision 262144 1
gemini-nano-banana-2.1 Nano Banana 2.1 Image 65536 65536
gemini-3.1-flash-lite-image Nano Banana 2 Lite Image 65536 65536
gemini-3-pro-image Nano Banana Pro Image 131072 32768
gemini-3.8-flash-tts Gemini 3.8 Flash TTS Speech 8192 16384
gemini-3.8-flash-lite-tts Gemini 3.8 Flash Lite TTS Speech 8192 16384
gemini-3.5-transcribe Gemini 3.5 Transcribe Transcription 98304 32768
lyria-3.5 Lyria 3.5 Music 1048576 65536
lyria-3-pro-preview Lyria 3 Pro Preview Music 1048576 65536
gemini-3.8-live Gemini 3.8 Live Live 131072 65536
gemini-3.5-live-translate-preview Gemini 3.5 Live Translate Preview Live translation 16384 32768

The catalog also includes -latest aliases, Robotics-ER, the Gemini 3 series, earlier image, TTS, and Live models, -search variants of text and image models with Google Search turned on, and the Build channel's -build models. Models open only to paid API keys (such as Genie 4, genie-4) cannot be called by this service; the admin model catalog marks them "Paid API key only" and the public catalog does not list them.

Public endpoints implement generateContent, countTokens, embedContent, batchEmbedContents, predictLongRunning, and createDecision (/v1beta/decisions); bidiGenerateContent models are called through /v1/live or the standard Live endpoint, and bidiGenerateMusic models through /v1/live. /v1/models and /v1beta/models preserve the callable models of the live upstream catalogs across accounts; scheduling uses explicit model ID, method, and capability fields plus current account runtime state.

  • Models that no enabled account's subscription covers (such as models open only to Google AI Ultra) are still listed without channels, and calls return 403 naming the required subscription
  • Models with the output_continuation capability (such as Gemini 4 Argon) accept an output limit up to input_token_limit, as on the official site: they use input_token_limit when the request sets no output limit, and beyond 32768 tokens the response continues automatically in multiple rounds and is returned as one response
  • Model names accept a thinking suffix such as gemini-4-argon(low): the value in parentheses is none, minimal, low, medium, high, xhigh, extra_high, max, auto, or a thinking budget in tokens, and it overrides thinking parameters in the request body
  • Model names fixed in a client can be mapped to catalog models with MODEL_MAPPING, for example MODEL_MAPPING=claude-haiku-5-5:gemini-3.8-flash; each alias is listed in the model catalog with the fields of its target

Project Architecture

AIStudio2API/
├── cmd/aistudio2api/        # Program entry point and Windows resources
├── internal/
│   ├── app/                 # Commands, management listener, data-plane lifecycle, and scheduling
│   ├── config/              # Reading and validating .env settings
│   ├── setup/               # Account import and isolated-login CLI
│   ├── aistudio/            # AI Studio protocol, authentication, models, and media
│   ├── api/                 # OpenAI, Responses, Anthropic, and Gemini adapters
│   ├── waa/                 # SpiderMonkey WAA runtime
│   ├── camoufoxnative/      # Camoufox BiDi, login, and WAA workers
│   ├── chromeauth/          # Windows Chrome and DBSC import
│   ├── proxydial/           # Dialing and relaying through global and per-account proxies
│   ├── sqlitedb/            # Local SQLite database
│   ├── requestdb/           # Request usage, rollups, and body ledger
│   ├── promptdb/            # API playground conversation storage
│   ├── pricing/             # Cost estimates on the usage page
│   ├── i18n/                # Translating service text into the UI language
│   ├── webui/               # Embedded frontend build
│   └── desktop/             # Desktop window and system tray
├── web/                     # Vue 3 and TypeScript frontend
│   └── src/
│       ├── playground/      # API playground
│       ├── components/      # Management UI components
│       └── locales/         # UI languages
├── docs/                    # Build, development, protocol, logging, and WAA docs
├── build/                   # App icon and per-platform packaging configuration
├── .github/workflows/       # Checks, five-platform builds, and Release publishing
├── .env.example             # Configuration template
├── Dockerfile               # Docker image
├── docker-compose.yml       # Docker Compose example
├── go.mod                   # Go module and dependencies
└── LICENSE

At runtime the program directory holds .env, auth/ (account credentials), and runtime/ (Camoufox, local databases, logs, and media files).

Configuration

Environment Variables

Copy and edit the environment file:

cp .env.example .env

Process environment variables override the same keys in .env, and those settings cannot be changed on the settings page. Saving settings in the console writes only values that differ from the defaults to .env. Settings with invalid values run with their defaults and are listed at the top of the console and in the log.

Variable Default Purpose
AISTUDIO_AUTH_STATES auth Account file, directory, or comma-separated paths
LISTEN_ADDR 127.0.0.1:2048 Management UI and API listen address
PREVIEW_LISTEN_ADDR 127.0.0.1:2050 Listen address for HTML previews in the API playground, on a port different from LISTEN_ADDR
PROXY_API_KEY empty Public API key
API_KEY_ACCOUNTS empty Accounts each key may use, written as key:account|account; keys not listed can use every account. You can also tick accounts per key on the Settings page; takes effect when saved
AUTO_START false Start the generation service when the manager starts
HIDE_DOCK_ICON false On the macOS desktop app, show the icon only in the menu bar instead of the Dock; the service keeps running after the window closes. Changes in Settings take effect immediately
REQUEST_BODY_LOG false Store public API request and response bodies, each truncated to 64 KiB, keeping the latest 1000
LOG_FILE true Also write service logs to runtime/logs/, rotating at 10 MB per file
LOG_MAX_TOTAL_MB 500 Total size limit of the log directory; the oldest files are removed beyond it; at least 20
ADMIN_AUTH_ENABLED false Enable username/password login for the console
ADMIN_USERNAME admin Administrator username
ADMIN_PASSWORD empty Administrator password, required when login is enabled
PROXY empty HTTP, HTTPS, or SOCKS5 proxy used by Chrome import, login, and accounts without an override; separate several proxies with commas to form a proxy pool; the system proxy is used when empty
INIT_TIMEOUT 2m Per-account WAA initialization timeout
REQUEST_TIMEOUT 30m Longest time upstream may send no data, counted from the start of the request until the first data too; requests that upstream is still streaming have no total time limit
WARM_WORKER_LIMIT 10, 5 with Camoufox Number of resident prewarmed accounts
MAX_ACTIVE_WORKERS 20, 10 with Camoufox Maximum workers active during peak load
WARM_STARTUP_CONCURRENCY 5 Camoufox workers cold-started concurrently during on-demand scaling; prewarming starts workers one at a time; unlimited with WAA_BACKEND=spidermonkey
PER_ACCOUNT_CONCURRENCY 2 Concurrent requests allowed per account
ROUTING_STRATEGY round-robin round-robin rotates accounts; fill-first reuses the first available account
ACCOUNT_ORDER empty Accounts fill-first uses in order, comma-separated; unlisted accounts follow in ID order. Also adjustable on the Settings page, applied on save
MAX_ACCOUNT_SWITCHES 3 How many times a request moves to another account after a non-quota upstream error such as 403 or 5xx; 0 disables switching
ACCOUNT_SWITCH_INTERVAL off Minimum wait in seconds from a failed account attempt before the next account sends any request to Google (or cold-starts a standby worker); off disables waiting
MAX_QUOTA_SWITCHES off Maximum account switches for quota exhaustion (429) within one request; off tries all remaining accounts, 0 disables quota switching, and a positive integer returns the last 429 once exceeded
UPSTREAM_CHANNELS playground Upstream channels for generation requests, playground and build comma separated; build is the legacy channel whose generation upstream has disabled
MODEL_MAPPING empty Client model names mapped to catalog models, each item alias:model ID, comma separated
MODEL_CHANNELS empty Limit a model to one channel, each item model ID:playground or model ID:build; also selectable in model details on the Model catalog page, applied on save
MODEL_ACCOUNTS empty Accounts a model may use, each item model ID:account|account; models not listed can use every account. Also selectable in model details on the Model catalog page, applied on save
HIDE_MODELS empty Model IDs not shown in the API, comma-separated; they are left out of /v1/models and requests return an error saying the model is hidden in settings. Also switchable per model on the Model catalog page, applied on save
GENERATE_CONTENT_ACCOUNTS empty Account IDs, comma-separated, that send models Google moved to the task API via GenerateContent instead; this differs from AI Studio and may trigger Google's risk controls; applied on save
BUILD_NATIVE_NONSTREAM true With the Build channel enabled, prefer native Build unary calls for non-streaming requests; log any fallback to stream collection
BUILD_CHAT_MODELS true Offer the -build chat models; when off they are left out of /v1/models and requests return an error saying they are turned off in settings; applied on save
BUILD_CHAT_PROTOCOL auto Upstream protocol for the -build chat models: auto follows flag 45831005 in the account's page bootstrap data, agency always uses the new StreamRunAgentTask, legacy always uses the old CodeAssistantOffline; applied to the next request after saving
NONSTREAM_KEEPALIVE true When a non-streaming request waits longer than 10 seconds, return 200 first and keep the connection open with periodic newlines
FAKE_STREAM false Streaming requests get the full result as a non-streaming generation, retry on another account if it fails midway, then stream it in the protocol format; heartbeats continue while waiting
YOUTUBE_LINKS false Send YouTube links in user message text to the model as video and remove them from the text
STRIP_THOUGHT_SIGNATURES false Remove thought signatures from conversation history before sending upstream
SEARCH_MODEL_ALIASES true Offer -search variants of search-capable models; requests using these variants enable Google Search
DISCOVER_HIDDEN_MODELS false When syncing account model catalogs, find models that AI Studio hasn't made public yet and add them to the catalog
GOOGLE_SEARCH false Enable Google Search for OpenAI, Anthropic, Gemini, and Interactions generation requests, including ordinary model IDs and requests with function tools
CONTINUATION_REWRITE true Rewrite requests ending with an assistant message as continuation requests on models without native continuation; when off, every model receives them unchanged and an upstream rejection is returned as is
CONTINUATION_PROMPT built-in English sentence Prompt written into the system instruction together with the trailing assistant message when rewriting; when set empty, the trailing assistant message is sent as a user message
REPLY_TOOL false For roleplay only: declare an internal final tool so the model delivers the complete reply at once to reduce mid-stream truncation while keeping thinking streamed live; applies on save
THINKING_GUARD false Roleplay thinking anti-block: guide internal reasoning to stay brief and abstract without repeating sensitive terms and cap thinking effort at low, reducing upstream filter truncation during reasoning; applies on save
SILLYTAVERN_API_KEYS empty Local API keys, comma-separated, whose requests get REPLY_TOOL, THINKING_GUARD, and USER_MESSAGE_REWRITE; when empty they apply to every request; applied on save
USER_MESSAGE_REWRITE off Rewrite Chinese text in user messages to Traditional Chinese or Martian Chinese before sending (leaving assistant history unchanged) and instruct the model to reply in Simplified Chinese by default; off, traditional, or martian; applies on save
FIRST_EVENT_HEDGE off When a request has no first token for a while, send a backup request on an idle account; off, auto, or a wait in seconds
FIRST_EVENT_HEDGE_MODELS gemini-4-argon Comma-separated model IDs that get backup requests; backup requests also count against account quota
FIRST_EVENT_TIMEOUT off Longest time a single attempt waits for its first upstream event after taking an account before cancelling and switching accounts; off or a positive integer in seconds
WAA_BACKEND spidermonkey Where WAA runs: spidermonkey or camoufox
MEDIA_OUTPUT inline How Chat Completions and Messages include generated images and audio: inline or url
MEDIA_BASE_URL empty Service address used in media URLs, such as https://ai.example.com; empty uses the address of each request and follows X-Forwarded-Proto behind a reverse proxy

Notes:

  • PREVIEW_LISTEN_ADDR: when it cannot be bound, a free port on the same host is used; the page opens previews at the current host name with the port in use
  • AUTO_START: if startup fails for reasons such as the network, it retries at intervals starting at 5 seconds and doubling up to 5 minutes, until the service is started or stopped manually
  • MAX_ACCOUNT_SWITCHES: expired sessions and quota errors do not count; quota-exhaustion switches are controlled separately by MAX_QUOTA_SWITCHES (unlimited by default)
  • ACCOUNT_SWITCH_INTERVAL: when moving to a standby account, waits for the interval before starting the worker and sends immediately once ready without waiting again; stops immediately if the client disconnects
  • NONSTREAM_KEEPALIVE: after returning 200, a newline is written every 10 seconds until the JSON body, so reverse proxies such as Cloudflare keep the connection open; errors after that point come back as the protocol error body
  • STRIP_THOUGHT_SIGNATURES: function calls are sent with skip_thought_signature_validator; earlier turns' thinking is not passed to the model with the signatures, so long conversations use fewer input tokens
  • GENERATE_CONTENT_ACCOUNTS: Google has moved gemini-4 and other models of some accounts to the task API, and AI Studio sends CreateInteraction background tasks for them; the service does the same by default. “Runtime & channels” in Settings marks migrated accounts, and accounts not yet migrated can be selected in advance
  • DISCOVER_HIDDEN_MODELS:
    • Discovery runs when account model catalogs sync: at startup, every 24 hours, and on Refresh all in Accounts
    • Models the account is confirmed to be able to use are added to the catalog; they can be used through every protocol, appear in /v1/models, and are marked Hidden in AI Studio on the Model catalog page
    • Once AI Studio lists a model, its official details are used; turning this off removes hidden models immediately, and turning it on discovers them in the background
  • FIRST_EVENT_HEDGE:
    • The backup request uses another account first, otherwise a free slot on the same account; the first to answer continues and the other is cancelled
    • auto waits for the p95 of each model and channel over the last 24 hours, and models with fewer than 20 requests are not hedged
    • A positive integer is the wait in seconds; choosing Custom in settings fills in the recent p95 of the busiest model
  • FIRST_EVENT_TIMEOUT:
    • Each attempt is timed independently from taking an account until the first semantic event arrives; on timeout it cancels the attempt and switches accounts (counts toward MAX_ACCOUNT_SWITCHES, does not cool the account), returning 504 if no account is left
    • With FIRST_EVENT_HEDGE enabled, the primary and backup requests keep separate timers and this should be set higher than the hedge wait; excludes background requests and background agent tasks; slow thinking requests may take several minutes before their first token
  • WAA_BACKEND:
    • spidermonkey runs WAA in SpiderMonkey inside the service process and neither downloads nor starts Camoufox; camoufox runs WAA in a Camoufox page
  • MEDIA_OUTPUT:
    • inline embeds a data URI
    • url saves the file under runtime/media/, named by its content, and links to it at /media/<file> on this service, a path that does not check the API key; when the directory exceeds 1 GB, the least recently used files are deleted first

The service loads every account from AISTUDIO_AUTH_STATES. Four settings control capacity, and saving them in the console applies them to scheduling right away:

  • WARM_WORKER_LIMIT: the resident warm pool; raising it prewarms more
  • MAX_ACTIVE_WORKERS: the peak worker count; lowering it closes the extra idle workers
  • WARM_STARTUP_CONCURRENCY: how many Camoufox workers cold-start at once
  • PER_ACCOUNT_CONCURRENCY: request slots per account

Port Configuration

The console allows passwordless loopback access by default. For remote management:

  • Set ADMIN_AUTH_ENABLED=true, configure the administrator username and password, and sign in on the separate /login page (saving in Settings takes effect immediately and keeps the current browser signed in)
  • A session lasts 12 hours; with "Stay signed in for 30 days" checked it lasts 30 days and survives restarts
  • Sign-out is supported; administrators share the instance's account pool, configuration, and logs

Public APIs use the separate PROXY_API_KEY.

Use an HTTPS reverse proxy that preserves Host and sets X-Forwarded-Proto: https. Console login settings saved from the Settings page take effect immediately (disabling login is only allowed from loopback).

HTML previews in the API playground run on a separate origin served at PREVIEW_LISTEN_ADDR, and the page opens them at the current host name with that port:

  • When the console is opened from another computer, PREVIEW_LISTEN_ADDR listens on a reachable address like LISTEN_ADDR

  • Behind a reverse proxy, also proxy the same port number on the same host name to PREVIEW_LISTEN_ADDR, for example https://ai.example.com:2050 to local port 2050 when the console is https://ai.example.com

  • Management UI and APIs: Default port 2048

  • Camoufox: Local ports are allocated dynamically

Advanced Features

Proxy Configuration

HTTP, HTTPS, and SOCKS5 proxies are supported. For proxies that require authentication, include the credentials in the URL, for example socks5://user:password@host:1080:

  1. Set the global proxy under Service Configuration. When it is empty, the system proxy is used: the HTTPS_PROXY environment variable first, then the Windows or macOS system proxy setting. The egress the running generation service actually uses is shown below the proxy field
  2. The global proxy accepts several comma-separated proxies that form a proxy pool:
    • Each account without its own proxy is bound to the available proxy with the fewest accounts; the binding is stored in the account state and survives restarts
    • When a proxy has 3 consecutive network errors or fails the periodic check, its accounts move to another available proxy, and it takes part in assignment again once a check succeeds
    • Service Configuration lists each proxy with its status and account count, and each account card shows that account's egress
  3. Edit an account to set an account-specific proxy
  4. The account proxy is used for login, WAA, and business requests
  5. For authenticated proxies, the program gives Camoufox a credential-free SOCKS5 relay on the loopback address; the credentials are not written to the browser profile. While the relay runs, other local processes can also use the proxy through it

Account Management

"Add account" on the Accounts page offers these methods:

Method Account source Notes
Import from Chrome Accounts signed in to Chrome on this computer Several can be selected; available on Windows
Paste cookies JSON exported by a cookie extension, a Cookie request header line, or a Netscape cookies.txt file The account email is detected automatically
Import from an antidetect browser Windows signed in to AI Studio in local antidetect browsers, Chromium, and Firefox The browser needs remote debugging enabled; Chromium uses CDP and Firefox-based browsers use WebDriver BiDi
Sign in with browser An isolated Camoufox window Detects the email and authorizes Google Drive after login
Add remotely Another computer that can sign in to Google See setup --remote under Commands

Adding accounts:

  • Account proxy, locale, and time zone are under "More settings" in the dialog; locale and time zone left empty follow the location of the exit IP, or the locale and time zone of the server when the exit location cannot be looked up
  • Adding and signing in again run as tasks on the server: you can leave the dialog right after submitting, the top of the Accounts page shows each task's current step, elapsed time, results, and failure reasons, and tasks keep running after the console is closed or reloaded
  • Accounts are saved under the path configured by AISTUDIO_AUTH_STATES in .env; a saved account appears in the list right away, and its model count and tier show up once they are read in the background
  • For everyday browsers such as Edge and Brave, export the cookies on aistudio.google.com with a cookie extension (such as Cookie-Editor) and paste them, or choose the cookie file
  • Above the account list, each exit IP is shown with the number of accounts that reach Google through it; an exit IP shared by several accounts is highlighted in yellow, and an exit whose lookup failed is marked in red and shows the reason on hover

Sign in with browser:

  • It opens a visible Camoufox window on this computer; when Google asks to verify your identity, confirm it in that window or on your phone
  • When the server has no graphical display, or the console is opened from another computer or through a reverse proxy, Camoufox for "Sign in with browser" and "Sign in again" runs headless on the server and its screen appears in a full-screen sign-in window in the console, where you click, type, and paste; Cancel ends the sign-in
  • The in-page sign-in window can be hidden and reopened from its task row; a reverse proxy must forward the WebSocket at /api/login-view/

Account actions depend on state. Click the state in an account row to set the account to Ready or Disabled:

Account state Available actions
ready Edit, disable, refresh now, delete
disabled Edit, set to Ready, delete
cooldown Edit, set to Ready, disable, refresh now, delete
auth_required Edit, set to Ready, disable, sign in again, refresh now, delete
restricted Edit, set to Ready, disable, refresh now, delete
  • Setting an account to Ready enables a disabled account and clears the service restriction, the account-wide cooldown, and the sign-in required mark, while per-model cooldowns stay until they recover; if Google still rejects the account, the next request marks it again and switches to another account
  • While a refresh, disable, enable, or save is in progress, the account row shows the current step and elapsed time (how many requests it is waiting for, reading the plan and models, checking verification), and Logs shows the same steps and the result

Reading the benefit tier and model catalog:

  • Refresh all reads the benefit tier and model catalog of every enabled account immediately; it runs on the server and keeps going after the console is closed or reloaded, and reopening the console shows its progress and the queued accounts; the service also reads them every 24 hours, and when a request names a model missing from the catalog and the last read was more than 10 minutes ago, the service reads them first and then handles the request
  • An account whose catalog has never been read shows an unknown tier and the reason for the last failed read; an account with an existing catalog keeps working when a read fails, and its row shows "Model sync failed" with the reason
  • When a read reports that AI Studio does not support the current egress region, accounts with an existing catalog show that reason as well

Service restricted (restricted):

  • An account enters this state and shows the reason with a link to the official page when Google restricts it from using AI Studio, it does not meet AI Studio's age requirements, or its Workspace has not enabled AI Studio
  • Startup, scheduling, and background reads skip the account, and it is not renewed
  • After completing verification on the AI Studio website, set the account state to Ready or click Refresh now to restore it: Refresh now loads the page once, and a successful read restores the account
  • When importing from Chrome, cookies, or an antidetect browser, service-restricted accounts are marked with the reason and cannot be imported

Authentication File Management

Authentication files are stored in auth/ by default:

Path Contents
auth/<Google email>/account.json Account email, proxy, locale, timezone, and enabled state
auth/<Google email>/storage-state.json Google cookies and authentication renewal material
auth/<Google email>/runtime-state.json Benefit tier, model eligibility, cooldowns, and resource ownership
auth/<Google email>/camoufox-cache/ Web and startup cache of that account's browser; can be deleted while the service is stopped
auth/.leases/<Google email>.lock Cross-process lease for the account directory
[user cache]/AIStudio2API/runtime-leases/<Google email>.lock WAA Worker lease for that email on the current computer

The lowercase Google email is the account directory, management UI identity, and log source. .leases coordinates account-directory access, while the runtime lease in the user cache allows one WAA Worker per email on the current computer.

Documentation

Important Notes

About Camoufox

This project uses Camoufox to reduce automation detection. Camoufox is based on Firefox and changes lower-level browser behavior to retain a realistic device fingerprint.

Go handles encoding, scheduling, streaming decode, and public protocols. With WAA_BACKEND=camoufox, WAA-protected GenerateContent requests are sent by the account's fingerprinted Camoufox page, preserving the native Firefox TLS/HTTP2 stack, headers, cookies, and page fingerprint.

With WAA_BACKEND=spidermonkey, WAA runs in SpiderMonkey inside the service process, emulates the Firefox page environment from the account fingerprint, and sends requests with Firefox request headers; Camoufox is neither downloaded nor started at runtime. Browser login on the Accounts page still uses Camoufox and prepares it on first login.

Limitations

  • Client-Managed History: Clients submit complete conversation context for Chat, Anthropic, and Gemini requests
  • AI Studio History: API requests are not saved to website history
  • Responses Sessions: previous_response_id and previous_interaction_id share up to 256 response nodes stored in runtime/states.db, so conversations can continue after a restart
  • Authentication Expiry: Chrome imports retain OAuth renewal material and renew on Windows; when a Chrome import on Linux, macOS, or Docker expires, copy it from Windows again. When another account expires, log in again on the Accounts page

Contributing

Issues and Pull Requests are welcome!

📈 Star History

Explore related projects

Loading…