← Back to Plugins
Integration

St Ultra Pure

ziyuanlingo By ziyuanlingo 👁 12 views ▲ 0 votes

Zero-overhead SillyTavern (OpenAI-compatible) passthrough plugin & one-click portable gateway kit for OpenClaw (Google AI Ultra Plan) | EN / 日本語 / 简体中文

GitHub

README

# 🎀 openclaw-st-ultra-pure

**English** | [简体中文](./README.zh-CN.md) | [日本語](./README.ja.md)

**Zero-Overhead SillyTavern (OpenAI-Compatible) Passthrough Plugin & One-Click Portable Gateway Kit for OpenClaw (`Google AI Ultra Plan`)**

[![Version](https://img.shields.io/badge/Version-v1.0.1-ec6aa0.svg)](https://github.com/ziyuanlingo/openclaw-st-ultra-pure/releases/tag/v1.0.1)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
[![OpenClaw](https://img.shields.io/badge/OpenClaw-2026.12%2B-00b894.svg)](https://docs.openclaw.ai/providers/google-ai-ultra-plan)
[![Zero Dependencies](https://img.shields.io/badge/Dependencies-Zero-brightgreen.svg)](./plugins/st-ultra-pure/index.mjs)

---

## Why This Exists

OpenClaw officially supports signing in directly with a **Google AI Ultra** subscription account via OAuth (`openclaw models auth login --provider google`) to access four independent daily quota pools (`gemini-4-carbon`, `gemini-4-hydrogen`, `gemini-4-neon`, and `gemini-3.5-flash-lite`, each with `1M` context and `65K` max output) at zero extra API cost, plus built-in `/v1/chat/completions` OpenAI-compatible proxying.

However, connecting **SillyTavern** directly to a stock OpenClaw Gateway suffers from **four severe hidden bottlenecks**:

1. **~14,000–16,000 Tokens of Built-In Agent Bloat**: Even on `/v1/chat/completions`, OpenClaw injects dozens of built-in coding/workspace tools (~10,000+ tokens) plus ~7,600 characters of hardcoded assistant persona (`You are a personal assistant...`, `Execution Bias`, `Care`, `Workspace`, `Runtime`, `### Message Context`, and `Model:`), while legacy `systemPromptOverride` has been deprecated and rejected by `openclaw doctor`.
2. **Hidden `toolSearch` Meta-Tools (~2,500+ Chars)**: Even with `tools.deny: ["*"]`, OpenClaw `2026.12+` still injects three hidden discovery tools (`dispatch_action`, `tool_describe`, `tool_search`) unless `toolSearch` and `codeMode` are explicitly disabled.
3. **Hidden `⟦openclaw:ctx⟧` Timestamp User Block**: OpenClaw prepends a hidden `Conversation info: ⟦openclaw:ctx⟧` JSON `user` message containing the current real-world date/time on every turn—wasting tokens and breaking immersion in fantasy/historical roleplay cards.
4. **Flattened Multi-Turn History**: Multi-turn `[user, assistant, ...]` arrays sent by SillyTavern are flattened into a single string (`[Chat messages since your last reply - for context]\nUser: ...\nAssistant: ...`) instead of native multi-turn Gemini `contents`.

**`openclaw-st-ultra-pure`** solves all four issues cleanly via official OpenClaw plugin hooks (`openclaw doctor` & `openclaw config validate` 100% clean) and provides a **self-contained one-click setup wizard** (`EN / 日本語 / 简体中文`) for Windows, macOS, and Linux.

---

## How `st-ultra-pure` Achieves True 0-Byte Overhead

1. **Stage 1 (Explicit `group:*` Built-In Tool Denylist + `toolSearch: false`)**: Disables 100% of OpenClaw's built-in tools (`group:openclaw`, `group:plugins`, `group:fs`, etc.) and `toolSearch` / `codeMode` **without** using wildcard `"*"` or `toolsAllow: []`. When SillyTavern sends plain text, `hasTools: false` (0 tools sent upstream); **when SillyTavern sends its own client `tools` / `tool_choice` (such as anti-truncation function-calling presets), they pass through 100% intact and return native OpenAI `tool_calls` SSE chunks!**
2. **Stage 2 (`before_model_request`)**: Intercepts the final `google-generative-ai` REST payload right before transmission:
   - **0-Byte Base Overhead**: Surgically extracts *only* SillyTavern's own `system` / `developer` prompts from `## Conversation Context` into `systemInstruction.parts` (deleting `systemInstruction` completely when SillyTavern sends none).
   - **Sentinel Metadata Purge**: Strips all `⟦openclaw:ctx⟧` JSON metadata blocks, `<active_memory_plugin>` blocks, and envelope timestamps.
   - **Native Multi-Turn Unfolding**: Unfolds OpenClaw's packed `User: / Assistant:` string back into strictly alternating Gemini `{ role: "user" | "model", parts }` turns (automatically handling SillyTavern cards that begin with an `assistant` greeting).

---

## Quick Start (Method A: One-Click Portable Kit — Recommended)

No pre-installed Node.js or global CLI required! If your system does not have Node.js `>= 24.16.0`, the bootstrapper automatically downloads a portable Node.js `v24.23.0` into `./runtime/node` without touching your global environment.

### 1. Run the Setup Wizard

- **Windows**: Extract or clone this folder and double-click **`setup.cmd`**
- **macOS / Linux**:
  ```bash
  chmod +x setup.sh && ./setup.sh
  ```

The wizard supports **English / 日本語 / 简体中文**, auto-detects local HTTP proxies (such as `7890`, `10808`, or `"none"` for direct connection), installs `openclaw@latest` locally into `./app`, and generates `./state/openclaw.json` plus four launcher scripts.

### 2. Sign In with Google AI Ultra

- **Windows**: Double-click **`1_Login_Google_Ultra.cmd`**
- **macOS / Linux**: Run **`./1_login_google_ultra.sh`**

Sign in with your Google account subscribed to **Google AI Ultra** in the browser window that opens.
> **Multi-Account Tip**: Have multiple Google AI Ultra accounts? Simply run script `1` again! OpenClaw stores each account as a separate profile by email. *(Note: OAuth tokens are DPoP hardware-bound to your machine; do not copy `./state` across different PCs—just sign in on each machine.)*

### 3. Start the Gateway & Connect SillyTavern

1. Start the local gateway (**Windows**: double-click **`2_Start_ST_Gateway.cmd`** | **macOS/Linux**: **`./2_start_st_gateway.sh`**). Simply close the window when done—zero background daemons remain!
2. In **SillyTavern**, open **API Connections** (plug icon) and set:
   - **API**: `Chat Completion`
   - **Chat Completion Source**: `Custom (OpenAI-compatible)`
   - **Custom Endpoint (Base URL)**: `http://127.0.0.1:18789/v1`
   - **Custom API Key**: `st-openclaw-local` *(or the custom token you chose during setup)*
3. Click **Connect** and select any pre-configured model + thinking tier directly from SillyTavern's **Available Models** dropdown!

---

## Pre-Configured Model & Thinking Dropdown Tiers

Google AI Ultra provides **4 separate daily quota pools** (resetting daily at midnight PT):

| Quota Pool | SillyTavern Dropdown ID | Underlying Model | Thinking Level | Recommended Use |
| :--- | :--- | :--- | :--- | :--- |
| **Pool 1: Carbon** | `openclaw/st-gemini-4-carbon-high` | `google/gemini-4-carbon` | `high` | Deep plot & complex long-form RP |
| **Pool 1: Carbon** | `openclaw/st-gemini-4-carbon-medium` | `google/gemini-4-carbon` | `medium` | **Sweet Spot**: Best balance of prose & speed |
| **Pool 1: Carbon** | `openclaw/st-gemini-4-carbon-adaptive` | `google/gemini-4-carbon` | `adaptive` | Dynamic adaptive thinking budget |
| **Pool 1: Carbon** | `openclaw/st-gemini-4-carbon-low` | `google/gemini-4-carbon` | `low` | Fast casual chat |
| **Pool 1: Carbon** | `openclaw/st-gemini-4-carbon-off` | `google/gemini-4-carbon` | `off` | Thinking off / preset-managed CoT |
| **Pool 2: Hydrogen** | `openclaw/st-gemini-4-hydrogen-high` | `google/gemini-4-hydrogen` | `high` | Secondary flagship pool (High) |
| **Pool 2: Hydrogen** | `openclaw/st-gemini-4-hydrogen-medium` | `google/gemini-4-hydrogen` | `medium` | Secondary flagship pool (Medium) |
| **Pool 2: Hydrogen** | `openclaw/st-gemini-4-hydrogen-low` | `google/gemini-4-hydrogen` | `low` | Secondary flagship pool (Low) |
| **Pool 2: Hydrogen** | `openclaw/st-gemini-4-hydrogen-off` | `google/gemini-4-hydrogen` | `off` | Secondary flagship pool (Off) |
| **Pool 3: Neon** | `openclaw/st-gemini-4-neon-high` | `google/gemini-4-neon` | `high` | Third independent pool (High) |
| **Pool 3: Neon** | `openclaw/st-gemini-4-neon-medium` | `google/gemini-4-neon` | `medium` | Third independent pool (Medium) |
| **Pool 3: Neon** | `openclaw/st-gemini-4-neon-low` | `google/gemini-4-neon` | `low` | Third independent pool (Low) |
| **Pool 3: Neon** | `openclaw/st-gemini-4-neon-off` | `google/gemini-4-neon` | `off` | Third independent pool (Off) |
| **Pool 4: Flash-Lite** | `openclaw/st-gemini-3-5-flash-lite-medium` | `google/gemini-3.5-flash-lite` | `medium` | Summaries, worldbook tables & memory |
| **Pool 4: Flash-Lite** | `openclaw/st-gemini-3-5-flash-lite-off` | `google/gemini-3.5-flash-lite` | `off` | Instant auxiliary tasks |

---

## Method B: Manual Plugin Install (For Existing OpenClaw Users)

If you already run a global `openclaw` installation:

1. Copy `./plugins/st-ultra-pure` to any permanent directory on your machine.
2. Merge [`examples/openclaw.st-snippet.json`](./examples/openclaw.st-snippet.json) into your `openclaw.json` (updating `plugins.load.paths` to point to your `st-ultra-pure` folder).
3. Verify with `openclaw config validate` and restart your Gateway.

---

## Running Tests

```bash
npm test
```

## License

Released under the [MIT License](./LICENSE).
integration

Comments

Sign in to leave a comment

Loading comments...