feat: upgrade to gemini-webapi 2.0.0 with Gemini 3 model support & Expose Gemini Gems via REST endpoints#70
Open
hiyukoim wants to merge 3 commits intoAmm1rr:masterfrom
Open
Conversation
- Upgrade gemini-webapi from 1.8.3 to >= 2.0.0 - Update GeminiModels enum to match new model names (gemini-3-pro, gemini-3-flash, gemini-3-flash-thinking, plus/advanced tiers) - Relax pinned dependency versions (pydantic, curl-cffi, cffi, typing-extensions) to resolve conflicts with gemini-webapi 2.0.0 - Update default model from gemini-3.0-pro to gemini-3-flash - Update config.conf.example with current available models BREAKING: gemini-webapi 2.0.0 drops older model names (gemini-1.5-*, gemini-2.0-*, gemini-2.5-*). Only Gemini 3 series models are now available. This is a change in the upstream library. Tested against live Gemini API with cookie auth on a headless server. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add gem parameter to all endpoints (/gemini, /gemini-chat, /v1/chat/completions) and a new /v1/gems endpoint for listing available gems (predefined + custom). Gems act as system prompts for Gemini, enabling persona-based responses. Pass a gem ID or name via the "gem" field in request body. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gemini_webapi rotates cookies on startup but does not write them back to disk. Add _persist_cookies() called from init() so that refreshed values are saved to config.conf [Cookies] section, preventing logout-on-restart when the cookie has been silently rotated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change 1: Gemini 3 Model Support (gemini-webapi 2.0.0)
Summary
gemini-webapifrom 1.8.3 to >= 2.0.0 to add Gemini 3 model supportGeminiModelsenum with all available Gemini 3 models:gemini-3-pro,gemini-3-flash,gemini-3-flash-thinking, plus Plus and Advanced tier variantspydantic,curl-cffi,cffi,typing-extensions,pydantic-core) to resolve conflicts with gemini-webapi 2.0.0gemini-3-flashconfig.conf.examplewith current available model listBreaking Change
gemini-webapi2.0.0 drops older model identifiers (gemini-1.5-*,gemini-2.0-*,gemini-2.5-*).Only Gemini 3 series models are available with this upgrade. This is an upstream library change. The old model names no longer resolve on the Gemini web API.
Testing
Tested on a headless Ubuntu 24.04 server (Docker) with cookie-based authentication:
/v1/chat/completionswithgemini-3-flashandgemini-3-pro/geminiendpoint (single-turn)/translateendpointgemini-webapi2.0.0Known Issue
/gemini-chatsession persistence does not work correctly. The chat ID resets between messages, so the model loses context. This appears to be an upstream issue ingemini-webapi2.0.0 (ChatSession.cidchanges on eachsend_messagecall) and is not introduced by this PR. An upstream issue will be filed separately.Change 2: Expose Gems Support (via gemini-webapi)
Summery
gemparameter to all endpoints (/gemini,/gemini-chat,/v1/chat/completions)/v1/gemsendpoint to list available gems (predefined + custom)