Skip to main content

A friendly, MIT-licensed alternative to Gemini-WebAPI for interacting with Google Gemini Web.

Project description

Gemini-WebCookie

A powerful and flexible library for interacting with Google Gemini Web, supporting both Cookie-based and Anonymous (No-Cookie) modes.

Highlights (From Version 0.1.4)

Starting from version 0.1.4, Gemini-WebCookie is no longer just a replacement for Gemini-WebAPI but has evolved with powerful independent features:

  • Anonymous Mode: Operates completely without cookies (__Secure-1PSID).
  • Context Preservation: Automatically manages chat history (CID, RID, RCID) even in anonymous mode.
  • Background Auto-Refresh: System automatically updates tokens and maintains sessions in the background.
  • Full Feature Support: Chat, Image Generation, Gems Management, and File Uploads.

Installation

pip install gemini-webcookie

Usage

1. Anonymous Mode (No Cookies Required)

This is a major feature that goes beyond standard Gemini wrappers:

import asyncio
from gemini_webcookie import GeminiClient

async def main():
    # Initialize without parameters for anonymous mode
    client = GeminiClient()
    await client.init()
    
    chat = client.start_chat()
    response = await chat.send_message("Hello, who are you?")
    print(f"AI: {response.text}")
    
    # Context is automatically preserved for the next question
    response2 = await chat.send_message("What can you help me with?")
    print(f"AI: {response2.text}")

    await client.close()

asyncio.run(main())

2. Cookie-based Mode (Full Features)

from gemini_webcookie import GeminiClient

client = GeminiClient(
    secure_1psid="YOUR_1PSID",
    secure_1psidts="YOUR_1PSIDTS"
)

License

This project is dual-licensed under the MIT License and the Apache License 2.0. You may choose either license according to your needs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gemini_webcookie-0.1.5.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gemini_webcookie-0.1.5-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file gemini_webcookie-0.1.5.tar.gz.

File metadata

  • Download URL: gemini_webcookie-0.1.5.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for gemini_webcookie-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c189a20ac86f465187361ecbccc0acc017c9fe48b4f3f2c5385d21d59cca6d63
MD5 5c327702a2a532d86dea70410167b467
BLAKE2b-256 4c3bd6981a4526f771808e1192f70c21aabcb68c393112886bf54f822052ff80

See more details on using hashes here.

File details

Details for the file gemini_webcookie-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for gemini_webcookie-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 38f0c891deb88c1e28652f9fc79d7db1281e1b114fdc01fd93bb774e91ede3c0
MD5 70b7e97ade530b99cd4189341daeb69b
BLAKE2b-256 01aaa6cd44979ea8dec3efd48bd2caebd37ec606474073a7ac01398538f379a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page