Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Expose a `Filter` class with `inlet(body)` and/or `outlet(body)`, mutating the r

## Invariants to preserve

- **Valve names are the public API.** Never rename or remove one; add new valves with backward-compatible defaults.
- **Valve names and types are the public API.** Never rename or remove one; add new valves with backward-compatible defaults. Do not change a valve's type either: since Open WebUI 0.12, saving a function validates its stored valves against the new `Valves` model, so a type change can block the update for users who set that valve.
- **Secrets:** assigning to an `EncryptedStr` field encrypts (stored with an `encrypted:` prefix). Call `EncryptedStr.decrypt(...)` only at the point of use — never store the decrypted value on `self`, never log it.
- **Body allow-list:** `pipe()` filters the incoming body through an explicit `allowed_params` set before forwarding upstream. Add new provider params to that set deliberately; do not forward `body` wholesale.
- **Status events:** emit via `__event_emitter__` with `{"type": "status"|"chat:*", "data": {...}}` at start, at streaming start, and on completion *or* error. Never leave a request without a terminal status.
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,23 @@ The functions include a built-in encryption mechanism for sensitive information:
- Sends messages from Open WebUI to **Google Gemini**.
- Supports encryption of sensitive information such as API keys.
- Supports both streaming and non-streaming responses (streaming is automatically disabled for image generation models, including released IDs such as `gemini-3.1-flash-image`).
- **Thinking & reasoning**: Configurable thinking levels (`low` / `high`; `minimal` / `high` for `gemini-3.1-flash-image` and `gemini-3.1-flash-lite-image`, `minimal` / `medium` / `high` for `gemini-nano-banana-2.1`) for Gemini 3 models and thinking budgets (0–32 768 tokens) for Gemini 2.5 models, with per-chat override support.
- **Thinking & reasoning**: Configurable thinking levels for Gemini 3 models, with the levels each model supports (for example `low` / `high` on `gemini-3-pro`, `minimal` to `high` on `gemini-3-flash`, `low` / `medium` / `high` on `gemini-3.1-pro`, `minimal` / `high` on `gemini-3.1-flash-image` and `gemini-3.1-flash-lite-image`, `minimal` / `medium` / `high` on `gemini-nano-banana-2.1`) and thinking budgets (0–32 768 tokens) for Gemini 2.5 models, with per-chat override support.
- **Native reasoning display**: Thinking appears as Open WebUI's own reasoning block, live ("Thinking..." with a spinner) while Gemini thinks and as "Thought for N seconds" afterwards, with the title in each user's Open WebUI language. Google Search grounding uses Open WebUI's localized search statuses (the queries, then "Searched N sites").
- **Lean history**: Previously rendered thinking summaries are stripped from assistant messages before the conversation is replayed to the API (configurable).
- Provides configurable error handling and timeouts: temporary API errors are retried (`GOOGLE_RETRY_COUNT`) for streaming and non-streaming requests, and every started status (image, video) is closed when a request fails or is stopped.
- **Advanced image processing**: Optimized image handling with configurable compression, resizing, and quality settings.
- **Configurable parameters**: Environment variables for image optimization (quality, max dimensions, format conversion).
- **Multi-image history**: Image edits across turns: the generated and uploaded images of a saved chat are sent with the edit request (temporary chats send only your own uploads). Configurable image limit that keeps the current and the newest images, hash-based deduplication, and automatic `[Image N]` labels so the model can reference earlier images.
- **Multi-image history**: Image edits across turns: the generated and uploaded images of a saved chat are sent with the edit request (temporary chats send only your own uploads), also for everyone who replies in a chat shared with "Allow replies" (Open WebUI 0.12; who may read a chat or file is decided by Open WebUI's own access checks, and a file another participant names is used only if that participant may read it too). Configurable image limit that keeps the current and the newest images, hash-based deduplication, and automatic `[Image N]` labels so the model can reference earlier images.
- **Image generation (Gemini 3)**: Configurable aspect ratio (for example `16:9` or `1:1`) and resolution (`1K`, `2K`, or `4K`) for Gemini 3 image models, with per-user valve overrides.
- **Nano Banana image models**: `gemini-nano-banana-2.1`, `gemini-3.1-flash-image` and `gemini-3.1-flash-lite-image` are detected as image models; each generated image is uploaded once (interim thought images are skipped unless no final image arrives). API clients get generated images and videos as links in the answer. Google Search grounding is left out for the image models without Search support (`gemini-2.5-flash-image`, `gemini-3.1-flash-lite-image`). Newer image models outside Gemini 3 / Nano Banana naming can be added via `GOOGLE_IMAGE_GENERATION_MODELS` without a code change.
- **Video generation (Veo)**: Generate videos with Google Veo models (3.1, 3, 2). Configurable aspect ratio, resolution, duration, negative prompt, and person generation controls. Supports text-to-video and image-to-video for all supported Veo models. Videos are automatically uploaded and embedded with playback controls.
- **Token usage tracking**: Returns prompt, completion, and total token counts to Open WebUI for automatic persistence in the database, for streaming and non-streaming responses.
- **Background tasks**: Works as the Open WebUI task model for title, tag and follow-up generation (without Google Search grounding, even when the chat uses it).
- **Background tasks**: Works as the Open WebUI task model for title, tag and follow-up generation (without Google Search grounding, even when the chat uses it) and for context compaction, where a failed or empty summary leaves Open WebUI's own summary of the compacted messages instead of an error text.
- **Model whitelist & additional models**: Restrict the visible model list via `GOOGLE_MODEL_WHITELIST` and add SDK-unsupported models via `GOOGLE_MODEL_ADDITIONAL`; changes show on the next model list refresh, without waiting for the model cache TTL.
- Grounding with Google Search via the [google_search_tool.py filter](./filters/google_search_tool.py)
- Grounding with Vertex AI Search via the [vertex_ai_search_tool.py filter](./filters/vertex_ai_search_tool.py)
- [Native tool calling through Open WebUI's tool loop](./docs/google-gemini-integration.md#native-tool-calling) (built-in, workspace, MCP, OpenAPI, terminal and direct tools, tool approval); tool calls are returned to API clients
- Works with Open WebUI 0.12's [Tool Search](./docs/google-gemini-integration.md#tool-search-open-webui-012) (tools found by `search_tools` are declared to Gemini so it can call them) and [compaction during long tool runs](./docs/google-gemini-integration.md#context-compaction-during-tool-runs)
- Configurable API version support

🔗 [Google Gemini Pipeline in Open WebUI](https://openwebui.com/f/owndev/google_gemini)
Expand Down
Loading
Loading