Skip to content

Commit 47f7b73

Browse files
committed
sync: v1.3.11
1 parent fdae371 commit 47f7b73

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,10 @@ The proxy reads accounts from `accounts.json` in the config directory:
332332
| `ZEROGRAVITY_SYSTEM_MODE` | `stealth` | `stealth` = keep backend prompt, inject user system prompt as override; `minimal` = replace 20KB prompt with minimal identity + user prompt |
333333
| `ZEROGRAVITY_SENSITIVE_WORDS` | built-in list | Comma-separated client names to obfuscate in requests (zero-width spaces), or `none` to disable |
334334
| `ZEROGRAVITY_MODEL_ALIASES` || Map custom model names to built-in models, e.g. `gpt-4o:gemini-3-flash,gpt-4:opus-4.6`. Also configurable via `zg alias` or `aliases.json` |
335-
| `ZEROGRAVITY_API_BODY_LIMIT_MB` | `32` (clamped `1..100`) | Max request body size in MiB for API routes (`/v1/*`) | `64` |
335+
| `ZEROGRAVITY_API_BODY_LIMIT_MB` | `32` (clamped `1..100`) | Max request body size in MiB for API routes (`/v1/*`) |
336+
| `ZEROGRAVITY_QUOTA_CAP` | `0.2` | Per-account quota usage cap (0.0-1.0), triggers rotation. `0` to disable. Also available as `--quota-cap` CLI flag |
337+
| `ZEROGRAVITY_UPSTREAM_PROXY` || Route all outbound MITM traffic through a proxy (`http://`, `socks5://`, `socks5h://`) |
338+
| `ZEROGRAVITY_HTTP_PROXY` || Pass HTTP/HTTPS proxy settings to the backend child process |
336339

337340
**System prompt mode:** When your client sends a system prompt (e.g. via OpenAI `system` role), ZeroGravity injects it into the request. In `stealth` mode, the backend's identity is stripped and your prompt takes over. In `minimal` mode, the entire 20KB backend prompt is replaced — saves tokens but may trigger rate limiting on Pro models.
338341

docs/api.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,33 @@ curl http://localhost:8741/v1beta/models/gemini-3-flash:generateContent \
265265
| `GET/POST` | `/` | Compatibility root (returns status) |
266266
| `POST` | `/api/event_logging/batch` | Compatibility event logging endpoint |
267267
| `GET/POST` | `/.well-known/{*path}` | Compatibility well-known endpoint |
268+
269+
## Behavior Notes
270+
271+
### Default Output Tokens
272+
273+
When a client omits `max_tokens` (Anthropic), `max_completion_tokens` (OpenAI), or `max_output_tokens` (OpenAI Responses), the proxy defaults to **64,000 tokens** -- just below Gemini's 65,536 ceiling. The MITM layer enforces a minimum of 4,096 regardless. This means clients that previously got errors for missing `max_tokens` now receive a sensible default.
274+
275+
### Thinking Budget (Claude Aliases)
276+
277+
Claude aliases (`opus-4.6`, `sonnet-4.6`) are backed by Gemini models. When clients send `budget_tokens` via the Anthropic Messages API, the proxy maps it to Gemini thinking levels:
278+
279+
| budget_tokens | Gemini thinkingLevel |
280+
|---------------|---------------------|
281+
| 0 | disabled |
282+
| 1 -- 512 | minimal |
283+
| 513 -- 1024 | low |
284+
| 1025 -- 4096 | medium |
285+
| 4097+ | high |
286+
287+
Raw integer budgets cause 400 INVALID_ARGUMENT on Gemini 3+ models. The proxy handles this automatically.
288+
289+
### Tool Calling
290+
291+
OpenAI and Anthropic tool/function declarations are translated to Gemini's format. During translation:
292+
- **Constraint hints** (`minLength`, `maxLength`, `pattern`, `format`, `default`, `examples`) are preserved as description text since Gemini strips these JSON Schema keys
293+
- **Nullable properties** are removed from `required` arrays
294+
- **Union types** (e.g. `["string", "array"]`) produce "Accepts: string | array" description hints
295+
- **Non-standard keys** (`strict`, `x-*` prefixed, etc.) are stripped before sending to Gemini
296+
297+
Gemini-native tool declarations (via `/v1beta/`) pass through with zero translation.

docs/docker.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,11 @@ docker run -d --name zerogravity \
111111
| `ZEROGRAVITY_IDE_VERSION` | Auto-detected | Preferred override for reported IDE version | `1.19.4` |
112112
| `ZEROGRAVITY_CLIENT_VERSION` | Auto-detected | Override the client version string | `1.15.8` |
113113
| `ZEROGRAVITY_DEVICE_FINGERPRINT` | Auto-detected | Override reported device fingerprint (UUID required) | `11111111-2222-4333-8444-555555555555` |
114-
| `ZEROGRAVITY_API_BODY_LIMIT_MB` | `32` (clamped `1..100`) | Max request body size in MiB for API routes (`/v1/*`) | `64` |
114+
| `ZEROGRAVITY_API_BODY_LIMIT_MB` | `32` (clamped `1..100`) | Max request body size in MiB for API routes (`/v1/*`) | `64` |
115115
| `SSL_CERT_FILE` | System default | Custom CA certificate bundle path | `/etc/ssl/certs/ca.pem` |
116116
| `RUST_LOG` | `warn` (runtime default) / `info` (`zg docker-init` template) | Log level | `debug` |
117+
| `ZEROGRAVITY_DOH` | `0` (disabled) | Enable DNS-over-HTTPS via dns.google (`1` to enable) | `1` |
118+
| `ZEROGRAVITY_STREAM_IDLE_TIMEOUT_SECS` | `120` | Stream idle timeout in seconds before closing | `300` |
117119

118120
### Customization
119121

@@ -133,7 +135,7 @@ Serializes generation requests to prevent thundering-herd failures when multiple
133135
| ------------------------------- | -------- | ---------------------------------------------------------- | -------- |
134136
| `ZEROGRAVITY_QUEUE_ENABLED` | `true` | Set to `false`, `0`, or `no` to disable the queue entirely | `false` |
135137
| `ZEROGRAVITY_QUEUE_CONCURRENCY` | `2` | Max concurrent requests to Google | `4` |
136-
| `ZEROGRAVITY_QUEUE_INTERVAL_MS` | `300` | Anti-burst gap between consecutive requests (ms) | `500` |
138+
| `ZEROGRAVITY_QUEUE_INTERVAL_MS` | `0` | Anti-burst gap between consecutive requests (ms) | `500` |
137139
| `ZEROGRAVITY_QUEUE_TIMEOUT_MS` | `600000` | Max wait time in queue before HTTP 408 | `300000` |
138140
| `ZEROGRAVITY_QUEUE_MAX_SIZE` | `50` | Max queue depth; excess requests get HTTP 503 | `100` |
139141

0 commit comments

Comments
 (0)