Proxy server for Google AI Studio, offering OpenAI API compatibility
Top 29.1% on sourcepulse
This project provides a Python + FastAPI + Playwright server that acts as a proxy for Google AI Studio, mimicking the OpenAI API. It's designed for users who want to leverage Google's AI models through existing OpenAI-compatible clients, offering features like streaming responses, system prompts, and automatic chat clearing for better session isolation.
How It Works
The core of the project involves two Node.js scripts. auto_connect_aistudio.cjs
launches a headless Chrome instance with a debugging port enabled, specifically setting a narrow window width (460px) to ensure UI elements like the "Clear chat" button are visible. It then navigates to Google AI Studio's new chat page. server.cjs
connects to this Chrome instance via Playwright, intercepts incoming OpenAI-like API requests, simulates user interactions on the AI Studio page (including attempting to clear previous chat history), extracts the AI's response, and returns it in the expected OpenAI format.
Quick Start & Requirements
git clone https://github.com/CJackHwang/AIstudioProxyAPI
then npm install
(or yarn install
, pnpm install
).node auto_connect_aistudio.cjs
Highlighted Details
/v1/chat/completions
and /v1/models
.stream=true
) and non-streaming (stream=false
) responses.Maintenance & Community
The project is maintained by CJackHwang. Updates are described as "随缘更新" (updated as time permits), indicating a potentially slower development pace. There are no explicit links to community channels like Discord or Slack provided in the README.
Licensing & Compatibility
Limitations & Caveats
This is a non-official project that relies on web scraping, making it susceptible to breakage from UI changes. The automatic chat clearing feature is particularly fragile and may require manual updates to selectors. It does not support editing past messages or branching conversations. Parameter configuration (like temperature or model selection) must be done manually in the AI Studio web UI, as the proxy does not forward these parameters. The use of a remote debugging port for Chrome requires careful network security considerations.
1 week ago
Inactive