DEV.co
AI Frameworks · HanaokaYuzu

Gemini-API

Gemini-API is a reverse-engineered Python wrapper for Google's Gemini web interface, offering asynchronous access to text generation, image/video/audio creation, and multi-turn conversations with automatic cookie refresh for persistent authentication.

Source: GitHub — github.com/HanaokaYuzu/Gemini-API
3.3k
GitHub stars
518
Forks
Python
Primary language
AGPL-3.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
RepositoryHanaokaYuzu/Gemini-API
OwnerHanaokaYuzu
Primary languagePython
LicenseAGPL-3.0 — OSI-approved
Stars3.3k
Forks518
Open issues44
Latest releasev2.0.0 (2026-04-06)
Last updated2026-06-22
Sourcehttps://github.com/HanaokaYuzu/Gemini-API

What Gemini-API is

Async Python library that mirrors Gemini's web API surface without official SDK, supporting streaming, extensions, deep research workflows, and classified response outputs (text, images, thoughts, videos). Requires credential extraction from authenticated browser sessions and manages session persistence via background cookie refresh.

Quickstart

Get the Gemini-API source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/HanaokaYuzu/Gemini-API.gitcd Gemini-API# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Chatbot and conversational AI backends

Async-first design with multi-turn conversation support and persistent session management makes it suitable for building always-on chatbot services.

Multimodal content generation pipelines

Native support for image generation, video/audio synthesis, and text in a single API call enables complex generative workflows without multiple service calls.

Research and analysis automation

Deep research workflow with plan creation and status polling supports building autonomous research agents and analysis tools.

Implementation considerations

  • Requires manual extraction of `__Secure-1PSID` and `__Secure-1PSIDTS` cookies from authenticated browser sessions; optional browser-cookie3 dependency automates this for supported browsers only.
  • Background cookie auto-refresh may trigger re-authentication prompts in the browser; deploy isolated login sessions to avoid disruption.
  • No rate limiting or backpressure handling exposed; implement client-side throttling to avoid detection or blocking by Google's anti-bot measures.
  • Classified response outputs (thoughts, candidate replies, extended generation metadata) require parsing multiple response attributes; consult ModelOutput schema carefully.
  • Deep research and extension features are subject to real-time availability on gemini.google.com; fallback behavior for unsupported regions/accounts is undocumented.

When to avoid it — and what to weigh

  • Production systems requiring SLA guarantees — Reverse-engineered API with no official support or service-level agreements; breaking changes risk is material when Google updates the web interface.
  • Compliance-critical or regulated environments — No audit trail, official security documentation, or Terms of Service alignment; use of unofficial APIs may violate compliance frameworks or Google's ToS.
  • High-volume commercial API usage — Intended for programmatic web scraping; lacks rate limiting controls, usage tiers, and official authentication. Google may block accounts or IP ranges.
  • Team development with strict licensing requirements — AGPL-3.0 license requires source code disclosure of derivative works and modifications; commercial/proprietary integration requires legal review.

License & commercial use

AGPL-3.0 (GNU Affero General Public License v3.0). Strong copyleft: any distributed modifications or derivative works must disclose source code to end-users. If integrated into a network service, the modified source must be made available to service users. Commercial use is permitted only if all derived code is also released under AGPL-3.0.

AGPL-3.0 permits commercial use but requires source disclosure of modifications. If deployed as a service (e.g., SaaS), users must receive the modified source code. Proprietary integrations or internal-only deployment may require relicensing or legal review. Additionally, use of an unofficial reverse-engineered API may violate Google's Terms of Service; commercial use requires assessment of ToS compliance independent of open-source licensing.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityModerate
DEV.co fitPossible
Assessment confidenceMedium
Security considerations

No formal security audit or threat model documented. Authentication depends on long-lived browser session cookies; if leaked, no rotation mechanism is built-in (relies on Google's backend). Background cookie refresh mechanism auto-executes without explicit user consent; implications for headless/automated environments require case-by-case assessment. Reverse-engineering nature means no cryptographic transport validation or API versioning; payloads could be subject to MITM if proxy is misused. For regulated or sensitive data, official Gemini API (via Vertex AI) is strongly preferred.

Alternatives to consider

Google Generative AI Python SDK (official)

Official, supported API with stable SDKs, published security policies, SLA guarantees, and clear ToS. No AGPL copyleft or reverse-engineering risks. Preferred for production and commercial use.

OpenAI API + GPT-4

Mature, widely-deployed commercial API with clear pricing, rate limits, audit trails, and compliance features. Different model behavior but lower operational risk for business-critical applications.

Anthropic Claude API

Official SDK with published safety research, transparent pricing, and compliance controls. Suitable for high-assurance use cases where model transparency is valued.

Software development agency

Build on Gemini-API with DEV.co software developers

For commercial or compliance-critical use, consult our team on official Google Cloud APIs and custom AI development services.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

Gemini-API FAQ

Can I use this in a commercial product?
AGPL-3.0 permits commercial use, but derivative code must be open-sourced. Additionally, Google's ToS likely prohibits reverse-engineered API usage for production; independent legal review is mandatory.
What happens if Google changes the web interface?
The API will break. No versioning, deprecation, or compatibility guarantees exist. The maintainer must reverse-engineer and patch. Critical for production systems.
How does cookie auto-refresh work?
Background task continuously refreshes `__Secure-1PSIDTS` to maintain session validity without manual re-authentication. For containerized deployments, `GEMINI_COOKIE_PATH` env var persists cookies across restarts.
Is this as reliable as the official Gemini API?
No. This is a best-effort reverse-engineering project with no SLA, audit trail, or official support. Use the official Google Generative AI SDK for production systems.

Work with a software development agency

DEV.co helps companies turn open-source tools like Gemini-API into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your ai frameworks stack.

Need a production-ready Gemini integration?

For commercial or compliance-critical use, consult our team on official Google Cloud APIs and custom AI development services.