{"id":48469459,"url":"https://github.com/the0cp/gemini-proxy","last_synced_at":"2026-04-07T06:01:42.234Z","repository":{"id":338981151,"uuid":"1159936892","full_name":"the0cp/gemini-proxy","owner":"the0cp","description":"Turn the Google Gemini web interface into an OpenAI-compatible API using Playwright automation. Supports streaming, temporary chats, and persistent login.","archived":false,"fork":false,"pushed_at":"2026-03-12T15:27:24.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-12T21:38:58.012Z","etag":null,"topics":["api-proxy","gemini","gemini-api","openai-api","playwright","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/the0cp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-17T10:49:55.000Z","updated_at":"2026-03-12T15:28:49.000Z","dependencies_parsed_at":"2026-02-17T17:00:03.797Z","dependency_job_id":null,"html_url":"https://github.com/the0cp/gemini-proxy","commit_stats":null,"previous_names":["the0cp/gemini-proxy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/the0cp/gemini-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the0cp%2Fgemini-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the0cp%2Fgemini-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the0cp%2Fgemini-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the0cp%2Fgemini-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/the0cp","download_url":"https://codeload.github.com/the0cp/gemini-proxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the0cp%2Fgemini-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31501903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-proxy","gemini","gemini-api","openai-api","playwright","python"],"created_at":"2026-04-07T06:01:37.298Z","updated_at":"2026-04-07T06:01:42.229Z","avatar_url":"https://github.com/the0cp.png","language":"Python","readme":"# Gemini Web Proxy\n\nA lightweight proxy that turns the Google Gemini Web into an OpenAI-compatible API.\n\nThis project uses `playwright` to run a real browser instance (Chrome/Chromium) in the background. It acts as a bridge:\n1. Receives an API request (OpenAI format).\n2. Automates the browser to type the prompt into `gemini.google.com`.\n3. Streams the response text back to the API client in real-time.\n4. Manages authentication cookies to keep the session alive.\n\n## Features\n\nThis project is more than just a wrapper; it implements advanced techniques to mimic a real human user.\n\n*   **OpenAI API Compatible**: Drop-in replacement for OpenAI clients. Use it with existing tools like LangChain, TavernAI, or custom scripts.\n*   **Stealth \u0026 Anti-Detect**:\n    *   **Fingerprint Randomization**: Rotates between Windows, macOS, and Linux browser signatures.\n    *   **Deep Consistency**: Synchronizes HTTP User-Agents with JavaScript `navigator` properties to pass rigid consistency checks.\n    *   **Context Masking**: Uses `playwright-stealth` to hide WebDriver signals.\n*   **Human-like Behavior Simulation**:\n    *   **Natural Typing**: Abandoned instant text injection (`fill()`) in favor of character-by-character typing with variable speed (10ms-50ms jitter). Long prompts (e.g., 2000+ chars) will take a few seconds to \"type\" into the browser before sending.\n    *   **Randomized Interactions**: Includes \"hesitation\" delays (0.5s-1.5s) before clicking buttons to simulate human thought processes and mouse movement.\n    *   **Dynamic Waits**: Avoids fixed sleep timers, making the bot's behavior unpredictable to pattern-matching algorithms.\n*   **Session Persistence**: Automatically saves and loads authentication cookies (`auth/gemini_state.json`) to maintain login state across restarts.\n\n## Installation\n\n```bash\npip install -r requirements.txt\nplaywright install chromium\n```\n\n## Configuration\n\nCopy the example config and adjust if needed:\n\n```bash\ncp .env.example .env\n```\n\n* HEADLESS: Set to `False` to see the browser\n* MAX_REQUESTS_PER_MIN: Adjust rate limits.\n\n## First Run \u0026 Login\n\n```bash\npython main.py\n```\n\nA browser window will open. Log in to your Google Account manually. Once logged in, the session cookies are saved to `auth/gemini_state.json`. The proxy will automatically enable **Temporary Chat** to keep your history clean.\n\n## API Usage\n\nThe server runs at `http://localhost:8000`. It supports the standard OpenAI chat completion format.\n\n**API Key**: You can leave it as `sk-any` or any non-empty string.\n\n## Examples\n\n```bash\ncurl http://localhost:8000/v1/chat/completions \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"gemini-1.5-pro\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Hello, how are you?\"}],\n    \"stream\": true\n  }'\n```\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"http://localhost:8000/v1\",\n    api_key=\"sk-any\" # Required but unused\n)\n\nresponse = client.chat.completions.create(\n    model=\"gemini-1.5-pro\",\n    messages=[{\"role\": \"user\", \"content\": \"Explain quantum physics\"}],\n    stream=True\n)\n\nfor chunk in response:\n    if chunk.choices[0].delta.content:\n        print(chunk.choices[0].delta.content, end=\"\")\n```\n\n## Disclaimer\n\n**PLEASE READ CAREFULLY BEFORE USE:**\n\n**Account Ban Risk: This tool automates a personal Google account. There is a significant risk that your Google account could be suspended, banned, or disabled for using this tool. DO NOT use your primary Google account. Use a burner account.**\n\n**Headless Mode Detection: Running the browser in \"Headless Mode\" (invisible window) significantly increases the chance of being detected as a bot by Google's anti-fraud systems. Use HEADLESS=False (visible mode) for a safer (though not risk-free) experience.**\n\n**No Liability: This software is provided \"AS IS\", without warranty of any kind. The author/maintainer is NOT responsible for any damages, data loss, or account bans resulting from the use of this tool. You use this software entirely at your own risk.**\n\n**Unofficial Tool: This project is not affiliated with, endorsed by, or connected to Google or Gemini.**\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe0cp%2Fgemini-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthe0cp%2Fgemini-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe0cp%2Fgemini-proxy/lists"}