Skip to content

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
hiyukoim:feat/gemini-3-support
Open

feat: upgrade to gemini-webapi 2.0.0 with Gemini 3 model support & Expose Gemini Gems via REST endpoints#70
hiyukoim wants to merge 3 commits intoAmm1rr:masterfrom
hiyukoim:feat/gemini-3-support

Conversation

@hiyukoim
Copy link
Copy Markdown

@hiyukoim hiyukoim commented Apr 8, 2026

Change 1: Gemini 3 Model Support (gemini-webapi 2.0.0)

Summary

  • Upgrade gemini-webapi from 1.8.3 to >= 2.0.0 to add Gemini 3 model support
  • Update GeminiModels enum with all available Gemini 3 models: gemini-3-pro, gemini-3-flash, gemini-3-flash-thinking, plus Plus and Advanced tier variants
  • Relax pinned dependency versions (pydantic, curl-cffi, cffi, typing-extensions, pydantic-core) to resolve conflicts with gemini-webapi 2.0.0
  • Update default model to gemini-3-flash
  • Update config.conf.example with current available model list

Breaking Change

gemini-webapi 2.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/completions with gemini-3-flash and gemini-3-pro
  • /gemini endpoint (single-turn)
  • /translate endpoint
  • ✅ Cookie rotation (read-write config)
  • ✅ Gemini client initialisation with gemini-webapi 2.0.0

Known Issue

/gemini-chat session persistence does not work correctly. The chat ID resets between messages, so the model loses context. This appears to be an upstream issue in gemini-webapi 2.0.0 (ChatSession.cid changes on each send_message call) and is not introduced by this PR. An upstream issue will be filed separately.

Change 2: Expose Gems Support (via gemini-webapi)

Summery

  • Add optional gem parameter to all endpoints (/gemini, /gemini-chat,
    /v1/chat/completions)
  • New /v1/gems endpoint to list available gems (predefined + custom)
  • Pass a gem ID or name to use Gemini Gems as system prompts
POST /v1/chat/completions
{
  "model": "gemini-3-flash",
  "messages": [{"role": "user", "content": "hello"}],
  "gem": "brainstormer"
}
  • ✅ /v1/gems listing (predefined + custom)
  • ✅ Chat with predefined gem
  • ✅ Chat with custom gem
  • ✅ Backward compatible (gem parameter is optional)

hiyukoim and others added 2 commits April 8, 2026 22:44
- 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>
@hiyukoim hiyukoim changed the title feat: upgrade to gemini-webapi 2.0.0 with Gemini 3 model support feat: upgrade to gemini-webapi 2.0.0 with Gemini 3 model support & Gem Support Apr 9, 2026
@hiyukoim hiyukoim changed the title feat: upgrade to gemini-webapi 2.0.0 with Gemini 3 model support & Gem Support feat: upgrade to gemini-webapi 2.0.0 with Gemini 3 model support & Expose Gemini Gems via REST endpoints Apr 9, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant