Compare commits
48 Commits
v3.11.7
...
850c7d1e82
4
.gitignore
vendored
4
.gitignore
vendored
@@ -11,7 +11,3 @@ config.toml
|
||||
.DS_Store
|
||||
DEBIAN/
|
||||
usr/
|
||||
oauth-secrets.json
|
||||
secrets/
|
||||
*.secret
|
||||
.env
|
||||
|
||||
355
CHANGELOG.md
355
CHANGELOG.md
@@ -1,360 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## v3.11.7 (2026-05-26)
|
||||
|
||||
**Vision Auto-Detect, Proactive Non-Vision Model Detection, Unit Tests, Bug Fixes**
|
||||
|
||||
### New Features
|
||||
|
||||
- **Vision auto-detect fallback**: When no explicit vision fallback is configured, automatically uses the current provider's own vision model (e.g., `0G-Qwen-VL` for OpenAdapter) as the image description API — no separate API key needed
|
||||
- **Proactive non-vision model detection**: Models matching name patterns (`glm`, `deepseek`, `llama`, `qwen` without `vl`, etc.) are detected as non-vision on first request without waiting for an error from the provider
|
||||
- **Vision preprocessing is now the primary image handling solution**: Replaces old `_strip_images_from_input()` (which just removed images with a placeholder). Images are now described via API and sent as rich text descriptions to text-only models
|
||||
- **Merge PR #6**: Vision/OCR preprocessing for text-only models (cobra91)
|
||||
- **Merge PR #7**: 177 unit tests for translate-proxy.py (cobra91)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **AttributeError fix**: `image_url` field can be a string (bare URL) not always a dict — fixed in both `_preprocess_vision_input()` and old strip function
|
||||
- **Auth os error 2 fix**: GUI shows "Config missing" message instead of raw OSError when `~/.codex/` directory doesn't exist
|
||||
- **Removed duplicate vision functions**: Cleaned up duplicate `_vision_describe_image()`, `_preprocess_vision()`, `_preprocess_vision_input()` from merge
|
||||
|
||||
## v3.11.6 (2026-05-26)
|
||||
|
||||
**Antigravity Loop Breakers, Vision/OCR Preprocessing, has_content Fix, Auth Error Fix**
|
||||
|
||||
### New Features (Antigravity-only, no other providers affected)
|
||||
|
||||
- **Per-session loop tracking**: `_ANTIGRAVITY_LOOP_TRACKER` global dict with `_antigravity_loop_key()` function tracks state per session: `latest_user_hash`, `nudge_injected`, `latest_user_appended`, `tool_calls_for_request`, `repeated_tool`, `force_finalize`, `last_tool`, `last_tool_count`
|
||||
- **Edit-intent nudge injection**: Injected only on the first turn per request, preventing duplicate nudges across retries
|
||||
- **Latest user instruction append**: Appended exactly once per request to prevent redundant instruction stacking
|
||||
- **Loop breaker**: If the same tool + arguments is repeated ≥ 5 times in a session, `force_finalize` is triggered to break the infinite loop
|
||||
- **Detailed `[antigravity-loop]` logging**: All tracking fields logged on every Antigravity request for debugging
|
||||
|
||||
### New Features (All OpenAI-compatible providers)
|
||||
|
||||
- **Vision/OCR preprocessing**: When a provider doesn't support images (detected via error messages like "unknown variant image_url", "does not support image"), the proxy automatically calls a configurable vision fallback API (default: Kilo.ai) to describe images as text, then replaces image blocks with text descriptions before sending to text-only models
|
||||
- **`_vision_describe_image()`**: Calls vision fallback model to describe a single image, with MD5-based caching to avoid re-describing same URL
|
||||
- **`_preprocess_vision()`**: Replaces `image_url`/`input_image` blocks in Chat Completions message format with text descriptions when provider lacks vision support
|
||||
- **`_preprocess_vision_input()`**: Same for Responses API input format — runs BEFORE adapter conversion so images are replaced early
|
||||
- **Vision error retry**: On HTTP 4xx errors containing image-related keywords, automatically retries with images preprocessed instead of failing
|
||||
- **Configurable via env vars**: `VISION_FALLBACK_URL`, `VISION_FALLBACK_MODEL`, `VISION_FALLBACK_KEY`
|
||||
- **ProviderSchema `supports_vision` field**: Auto-detected from error responses and persisted in provider-caps.json
|
||||
|
||||
### Critical Fixes
|
||||
|
||||
- **`has_content` now includes `function_call`** (v3.11.5 fix): `_observe_event` only checked for `"type": "message"` — when models return only tool calls (no text), `has_content` was `False`, causing Codex to loop infinitely and build context until `context_length_exceeded`. Now checks both `"message"` and `"function_call"`.
|
||||
- **`has_message`/`has_tool_call` initialized in all 5 locations**: Previous fix added variables inside `_observe_event` closure but missed 4 other `has_content = False` locations, causing `NameError: name 'has_message' is not defined` crashes.
|
||||
- **Auth config-not-found error handling**: When Codex's `config.toml` is missing or deleted, `codex login status` returns "Error loading configuration: No such file or directory (os error 2)". Now caught specifically (`OSError errno==2`) and returns ("not_configured", "Config missing — launch once to create") with clear GUI guidance.
|
||||
|
||||
### Bug Fixes (GUI)
|
||||
|
||||
- **Active endpoint sync**: GUI auto-removes stale endpoint references on startup
|
||||
|
||||
## v3.11.5 (2026-05-26)
|
||||
|
||||
**Vision Filter, Token-Aware Compaction, Universal Adaptive Compaction, Smart-Continue Text Detection**
|
||||
|
||||
### Critical Fixes
|
||||
|
||||
- **Token-aware compaction for small-context models (FIX)**: `_crof_compact_for_retry()` had an early return at `len(input_data) <= limit` (item count) — if you had 25 items × 1600 tokens = 40K tokens, it skipped compaction entirely because 25 < 30 (the default item limit). Now also checks estimated token count vs learned model max, and compacts when either item count OR token count exceeds limits. Fixes repeated `context_length_exceeded` errors on models like 0G-GLM-5.1 (~35K token context).
|
||||
- **Proactive compaction now token-aware**: Previously only triggered when item count > 30. Now also triggers when estimated tokens exceed 80% of the model's learned token limit, even if item count is below the threshold. Prevents the first-request failure pattern on small-context models.
|
||||
- **Compaction aggression threshold**: Changed `est > max_tok` to `est >= max_tok * 0.9` to avoid edge case where estimated tokens exactly equal the limit and compaction is skipped.
|
||||
- **Removed all `crof.ai` gates from adaptive compaction**: Proactive compaction, `finish_reason=length` retry, `_crof_record`, and compaction logging were gated behind `"crof.ai" in TARGET_URL`. These gates prevented OpenAdapter and other providers from getting proactive/retry compaction, causing repeated `context_length_exceeded` failures. Now applies universally to ALL providers.
|
||||
|
||||
### New Features
|
||||
|
||||
- **Vision model detection + image stripping**: `_strip_images_from_input()` and `_model_supports_vision()` detect vision capability by model name pattern. Non-vision models (deepseek, glm, mixtral, llama, command, dbrx, qwen, phi-3) have `input_image`/`image_url` parts stripped and replaced with `[User attached image: filename — this model does not support vision]` text notice. Vision models (gpt-4o, gemini, claude, qwen-vl, glm-5v) keep images intact. Applied in 3 paths: main request, context_length_exceeded retry, smart-continue nudge.
|
||||
- **Token estimation and per-model limit learning**: `_estimate_tokens()`, `_estimate_input_tokens()`, `_get_model_max_tokens()`, `_set_model_max_tokens()`. Extracts `~N tokens` from `context_length_exceeded` error messages and stores per-model token limits. Used by proactive compaction and retry compaction to adjust `keep` count dynamically.
|
||||
- **Compaction aggression levels**: `_crof_compact_for_retry()` accepts `aggression` parameter (0=normal, 1=extreme). Extreme mode kicks in when estimated tokens > 1.5× the learned limit or on 2nd+ retry attempt. Reduces `keep` count to minimum, ensuring the compacted request fits within model limits.
|
||||
- **Smart-continue text-tool detection**: Removed hard requirement for `has_function_call_output(input_data)`. Added `_TOOL_CALL_TEXT_PATTERNS` and `_text_looks_like_tool_calls()` to trigger nudging when model outputs text matching tool-call patterns (e.g., `• (exec_command cmd ...)`, `write_to_file`, `exec_command`) even without prior `function_call_output` in context. Essential for models like 0G-GLM-5.1 that never emit real `function_call_output` items.
|
||||
- **Parenthesized tool call regex**: `_PAREN_TC_RE` pattern to match `• (name args...)` format from non-vision models that output tool calls as parenthesized text.
|
||||
|
||||
### GUI Fixes
|
||||
|
||||
- **Active endpoint sync**: Added `set_active_endpoint()` and `validate_active_endpoint()` to Linux GTK GUI. Syncs `.active-endpoint.json` with `config.toml` on every launch; auto-removes stale references to deleted providers. Fixed `"Error loading configuration: No such file or directory (os error 2)"` crash when active endpoint referenced a deleted provider.
|
||||
- **Config state**: `~/.codex/.active-endpoint.json` and `config.toml` model catalog path validated and auto-corrected on GUI startup.
|
||||
|
||||
## v3.11.0 (2026-05-26)
|
||||
|
||||
**Cobra PR Merge + Smart Continuation + API Key Hot-Reload**
|
||||
|
||||
### New Features
|
||||
- **Concurrency semaphore (max 3)**: limits parallel upstream requests to prevent rate-limiting
|
||||
- **Auto-continue for truncated text**: detects text ending in `:`, `(`, `;`, `…` or `finish_reason=length`, continues seamlessly
|
||||
- **SO_REUSEADDR on sticky port**: prevents `TIME_WAIT` from changing port on restart
|
||||
- **proxy-stderr.log**: persistent log file for proxy errors
|
||||
- **Stream diagnostics**: logs event count, finish reason, content flag, elapsed time after each stream
|
||||
- **Timeout/OSError handler**: sends proper `response.failed` SSE event instead of silently dropping connection
|
||||
- **Restart Proxy button**: now only restarts proxy without killing Codex Desktop
|
||||
- **Tool call argument normalizer**: fixes capital-A `Arguments` key, strips markdown/JSON code block wrapping from tool call arguments
|
||||
- **Smart-continue loop (2× retries)**: escalating nudge messages when model returns text-only stop mid-task
|
||||
- **XML tool call extraction**: parses `<tool_call>name{args}</tool_call>` from model text output, injects as real `function_call` items
|
||||
- **Auto-continue + smart-continue ordered with skip guard**: prevents both from double-firing on the same response
|
||||
- **API key hot-reload**: mtime tracking detects config changes, `/admin/reload` endpoint triggers hot-reload, `/admin/verify-key` tests key against upstream
|
||||
- **GUI hot-reload**: auto-refreshes proxy key on endpoint edit, verifies with upstream — no proxy restart needed
|
||||
- **Synthetic tool-results disabled**: was causing deepseek-v4-pro truncation on opencode.ai
|
||||
|
||||
## v3.10.12 (2026-05-26)
|
||||
|
||||
**Sticky Endpoint, Claude Fixes, Guardrail Skip, Anti-Stall**
|
||||
|
||||
### New Features
|
||||
- **Sticky endpoint caching**: remembers which endpoint last succeeded, reuses it on every subsequent request (zero overhead)
|
||||
- **Sequential fallback**: if sticky endpoint fails (429/502/503), tries next endpoint in order — no parallel probing, no wasted requests
|
||||
- **Endpoint order**: `cloudcode-pa.googleapis.com` first (matches agy CLI), `daily-cloudcode-pa.googleapis.com` as fallback
|
||||
- **Anti-stall engine**: kills stale proxy processes and clears `__pycache__` on every new session start
|
||||
- **Smart error classification**: distinguishes `quota_exhausted` vs `capacity_exhausted` vs `account_banned` vs `validation_required` vs `service_disabled` vs `auth_permanent`
|
||||
- **Rate limit reset time parsing**: extracts cooldown from error body (`quotaResetDelay`, `Resets in ~1h27m`, etc.) for accurate cooldown
|
||||
- **Missing Antigravity headers**: `X-Client-Name`, `X-Client-Version`, `x-goog-api-client`, platform-aware `User-Agent`
|
||||
- **Session ID**: added `sessionId` to request wrapper for proper session tracking
|
||||
|
||||
### Bug Fixes (TRAE Agent)
|
||||
- **Guardrail skip for simple messages**: when user sends simple messages (e.g. "hi"), skip injecting `_GEMINI_AGENT_GUARDRAIL` — prevents model from aggressively calling tools and looping `ls -la` 50+ times
|
||||
- **Claude tool preservation**: Claude models through Antigravity now keep ALL tool outputs in normalizer (no summarization/truncation) — prevents context loss that broke Claude sessions
|
||||
- **Claude compaction guard**: `_adaptive_compact` skipped for Claude models — Claude handles its own context, no forced compaction
|
||||
- **Claude normalizer guard**: `_antigravity_normalize_context` skipped for Claude models — avoids stripping Claude-specific message structure
|
||||
- **Claude sanitization guard**: Google content sanitization loop skipped for Claude models — prevents mangling Claude's response format
|
||||
- **Normalizer model parameter**: `_antigravity_normalize_context` now receives `model` param to distinguish Claude vs Gemini behavior
|
||||
|
||||
## v3.10.11 (2026-05-26)
|
||||
|
||||
**Hybrid Endpoint Fallback — Redundant Antigravity Endpoints**
|
||||
|
||||
### New Features
|
||||
- Hybrid endpoint fallback: tries `cloudcode-pa.googleapis.com` then `daily-cloudcode-pa.googleapis.com` on 429
|
||||
- `daily-cloudcode-pa.googleapis.com` is the same production endpoint agy-core uses (separate rate limit bucket)
|
||||
- 429 errors now log full response body for debugging
|
||||
- SERVICE_DISABLED (403) still falls through to next endpoint
|
||||
- Rate-limit marking only happens after ALL endpoints fail
|
||||
|
||||
### Bug Fixes
|
||||
- Fixed 429 on one endpoint immediately failing — now tries fallback before giving up
|
||||
- Restored SERVICE_DISABLED fallthrough (was accidentally removed)
|
||||
|
||||
## v3.10.10 (2026-05-25)
|
||||
|
||||
**Context Normalizer Fix — Compaction Summary Preservation**
|
||||
|
||||
### Bug Fixes
|
||||
- Fixed normalizer stripping ALL context on resumed sessions after compaction
|
||||
- Normalizer no longer auto-resets when compaction summary is present
|
||||
- Compaction summaries ("Auto-compacted: N earlier turns") are always preserved
|
||||
- Deduplicates consecutive identical `<goal_context>` messages (10→1)
|
||||
- Emergency reset now preserves compaction summaries
|
||||
- Previous behavior: after compaction reduced 1925→185 items, normalizer saw `n_tool_outputs == 0` and stripped to just `system + latest_user`, losing all context — model responded with "I don't have context"
|
||||
|
||||
### hashlib Fix (v3.10.9 hotfix)
|
||||
- `_antigravity_normalize_context` crashed with `NameError: hashlib` on resumed sessions
|
||||
- Replaced SHA256 duplicate detection with string comparison
|
||||
|
||||
## v3.10.9 (2026-05-25)
|
||||
|
||||
**Antigravity Overhaul — Context Normalizer, Claude Thinking Fix, Endpoint Lockdown**
|
||||
|
||||
### Antigravity Endpoint Lockdown
|
||||
- Production-only: `cloudcode-pa.googleapis.com` by default
|
||||
- Sandbox/staging blocked unless `ALLOW_ANTIGRAVITY_STAGING=1`
|
||||
- 403 SERVICE_DISABLED falls through, 429 returns to client
|
||||
|
||||
### AntigravityContextNormalizer
|
||||
- Bounded context — no more 136-item polluted requests for "hi"
|
||||
- Simple message detector, auto-reset polluted context
|
||||
- Duplicate removal, tool output budget, hard char limits
|
||||
|
||||
### Claude Thinking Fix (Antigravity-only)
|
||||
- Fixed 400 error: `maxOutputTokens=64000` when thinking enabled
|
||||
- Snake_case config, VALIDATED toolConfig, proper budgets
|
||||
|
||||
### z.ai / OpenRouter (cobra91 PR #4)
|
||||
- Full OpenClaw attribution headers, OpenRouter caching
|
||||
|
||||
## v3.10.8 (2026-05-25)
|
||||
|
||||
**OAuth & Antigravity Endpoint Fixes**
|
||||
|
||||
### Re-OAuth Buttons Fixed
|
||||
- Linux GUI: `load_oauth_secrets()` was undefined — buttons crashed silently on click
|
||||
- Now loads OAuth secrets inline from `~/.config/codex-launcher/oauth-secrets.json`
|
||||
- Both Linux and Windows Re-OAuth use PKCE + localhost callback (was deprecated OOB paste)
|
||||
|
||||
### Antigravity Staging/Sandbox Blocked by Default
|
||||
- Proxy: production `cloudcode-pa.googleapis.com` tried FIRST, sandbox/daily/autopush as fallback only
|
||||
- Proxy: 403 SERVICE_DISABLED now falls through to next endpoint instead of returning error immediately
|
||||
- Project discovery: validates against production endpoint, not staging-cloudaicompanion.sandbox
|
||||
- Antigravity preset `base_url` changed to production (was `daily-cloudcode-pa.sandbox.googleapis.com`)
|
||||
- `[antigravity-endpoint]` log line shows which endpoints are being tried
|
||||
|
||||
### Other Fixes
|
||||
- GLib.idle_add lambda returning truthy tuple fixed (caused repeated callbacks)
|
||||
- Windows GUI project discovery also uses production endpoint
|
||||
|
||||
## v3.10.7 (2026-05-25)
|
||||
|
||||
**Prompt Enhancer — Fix Lost Context After Compaction**
|
||||
|
||||
### Prompt Enhancer (Per-Provider Toggle)
|
||||
- **Offline mode**: Injects structured XML instructions before every user prompt to keep the model focused, decisive, and context-aware after compaction strips conversation history
|
||||
- **AI-powered mode**: Optionally calls an external LLM (configurable model/URL/key) to rewrite vague prompts into clear, actionable instructions
|
||||
- Prevents the "had to resend and reword" problem in long sessions where compaction summarizes hundreds of turns
|
||||
- **Per-endpoint setting** — enable/disable for each provider independently
|
||||
- Configurable in both Linux and Windows GUI: toggle switch, mode selector, enhancer model, URL, API key fields
|
||||
|
||||
### How It Works
|
||||
- **Offline**: Prepends a `<prompt-enhancer>` block with rules like "never ask for clarification, infer from compacted context, execute decisively"
|
||||
- **AI-powered**: Sends the user's prompt + compaction summary to a separate model (e.g. DeepSeek V4 Flash via Freebuff) which rewrites it for clarity, then prepends the offline instructions too
|
||||
- Both modes run after compaction but before the request is sent upstream
|
||||
|
||||
## v3.10.6 (2026-05-25)
|
||||
|
||||
**Freebuff Integration + Codebuff OAuth Fix + Windows Consolidation**
|
||||
|
||||
### Freebuff (Free DeepSeek/Kimi)
|
||||
- **Freebuff integration**: Free DeepSeek/Kimi models via codebuff.com API
|
||||
- Fixed User-Agent to match official SDK: `ai-sdk/openai-compatible/1.0.25/codebuff`
|
||||
- Fixed metadata fields: `freebuff_instance_id` + `client_id` (base36 random) + `cost_mode: "free"`
|
||||
- Fixed session endpoint: POST empty `{}` body (not `{"model": model}`)
|
||||
- GUI preset aliases: "Freebuff (Free DeepSeek/Kimi)", "FreeBuff", "Codebuff (Free DeepSeek/Kimi)" all map to same backend
|
||||
|
||||
### Codebuff Fix
|
||||
- Fixed Codebuff OAuth: use `www.codebuff.com` (bare `codebuff.com` returns 307 redirect)
|
||||
|
||||
### OAuth Secrets & Credentials (All Providers)
|
||||
- **OAuth Secrets dialog now shows ALL providers**: Google (Antigravity + Gemini CLI) AND Freebuff/Codebuff
|
||||
- **Re-OAuth buttons** for each provider: instantly re-authenticate Google or GitHub/Codebuff
|
||||
- Token status indicators (valid/missing) for each Google provider
|
||||
- Shows logged-in email and auth status for Freebuff/Codebuff
|
||||
- Editable auth token and fingerprint fields for Freebuff/Codebuff
|
||||
|
||||
### Windows
|
||||
- Windows GUI files consolidated into `src/` (merged by cobra91 via PR #1 and PR #2)
|
||||
|
||||
### Proxy & GUI Improvements (cobra91 PR #3)
|
||||
- CROF adaptive logic gated to `crof.ai` only — no more log pollution for other providers
|
||||
- Data directory consolidation: all data now in `codex-proxy/` (was split across `codex-desktop/`, `codex-launcher/`, `codex-proxy/`)
|
||||
- Sticky proxy port: persists in `.last-proxy-port`, reused on restart so Codex Desktop keeps connection
|
||||
- Adaptive compact budget raised from 60% to 80% — avoids premature compaction on large-context models (DeepSeek v4 Pro 1M)
|
||||
- Config cleanup fix: stale `proxy-*.json` cleanup moved after `_init_runtime()` to avoid deleting active config
|
||||
- Windows GUI: added Clear Log, Restart Proxy, View Log buttons
|
||||
- **Linux/Windows feature parity**: both GUIs now have identical features
|
||||
- Windows GUI: ported OAuth Secrets all-providers dialog (Google + Freebuff/Codebuff with Re-OAuth buttons, token status)
|
||||
- Windows GUI: added Codebuff/Freebuff OAuth login flow (GitHub browser-based)
|
||||
- Windows GUI: added Sync from Preset button in endpoint editor
|
||||
- Linux GUI: added Clear Log + Restart Proxy buttons (matching Windows)
|
||||
|
||||
## v3.10.5 (2026-05-25)
|
||||
|
||||
**Windows GUI + Context Compaction for Antigravity/Gemini OAuth**
|
||||
|
||||
### Windows Native GUI (tkinter)
|
||||
- **Windows GUI** in `windows/` folder — full tkinter port by cobra91
|
||||
- OAuth Secrets editor, Import JSON, Antigravity model list
|
||||
- Shared backend with Linux (same translate-proxy.py)
|
||||
- See README for Windows installation and usage
|
||||
|
||||
**Context Compaction for Antigravity/Gemini OAuth**
|
||||
|
||||
### Fix
|
||||
- **Prevent `input token count exceeds maximum` errors** during long conversations
|
||||
- Added aggressive compaction policies for Antigravity (`cloudcode-pa`) and Gemini CLI (`googleapis`)
|
||||
- Auto-trims old turns when approaching 60% of model context limit (1M tokens for Gemini, 200K for Claude, 128K for GPT-OSS)
|
||||
- Added REST model IDs to context size map (`gemini-3-flash`, `gemini-3.1-pro-low`, `claude-sonnet-4-6`, etc.)
|
||||
|
||||
## v3.10.4 (2026-05-25)
|
||||
|
||||
**Security: OAuth Secrets Editor + Import JSON**
|
||||
|
||||
### Security
|
||||
- **All hardcoded OAuth secrets removed from source code and git history**
|
||||
- OAuth client IDs and secrets now stored locally in `~/.config/codex-launcher/oauth-secrets.json`
|
||||
- Git history rewritten to scrub all leaked credentials (0 matches verified)
|
||||
- Pre-push hook blocks any future commit containing secrets
|
||||
- All old Gitea releases deleted (contained leaked secrets in .deb files)
|
||||
|
||||
### New Features
|
||||
- **OAuth Secrets editor** in GUI — "OAuth Secrets" button in header bar
|
||||
- **Import JSON** button — import `client_secret_*.json` downloaded from Google Cloud Console
|
||||
- Supports both `"installed"` and `"web"` JSON formats from Google
|
||||
|
||||
### Antigravity Fix (from v3.10.3)
|
||||
- Antigravity REST API uses slug IDs, not display names
|
||||
- Verified all model IDs with live API testing
|
||||
|
||||
## v3.10.3 (2026-05-25)
|
||||
|
||||
**Fix Antigravity 404 Errors — Verified REST Model IDs**
|
||||
|
||||
### Critical Fix
|
||||
- Antigravity REST API (`v1internal:generateContent`) uses slug IDs, not display names
|
||||
- Verified all model IDs with live API testing against `daily-cloudcode-pa.sandbox.googleapis.com`
|
||||
- Display names map to closest working REST model (e.g. `Gemini 3.5 Flash (High)` → `gemini-3-flash`)
|
||||
- Model list now matches agy CLI: Gemini 3.5 Flash (H/M/L), Gemini 3.1 Pro (H/L), Claude Sonnet/Opus 4.6, GPT-OSS 120B
|
||||
|
||||
### Working REST Model IDs
|
||||
| Display Name | REST ID |
|
||||
|---|---|
|
||||
| Gemini 3.5 Flash (High) | gemini-3-flash |
|
||||
| Gemini 3.5 Flash (Medium) | gemini-3-flash |
|
||||
| Gemini 3.5 Flash (Low) | gemini-3.5-flash-low |
|
||||
| Gemini 3.1 Pro (High) | gemini-3.1-pro-low |
|
||||
| Gemini 3.1 Pro (Low) | gemini-3.1-pro-low |
|
||||
| Claude Sonnet 4.6 (Thinking) | claude-sonnet-4-6 |
|
||||
| Claude Opus 4.6 (Thinking) | claude-opus-4-6-thinking |
|
||||
| GPT-OSS 120B (Medium) | gpt-oss-120b-medium |
|
||||
|
||||
## v3.10.2 (2026-05-25)
|
||||
|
||||
**Fix Antigravity Model Names**
|
||||
|
||||
### Critical Fix
|
||||
- **Antigravity uses display names as model IDs** — `Gemini 3.5 Flash (High)` not `gemini-3.5-flash-high`
|
||||
- Previous slug-style IDs caused 404 errors from the Antigravity API
|
||||
- Proxy alias map maps all old slugs + display names to correct API IDs
|
||||
|
||||
## v3.10.0 (2026-05-25)
|
||||
|
||||
**Provider Model Editor + Antigravity Model Refresh**
|
||||
|
||||
### Provider Editor
|
||||
- **Remove Selected** button to remove highlighted model(s) from provider
|
||||
- **Clear All** button to empty model list
|
||||
- **Sync from Preset** button to refresh model list from current preset definition
|
||||
- Preset sync now replaces (not appends) models — fixes stale saved model lists
|
||||
|
||||
### Antigravity Models Updated
|
||||
- **Gemini 3.5 Flash** (High / Medium)
|
||||
- **Gemini 3.1 Pro** (High / Low)
|
||||
- **Claude Sonnet 4.6 Thinking**
|
||||
- **Claude Opus 4.6 Thinking**
|
||||
- **GPT-OSS 120B Medium**
|
||||
|
||||
## v3.9.9 (2026-05-25)
|
||||
|
||||
**Antigravity Model Refresh**
|
||||
|
||||
### Updated Models
|
||||
- **Gemini 3.5 Flash** (High / Medium) — new flagship flash model
|
||||
- **Gemini 3.1 Pro** (High / Low) — tiered reasoning control
|
||||
- **Claude Sonnet 4.6 Thinking** — Anthropic partner model via Antigravity
|
||||
- **Claude Opus 4.6 Thinking** — Anthropic partner model via Antigravity
|
||||
- **GPT-OSS 120B Medium** — open-weight GPT model via Antigravity
|
||||
- Removed stale `antigravity-*` prefixed IDs and old preview models
|
||||
|
||||
### Proxy Updates
|
||||
- Alias map updated for tiered model IDs (high/medium/low/thinking)
|
||||
- Context sizes added for all new Antigravity models
|
||||
|
||||
## v3.9.8 (2026-05-25)
|
||||
|
||||
**Codex Desktop Model Fix & Global BrokenPipeError Protection**
|
||||
|
||||
### Desktop Model Fix
|
||||
- **Codex Desktop sending wrong model** (gpt-5.4-mini) instead of user-selected model — now remapped via `CODEX_LAUNCHER_MODEL` env var
|
||||
- **Config.toml** now writes `review_model`, `wire_api`, `request_max_retries`, `stream_max_retries`, `stream_idle_timeout_ms` for Desktop compatibility
|
||||
- **Proxy model remap** intercepts Desktop forced models (`gpt-5.4-mini`, `gpt-5.5`, etc.) and routes to the user's selected model
|
||||
|
||||
### Global Crash Fix
|
||||
- **`send_json()` globally catches BrokenPipeError** — no more crashes on client disconnect across all backends
|
||||
|
||||
## v3.9.7 (2026-05-25)
|
||||
|
||||
**Codebuff Error Forwarding & Crash Fixes**
|
||||
|
||||
105
README.md
105
README.md
@@ -9,28 +9,13 @@
|
||||
<a href="https://z.ai/subscribe?ic=ROK78RJKNW">z.ai/subscribe</a>
|
||||
</p>
|
||||
|
||||
|
||||
<p align="center">
|
||||
---
|
||||
If you want fork it, use the Github copy, here it is:
|
||||
<a href="https://github.com/roman-ryzenadvanced/Codex-Launcher-Any-AI-Provider">Codex-Any-AI-Provider on Github (Official)</a>
|
||||
---
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<h1 align="center">Codex Launcher — Any AI Provider</h1>
|
||||
|
||||
<p align="center">
|
||||
<strong>Run OpenAI Codex CLI & Desktop with <em>any</em> AI provider.</strong><br/>
|
||||
Google Antigravity • Gemini CLI • OpenCode • Z.AI • Anthropic • Command Code • Freebuff • OpenRouter • Crof.ai • NVIDIA NIM • OpenAdapter • Kilo.ai • DeepSeek • and more
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<sub>
|
||||
Windows version by <a href="https://github.com/cobra91">cobra91</a> •
|
||||
Original Linux development by <a href="https://github.com/roman-ryzenadvanced">roman-ryzenadvanced</a>
|
||||
</sub>
|
||||
Google Antigravity • Gemini CLI • OpenCode • Z.AI • Anthropic • Command Code • Codebuff • OpenRouter • Crof.ai • NVIDIA NIM • OpenAdapter • Kilo.ai • DeepSeek • and more
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -130,14 +115,6 @@ A three-component system:
|
||||
- **Response store TTL** — evicts stored responses older than 10 minutes, prevents memory leaks
|
||||
- **Bounded stream buffers** — 8MB cap prevents OOM on pathological responses
|
||||
- **Dual logging** — all proxy messages written to both stderr and `~/.cache/codex-proxy/proxy.log`
|
||||
- **Vision model detection** (v3.11.5) — automatically strips images for non-vision models (DeepSeek, GLM, Qwen, etc.) and replaces with text notice; vision-capable models (GPT-4o, Gemini, Claude, Qwen-VL) keep images intact
|
||||
- **Token-aware compaction** (v3.11.5) — learns per-model token limits from `context_length_exceeded` errors; proactively compacts when estimated tokens exceed 80% of limit; prevents repeated context overflow on small-context models (~35K tokens)
|
||||
- **Universal adaptive compaction** (v3.11.5) — compaction now works for ALL providers (was Crof.ai-only); proactive + retry compaction with aggression levels (normal/extreme)
|
||||
- **Smart-continue text detection** (v3.11.5) — triggers continuation nudging when model outputs text matching tool-call patterns, essential for text-only models that never emit real `function_call_output` items
|
||||
- **Antigravity loop breakers** (v3.11.6) — per-session tracking with automatic finalization when same tool+args repeats 5+ times; edit-intent nudge injected only on first turn; latest user instruction appended exactly once per request
|
||||
- **has_content function_call fix** (v3.11.6) — tool-call-only responses now correctly flagged as having content, preventing infinite loops on OpenAdapter/Z.AI/OpenRouter providers
|
||||
- **Vision/OCR preprocessing** (v3.11.6) — when provider rejects images, automatically calls a configurable vision fallback API (Kilo.ai) to describe images as text for text-only models; MD5-cached; retries on vision errors with preprocessed text
|
||||
- **Auth config-missing fix** (v3.11.6) — graceful handling when Codex config.toml is missing instead of showing raw os error
|
||||
- Zero dependencies — pure Python stdlib
|
||||
|
||||
### Command Code Adapter
|
||||
@@ -562,7 +539,6 @@ The launcher generates model catalog JSON with dual field naming to satisfy both
|
||||
|
||||
Codex Launcher includes special handling for Gemini 3 / Antigravity OAuth:
|
||||
|
||||
- **Sticky endpoint with parallel discovery**: First request probes `cloudcode-pa.googleapis.com` and `daily-cloudcode-pa.googleapis.com` simultaneously — first 200 wins and is cached. All subsequent requests go straight to the cached endpoint. If it fails (429/502/503), cache is cleared and all endpoints are re-probed in parallel. Zero wasted time on rate-limited endpoints.
|
||||
- **Thought signature preservation**: Captures `thoughtSignature` from Gemini responses
|
||||
and reattaches them on follow-up requests to maintain tool-call continuity.
|
||||
- **Edit-intent detection**: When follow-up requests contain edit keywords, a tool-use
|
||||
@@ -570,16 +546,6 @@ Codex Launcher includes special handling for Gemini 3 / Antigravity OAuth:
|
||||
- **User instruction enforcement**: The latest user message is guaranteed to be the
|
||||
final content turn sent to Gemini, even after compaction.
|
||||
- **Smart compaction**: Old tool outputs capped at 3000 chars, recent 6 at 20000 chars.
|
||||
- **Context compaction**: Aggressive auto-trimming when approaching 80% of model context
|
||||
limit (1M tokens Gemini, 200K Claude, 128K GPT-OSS). Prevents token limit errors.
|
||||
- **Model ID mapping**: Display names (e.g. `Gemini 3.5 Flash (High)`) mapped to REST API
|
||||
slugs (e.g. `gemini-3-flash`). See `docs/ANTIGRAVITY.md` for details.
|
||||
|
||||
### OAuth Secrets
|
||||
|
||||
Google OAuth credentials are stored locally in `~/.config/codex-launcher/oauth-secrets.json`
|
||||
and never committed to the repository. Use the **OAuth Secrets** button in the launcher
|
||||
header to edit or import `client_secret_*.json` files from Google Cloud Console.
|
||||
|
||||
---
|
||||
|
||||
@@ -639,7 +605,7 @@ curl http://127.0.0.1:PORT/v1/accounts
|
||||
| OpenCode Zen | OpenAI-compat | `https://opencode.ai/zen/v1` |
|
||||
| OpenCode Go | OpenAI-compat | `https://opencode.ai/zen/go/v1` |
|
||||
| Command Code | Command Code | `https://api.commandcode.ai` |
|
||||
| **Codebuff / Freebuff** | **Codebuff** | `https://www.codebuff.com` *(free DeepSeek/Kimi — OAuth login built-in)* |
|
||||
| **Codebuff** | **Codebuff** | `https://codebuff.com` *(free DeepSeek/Kimi — OAuth login built-in)* |
|
||||
| Crof.ai | OpenAI-compat | `https://crof.ai/v1` |
|
||||
| OpenAdapter | OpenAI-compat | `https://api.openadapter.in/v1` |
|
||||
| Z.ai Coding | OpenAI-compat | `https://api.z.ai/api/coding/paas/v4` |
|
||||
@@ -652,14 +618,14 @@ curl http://127.0.0.1:PORT/v1/accounts
|
||||
| Google Antigravity (OAuth) | Antigravity OAuth | `daily-cloudcode-pa.sandbox.googleapis.com` |
|
||||
| Custom | Any | User-defined |
|
||||
|
||||
### Free Models (via Codebuff/Freebuff)
|
||||
Codebuff/Freebuff provides free access to these models — no API key needed:
|
||||
### Free Models (via Codebuff)
|
||||
Codebuff provides free access to these models — no API key needed:
|
||||
- **DeepSeek V4 Pro** — Smartest model
|
||||
- **DeepSeek V4 Flash** — Most efficient
|
||||
- **Kimi K2.6** — Balanced
|
||||
- **MiniMax M2.7** — Fastest
|
||||
|
||||
*Requires: `freebuff login` via GUI OAuth button, or `npm install -g freebuff && freebuff login` (GitHub OAuth)*
|
||||
*Requires: `codebuff login` via GUI OAuth button, or `npm install -g codebuff && codebuff login` (GitHub OAuth)*
|
||||
|
||||
---
|
||||
|
||||
@@ -796,70 +762,15 @@ codex --profile my-profile -c model=my-model
|
||||
|
||||
---
|
||||
|
||||
## Windows Version
|
||||
|
||||
A native **Windows GUI** (tkinter) is available in the `src/` folder alongside the Linux version. Both GUIs have **full feature parity**.
|
||||
|
||||
<p align="center">
|
||||
<sub>
|
||||
Windows version by <a href="https://github.com/cobra91">cobra91</a> •
|
||||
Original Linux development by <a href="https://github.com/roman-ryzenadvanced">roman-ryzenadvanced</a>
|
||||
</sub>
|
||||
</p>
|
||||
|
||||
### Files
|
||||
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| `src/codex-launcher-gui.py` | tkinter GUI (Windows) — manage endpoints, launch Codex CLI/Desktop |
|
||||
| `src/codex-launcher-gui` | GTK GUI (Linux) — same features, native GTK look |
|
||||
| `src/codex_launcher_lib.py` | Shared library — proxy lifecycle, config, OAuth, diagnostics |
|
||||
| `src/translate-proxy.py` | Proxy — translates Responses API for any provider |
|
||||
|
||||
### How to Run (Windows)
|
||||
|
||||
Python ≥ 3.8 with tkinter is required (comes with the official Python installer).
|
||||
|
||||
```powershell
|
||||
# From repo root
|
||||
cd src
|
||||
python codex-launcher-gui.py
|
||||
```
|
||||
|
||||
The GUI will:
|
||||
1. Auto-create default endpoints on first run
|
||||
2. Show a toolbar with Endpoints, OAuth Secrets, AI Monitor, and more
|
||||
3. Launch Codex CLI/Desktop with your chosen provider
|
||||
|
||||
### OAuth Credentials
|
||||
|
||||
Google OAuth (Antigravity / Gemini CLI) requires a `client_secret_*.json` from [Google Cloud Console](https://console.cloud.google.com/apis/credentials). Use the **OAuth Secrets** button in the GUI to import it — credentials are stored locally in `~/.config/codex-launcher/oauth-secrets.json`, never in the repo.
|
||||
|
||||
The **OAuth Secrets** dialog shows all providers (Google + Freebuff/Codebuff) with **Re-OAuth buttons** to instantly re-authenticate any provider.
|
||||
|
||||
### Feature Parity
|
||||
|
||||
Both Linux (GTK) and Windows (tkinter) GUIs have identical features:
|
||||
- All provider presets, endpoint management, BGP routing
|
||||
- OAuth Secrets with all providers + Re-OAuth buttons
|
||||
- AI Monitor, Usage Dashboard, Request History, Benchmark
|
||||
- Clear Log, Restart Proxy, View Log
|
||||
- Doctor, Diagnostic Agent, Profile Backup/Import
|
||||
- Antigravity model mapping, context compaction (80% budget)
|
||||
- Multi-account rotation, rate limit handling
|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python ≥ 3.8
|
||||
- python3-gi (`sudo apt install python3-gi`) — Linux only
|
||||
- tkinter (`python3-tk`) — Windows / Linux GUI
|
||||
- python3-gi (`sudo apt install python3-gi`)
|
||||
- Codex CLI ≥ 2.0
|
||||
- Codex Desktop (optional, for Desktop mode)
|
||||
- bash, curl, lsof — Linux only
|
||||
- bash, curl, lsof
|
||||
|
||||
**No pip dependencies.** Zero. Pure stdlib.
|
||||
**No pip dependencies.** Zero. Pure stdlib + system GTK.
|
||||
|
||||
---
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
BIN
codex-launcher_3.0.0_all.deb
Normal file
BIN
codex-launcher_3.0.0_all.deb
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
codex-launcher_3.3.0_all.deb
Normal file
BIN
codex-launcher_3.3.0_all.deb
Normal file
Binary file not shown.
BIN
codex-launcher_3.5.0_all.deb
Normal file
BIN
codex-launcher_3.5.0_all.deb
Normal file
Binary file not shown.
BIN
codex-launcher_3.6.0_all.deb
Normal file
BIN
codex-launcher_3.6.0_all.deb
Normal file
Binary file not shown.
BIN
codex-launcher_3.7.0_all.deb
Normal file
BIN
codex-launcher_3.7.0_all.deb
Normal file
Binary file not shown.
BIN
codex-launcher_3.8.0_all.deb
Normal file
BIN
codex-launcher_3.8.0_all.deb
Normal file
Binary file not shown.
BIN
codex-launcher_3.8.1_all.deb
Normal file
BIN
codex-launcher_3.8.1_all.deb
Normal file
Binary file not shown.
BIN
codex-launcher_3.8.3_all.deb
Normal file
BIN
codex-launcher_3.8.3_all.deb
Normal file
Binary file not shown.
BIN
codex-launcher_3.8.4_all.deb
Normal file
BIN
codex-launcher_3.8.4_all.deb
Normal file
Binary file not shown.
BIN
codex-launcher_3.9.7_all.deb
Normal file
BIN
codex-launcher_3.9.7_all.deb
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,335 +0,0 @@
|
||||
# Antigravity (Google CloudCode) — Technical Reference
|
||||
|
||||
Everything needed to understand, maintain, and debug the Antigravity OAuth provider integration in Codex Launcher.
|
||||
|
||||
---
|
||||
|
||||
## 1. What Is Antigravity?
|
||||
|
||||
Antigravity is Google's internal codename for **Google CloudCode** — a cloud-based AI coding agent powered by Gemini and other models. The CLI tool (`agy`) is a native Go binary that uses gRPC to communicate with Google's CloudCode backend.
|
||||
|
||||
- **Official CLI binary**: `~/.local/bin/agy-core` (ELF x86-64 Go binary, ~183MB)
|
||||
- **Wrapper script**: `~/.local/bin/agy` (Python, manages provider switching)
|
||||
- **CLI settings**: `~/.gemini/antigravity-cli/settings.json`
|
||||
- **Provider state**: `~/.gemini/antigravity-cli/agy_provider.json`
|
||||
|
||||
---
|
||||
|
||||
## 2. Two API Protocols — REST vs gRPC
|
||||
|
||||
### 2.1 What the agy CLI uses (gRPC)
|
||||
|
||||
The native `agy-core` binary uses **gRPC** to communicate with the CloudCode backend:
|
||||
|
||||
- **Service**: `google.internal.cloud.code.v1internal.PredictionService`
|
||||
- **Methods**:
|
||||
- `GenerateContent` — main inference
|
||||
- `FetchAvailableModels` — list available models
|
||||
- `CountTokens` — token counting
|
||||
- `RetrieveUserQuota` — quota check
|
||||
- **Other services**: `CloudCode`, `JetskiService` (settings, plugins, etc.)
|
||||
- **Proto files**: `google/internal/cloud/code/v1internal/prediction_service.proto`, `cloudcode.proto`
|
||||
- **Model IDs in gRPC**: Display names like `"Gemini 3.5 Flash (High)"` — verified from `settings.json`
|
||||
|
||||
### 2.2 What our proxy uses (REST)
|
||||
|
||||
Our Codex Launcher proxy does NOT use gRPC. It uses the **REST API** that the CloudCode backend also exposes:
|
||||
|
||||
- **Endpoint path**: `v1internal:generateContent` (non-streaming) / `v1internal:streamGenerateContent?alt=sse` (streaming SSE)
|
||||
- **This is NOT the standard Gemini REST API** — it's the CloudCode-internal REST gateway
|
||||
- **Model IDs in REST**: Slug-style IDs like `gemini-3-flash` — NOT display names
|
||||
- **The REST API is more limited** — fewer model variants available than gRPC
|
||||
|
||||
### 2.3 Why not gRPC?
|
||||
|
||||
The agy binary uses gRPC with protobuf serialization. Using gRPC from the proxy would require:
|
||||
- Maintaining proto definitions (compiled from the binary)
|
||||
- More complex streaming
|
||||
- The `grpcio` Python library (not installed by default)
|
||||
|
||||
The REST API works well enough for our use case.
|
||||
|
||||
---
|
||||
|
||||
## 3. Endpoints
|
||||
|
||||
The proxy tries these endpoints in order for Antigravity:
|
||||
|
||||
```
|
||||
1. https://daily-cloudcode-pa.sandbox.googleapis.com (primary)
|
||||
2. https://autopush-cloudcode-pa.sandbox.googleapis.com (fallback)
|
||||
3. https://cloudcode-pa.googleapis.com (production fallback)
|
||||
```
|
||||
|
||||
For regular Gemini CLI OAuth, only `cloudcode-pa.googleapis.com` is used.
|
||||
|
||||
---
|
||||
|
||||
## 4. Authentication
|
||||
|
||||
### 4.1 OAuth Flow
|
||||
|
||||
- **Client IDs**: Stored locally in `~/.config/codex-launcher/oauth-secrets.json` (not in repo)
|
||||
- **OAuth callback**: `https://antigravity.google/oauth-callback`
|
||||
- **Token storage**: `~/.cache/codex-proxy/google-antigravity-oauth-token.json`
|
||||
- **Token refresh**: via `https://oauth2.googleapis.com/token`
|
||||
- **Scopes**: `email profile openid cloud-platform cclog experimentsandconfigs userinfo.email userinfo.profile`
|
||||
- **Note**: The token does NOT have `auth/aicode` scope — it uses `cloud-platform` instead
|
||||
|
||||
### 4.2 Multi-Account Support
|
||||
|
||||
- `GoogleAccountPool("antigravity")` manages multiple Google accounts
|
||||
- Token files: `google-antigravity-oauth-token.json`, `google-antigravity-oauth-token-2.json`, etc.
|
||||
- Round-robin rotation across accounts
|
||||
|
||||
---
|
||||
|
||||
## 5. Request Format
|
||||
|
||||
### 5.1 REST Request Wrapper
|
||||
|
||||
The proxy wraps the Gemini-format request body in an outer envelope:
|
||||
|
||||
```json
|
||||
{
|
||||
"project": "<gcp-project-id>",
|
||||
"model": "<rest-model-id>",
|
||||
"requestType": "agent",
|
||||
"userAgent": "antigravity",
|
||||
"requestId": "agent-<uuid>",
|
||||
"request": {
|
||||
"contents": [...],
|
||||
"systemInstruction": {...},
|
||||
"generationConfig": {...},
|
||||
"tools": [...]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 5.2 Required Headers
|
||||
|
||||
```
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer <access_token>
|
||||
User-Agent: antigravity/<version> darwin/arm64
|
||||
```
|
||||
|
||||
The User-Agent version is auto-fetched from:
|
||||
- `https://antigravity-auto-updater-974169037036.us-central1.run.app`
|
||||
- Fallback: `https://antigravity.google/changelog`
|
||||
- Cached in `~/.cache/codex-proxy/antigravity-version.json`
|
||||
- Default: `1.18.3`
|
||||
|
||||
---
|
||||
|
||||
## 6. Model ID Mapping (CRITICAL)
|
||||
|
||||
### 6.1 The Problem
|
||||
|
||||
The agy CLI shows models with display names:
|
||||
- `Gemini 3.5 Flash (High)`
|
||||
- `Claude Sonnet 4.6 (Thinking)`
|
||||
|
||||
But the **REST API only accepts slug IDs**:
|
||||
- `gemini-3-flash`
|
||||
- `claude-sonnet-4-6`
|
||||
|
||||
Sending display names to the REST API returns **HTTP 404 "Requested entity was not found"**.
|
||||
|
||||
### 6.2 Verified Working Model IDs
|
||||
|
||||
All tested with live API calls to `daily-cloudcode-pa.sandbox.googleapis.com/v1internal:generateContent` on 2026-05-25:
|
||||
|
||||
| Display Name (agy CLI / GUI) | REST API Model ID | Status |
|
||||
|---|---|---|
|
||||
| Gemini 3.5 Flash (High) | `gemini-3-flash` | OK |
|
||||
| Gemini 3.5 Flash (Medium) | `gemini-3-flash` | OK |
|
||||
| Gemini 3.5 Flash (Low) | `gemini-3.5-flash-low` | OK |
|
||||
| Gemini 3.1 Pro (High) | `gemini-3.1-pro-low` | OK (only low tier works via REST) |
|
||||
| Gemini 3.1 Pro (Low) | `gemini-3.1-pro-low` | OK |
|
||||
| Claude Sonnet 4.6 (Thinking) | `claude-sonnet-4-6` | OK |
|
||||
| Claude Opus 4.6 (Thinking) | `claude-opus-4-6-thinking` | OK |
|
||||
| GPT-OSS 120B (Medium) | `gpt-oss-120b-medium` | OK |
|
||||
| Gemini 2.5 Flash | `gemini-2.5-flash` | OK |
|
||||
| Gemini 2.5 Flash Lite | `gemini-2.5-flash-lite` | OK |
|
||||
| Gemini 2.5 Pro | `gemini-2.5-pro` | 503 (exists, no capacity) |
|
||||
|
||||
### 6.3 Models That Return 404 via REST
|
||||
|
||||
These exist in gRPC but NOT in the REST API:
|
||||
|
||||
```
|
||||
gemini-3-flash-high, gemini-3-flash-medium, gemini-3-flash-low
|
||||
gemini-3.5-flash, gemini-3.5-flash-high, gemini-3.5-flash-medium
|
||||
gemini-3.1-pro-high (400, not 404, but doesn't work)
|
||||
gemini-3-pro, gemini-3-pro-high, gemini-3-pro-low (500)
|
||||
gemini-3.1-flash, gemini-3.1-flash-high
|
||||
claude-sonnet-4, claude-sonnet-4-5, claude-sonnet-4-6-thinking
|
||||
claude-opus-4, claude-opus-4-5
|
||||
claude-haiku-4-5
|
||||
gpt-oss-120b, gpt-oss-120b-maas, gpt-oss-20b-maas
|
||||
```
|
||||
|
||||
### 6.4 How the Mapping Works
|
||||
|
||||
1. GUI shows display names (matching agy CLI): `Gemini 3.5 Flash (High)`
|
||||
2. Codex CLI sends whatever model ID the user selected
|
||||
3. Proxy `alias_map` translates: `"Gemini 3.5 Flash (High)" → "gemini-3-flash"`
|
||||
4. Proxy sends REST request with `"model": "gemini-3-flash"`
|
||||
|
||||
The alias map is in `_handle_gemini_oauth()` around line 4316 of `translate-proxy.py`.
|
||||
|
||||
---
|
||||
|
||||
## 7. Response Format
|
||||
|
||||
### 7.1 Non-Streaming
|
||||
|
||||
```json
|
||||
{
|
||||
"response": {
|
||||
"candidates": [{
|
||||
"content": {
|
||||
"role": "model",
|
||||
"parts": [{"text": "..."}]
|
||||
},
|
||||
"finishReason": "STOP"
|
||||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 7.2 Streaming (SSE)
|
||||
|
||||
Content-Type: `text/event-stream`
|
||||
|
||||
Each SSE event contains a JSON chunk with the same structure. The proxy converts these to OpenAI Responses API format for Codex CLI.
|
||||
|
||||
---
|
||||
|
||||
## 8. Context Sizes
|
||||
|
||||
```python
|
||||
"Gemini 3.5 Flash": 1000000, "Gemini 3.1 Pro": 2000000,
|
||||
"gemini-3-flash": 1000000, "gemini-3.1-pro-low": 2000000,
|
||||
"gemini-3.5-flash-low": 1000000,
|
||||
"Claude Sonnet 4.6": 200000, "Claude Opus 4.6": 200000,
|
||||
"claude-sonnet-4-6": 200000, "claude-opus-4-6-thinking": 200000,
|
||||
"GPT-OSS 120B": 128000, "gpt-oss-120b-medium": 128000,
|
||||
"gemini-2.5-flash": 1000000, "gemini-2.5-pro": 2000000,
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. Key Proxy Code Locations
|
||||
|
||||
| Component | File | Line (approx) |
|
||||
|---|---|---|
|
||||
| Antigravity version | translate-proxy.py | 287-288 |
|
||||
| Version fetcher | translate-proxy.py | 705-748 |
|
||||
| Model alias map | translate-proxy.py | ~4316 |
|
||||
| REST request building | translate-proxy.py | ~4563-4602 |
|
||||
| Endpoint fallback loop | translate-proxy.py | ~4610 |
|
||||
| SSE streaming handler | translate-proxy.py | `_forward_gemini_sse()` |
|
||||
| Auto-continue for MAX_TOKENS | translate-proxy.py | `_auto_continue_gemini()` |
|
||||
| OAuth token refresh | translate-proxy.py | `_refresh_oauth_token_for()` |
|
||||
| Google account pool | translate-proxy.py | `_google_antigravity_pool` |
|
||||
| GUI preset models | codex-launcher-gui | ~358 |
|
||||
| GUI static model list | codex-launcher-gui | ~760 `_ANTIGRAVITY_MODELS` |
|
||||
| GUI fetch_models shortcut | codex-launcher-gui | ~770 `fetch_models_for_endpoint()` |
|
||||
|
||||
---
|
||||
|
||||
## 10. Debugging
|
||||
|
||||
### 10.1 Debug Logs
|
||||
|
||||
- **Proxy stderr**: Shows model mapping, request details, errors
|
||||
- **400 error dump**: `~/.cache/codex-proxy/gemini-last-400-request.json`
|
||||
- **Long context dump**: `~/.cache/codex-proxy/gemini-long-ctx-<session>.json`
|
||||
|
||||
### 10.2 Quick API Test
|
||||
|
||||
```bash
|
||||
TOKEN=$(python3 -c "import json; print(json.load(open('$HOME/.cache/codex-proxy/google-antigravity-oauth-token.json'))['access_token'])")
|
||||
|
||||
curl -s "https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:generateContent" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "User-Agent: antigravity/2.0.1 darwin/arm64" \
|
||||
-d '{
|
||||
"project": "voltaic-hangout-z1qhf",
|
||||
"model": "gemini-3-flash",
|
||||
"requestType": "agent",
|
||||
"userAgent": "antigravity",
|
||||
"requestId": "test-123",
|
||||
"request": {
|
||||
"contents": [{"role": "user", "parts": [{"text": "say hi"}]}]
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
### 10.3 Token Info
|
||||
|
||||
```bash
|
||||
TOKEN=$(python3 -c "import json; print(json.load(open('$HOME/.cache/codex-proxy/google-antigravity-oauth-token.json'))['access_token'])")
|
||||
curl -s "https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=$TOKEN" | python3 -m json.tool
|
||||
```
|
||||
|
||||
### 10.4 Common Errors
|
||||
|
||||
| Error | Cause | Fix |
|
||||
|---|---|---|
|
||||
| 404 "Requested entity was not found" | Wrong model ID (display name instead of slug) | Check alias_map |
|
||||
| 404 on `/v1/models` | Antigravity has no models REST endpoint | Proxy returns static list |
|
||||
| 404 on POST /responses | Codex CLI routing issue, not Antigravity | Check proxy is running |
|
||||
| 503 "No capacity" | Model exists but overloaded | Try another model or endpoint |
|
||||
| 500 "Unknown Error" | Model ID exists but broken on server | Known for gemini-3-pro-low |
|
||||
| PERMISSION_DENIED (gRPC) | Token lacks scope or empty request body | Use REST API instead |
|
||||
|
||||
---
|
||||
|
||||
## 11. Version History (Antigravity-specific)
|
||||
|
||||
| Version | Date | Change |
|
||||
|---|---|---|
|
||||
| v3.10.3 | 2026-05-25 | **Fix 404**: Verified REST model IDs, display→slug mapping |
|
||||
| v3.10.2 | 2026-05-25 | Wrong fix: tried display names (didn't work) |
|
||||
| v3.10.0 | 2026-05-25 | Provider model editor, static Antigravity model list |
|
||||
| v3.9.9 | 2026-05-25 | Refreshed Antigravity models (slugs were wrong) |
|
||||
| v3.3.0 | Earlier | Initial Antigravity OAuth + tool calls + SSE streaming |
|
||||
|
||||
---
|
||||
|
||||
## 12. Testing a New Model ID
|
||||
|
||||
If new models appear in the agy CLI, verify them against the REST API before adding:
|
||||
|
||||
```python
|
||||
# Test a candidate model ID
|
||||
import urllib.request, json, os
|
||||
|
||||
token = json.load(open(os.path.expanduser("~/.cache/codex-proxy/google-antigravity-oauth-token.json")))["access_token"]
|
||||
wrapped = {
|
||||
"project": "voltaic-hangout-z1qhf", "model": "NEW-MODEL-ID",
|
||||
"requestType": "agent", "userAgent": "antigravity",
|
||||
"requestId": "test-123",
|
||||
"request": {"contents": [{"role": "user", "parts": [{"text": "say hi"}]}]},
|
||||
}
|
||||
req = urllib.request.Request(
|
||||
"https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:generateContent",
|
||||
data=json.dumps(wrapped).encode(),
|
||||
headers={"Content-Type": "application/json", "Authorization": f"Bearer {token}", "User-Agent": "antigravity/2.0.1 darwin/arm64"},
|
||||
)
|
||||
try:
|
||||
resp = urllib.request.urlopen(req, timeout=15)
|
||||
print("OK:", resp.read().decode()[:200])
|
||||
except urllib.error.HTTPError as e:
|
||||
print(f"{e.code}:", e.read().decode()[:200])
|
||||
```
|
||||
|
||||
Then update:
|
||||
1. `alias_map` in `translate-proxy.py` — add display name → REST slug mapping
|
||||
2. `_ANTIGRAVITY_MODELS` in `codex-launcher-gui` — add display name to list
|
||||
3. Preset in `codex-launcher-gui` — add display name to `"Google Antigravity (OAuth)"` models
|
||||
4. Context sizes in `translate-proxy.py` — add model ID to `_MODEL_CTX` dict
|
||||
127
install.ps1
127
install.ps1
@@ -1,127 +0,0 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Codex Launcher Windows Installer
|
||||
.DESCRIPTION
|
||||
Installs Codex Launcher for the current user.
|
||||
.NOTES
|
||||
Requires: Python 3.8+ (stdlib only, zero pip dependencies).
|
||||
#>
|
||||
|
||||
param(
|
||||
[switch]$Uninstall
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$BinDir = Join-Path $env:LOCALAPPDATA 'Programs\Codex-Launcher'
|
||||
$StartMenu = Join-Path $env:APPDATA 'Microsoft\Windows\Start Menu\Programs'
|
||||
|
||||
if ($Uninstall) {
|
||||
Write-Host 'Uninstalling Codex Launcher...' -ForegroundColor Yellow
|
||||
|
||||
if (Test-Path $BinDir) {
|
||||
Remove-Item -Recurse -Force $BinDir
|
||||
Write-Host " Removed $BinDir"
|
||||
}
|
||||
|
||||
$shortcut = Join-Path $StartMenu 'Codex Launcher.lnk'
|
||||
if (Test-Path $shortcut) {
|
||||
Remove-Item -Force $shortcut
|
||||
Write-Host ' Removed Start Menu shortcut'
|
||||
}
|
||||
|
||||
$userPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
|
||||
if ($userPath -like "*$BinDir*") {
|
||||
$newPath = ($userPath -split ';' | Where-Object { $_ -ne $BinDir }) -join ';'
|
||||
[Environment]::SetEnvironmentVariable('PATH', $newPath, 'User')
|
||||
Write-Host ' Removed from PATH'
|
||||
}
|
||||
|
||||
Write-Host 'Uninstall complete.' -ForegroundColor Green
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host ''
|
||||
Write-Host ' Codex Launcher - Windows Installer' -ForegroundColor Cyan
|
||||
Write-Host ' ====================================' -ForegroundColor Cyan
|
||||
Write-Host ''
|
||||
|
||||
# Check Python
|
||||
$pythonExe = Get-Command python -ErrorAction SilentlyContinue
|
||||
if (-not $pythonExe) {
|
||||
$pythonExe = Get-Command python3 -ErrorAction SilentlyContinue
|
||||
}
|
||||
if (-not $pythonExe) {
|
||||
Write-Host 'ERROR: Python not found. Install Python 3.8+ and add to PATH.' -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Write-Host " Python: $($pythonExe.Source)" -ForegroundColor Gray
|
||||
|
||||
# Create install directory
|
||||
New-Item -ItemType Directory -Force -Path $BinDir | Out-Null
|
||||
|
||||
# Copy files
|
||||
$srcDir = Join-Path $PSScriptRoot 'src'
|
||||
$files = @(
|
||||
'translate-proxy.py',
|
||||
'codex-launcher-gui.py',
|
||||
'codex_launcher_lib.py',
|
||||
'cleanup-codex-stale.py'
|
||||
)
|
||||
|
||||
foreach ($file in $files) {
|
||||
$src = Join-Path $srcDir $file
|
||||
if (Test-Path $src) {
|
||||
Copy-Item -Force $src $BinDir
|
||||
Write-Host " Installed: $file" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " WARNING: $file not found in src/" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# Create Start Menu shortcut
|
||||
$WshShell = New-Object -ComObject WScript.Shell
|
||||
$shortcutPath = Join-Path $StartMenu 'Codex Launcher.lnk'
|
||||
$Shortcut = $WshShell.CreateShortcut($shortcutPath)
|
||||
|
||||
# Find pythonw.exe for no-console launch
|
||||
$pythonw = Get-Command pythonw -ErrorAction SilentlyContinue
|
||||
if (-not $pythonw) {
|
||||
$pythonDir = Split-Path $pythonExe.Source
|
||||
$pythonwCandidate = Join-Path $pythonDir 'pythonw.exe'
|
||||
if (Test-Path $pythonwCandidate) {
|
||||
$pythonw = $pythonwCandidate
|
||||
}
|
||||
}
|
||||
|
||||
if ($pythonw) {
|
||||
$targetPath = if ($pythonw.Source) { $pythonw.Source } else { $pythonw }
|
||||
} else {
|
||||
$targetPath = $pythonExe.Source
|
||||
}
|
||||
$Shortcut.TargetPath = $targetPath
|
||||
$guiPath = Join-Path $BinDir 'codex-launcher-gui.py'
|
||||
$Shortcut.Arguments = $guiPath
|
||||
$Shortcut.WorkingDirectory = $BinDir
|
||||
$Shortcut.Description = 'Launch Codex Desktop with any AI provider'
|
||||
$Shortcut.Save()
|
||||
Write-Host ' Created Start Menu shortcut' -ForegroundColor Green
|
||||
|
||||
# Add to PATH
|
||||
$userPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
|
||||
if ($userPath -notlike "*$BinDir*") {
|
||||
$newUserPath = $userPath + ';' + $BinDir
|
||||
[Environment]::SetEnvironmentVariable('PATH', $newUserPath, 'User')
|
||||
$env:PATH = $env:PATH + ';' + $BinDir
|
||||
Write-Host ' Added to user PATH' -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Verify
|
||||
Write-Host ''
|
||||
Write-Host ' Installation complete!' -ForegroundColor Cyan
|
||||
Write-Host " Install dir: $BinDir" -ForegroundColor Gray
|
||||
Write-Host ''
|
||||
Write-Host ' Launch options:' -ForegroundColor White
|
||||
Write-Host ' Start Menu: Codex Launcher' -ForegroundColor Gray
|
||||
Write-Host ' Command: codex-launcher-gui.py' -ForegroundColor Gray
|
||||
Write-Host ' Uninstall: powershell -File install.ps1 -Uninstall' -ForegroundColor Gray
|
||||
Write-Host ''
|
||||
12
install.sh
12
install.sh
@@ -3,13 +3,11 @@ set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
if [ -f "$SCRIPT_DIR/codex-launcher_3.11.6_all.deb" ]; then
|
||||
echo "Installing codex-launcher_3.11.6_all.deb ..."
|
||||
sudo dpkg -i "$SCRIPT_DIR/codex-launcher_3.11.6_all.deb"
|
||||
else
|
||||
echo "WARNING: codex-launcher_3.11.6_all.deb not found; copying files manually."
|
||||
fi
|
||||
echo "Installed v3.11.6 via .deb package."
|
||||
if [ -f "$SCRIPT_DIR/codex-launcher_3.9.7_all.deb" ]; then
|
||||
echo "Installing codex-launcher_3.9.7_all.deb ..."
|
||||
sudo dpkg -i "$SCRIPT_DIR/codex-launcher_3.9.7_all.deb"
|
||||
echo ""
|
||||
echo "Installed v3.9.7 via .deb package."
|
||||
echo " translate-proxy.py -> /usr/bin/translate-proxy.py"
|
||||
echo " codex-launcher-gui -> /usr/bin/codex-launcher-gui"
|
||||
echo " cleanup-codex-stale -> /usr/bin/cleanup-codex-stale.sh"
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Cleanup stale Codex Launcher processes and artifacts — cross-platform.
|
||||
|
||||
Kills registered process groups and removes stale PID/socket files left
|
||||
by previous Codex Launcher sessions.
|
||||
|
||||
Windows: uses taskkill /F /T /PID
|
||||
Linux: uses kill -TERM -- -PGID
|
||||
"""
|
||||
|
||||
import json, os, sys, subprocess, time
|
||||
from pathlib import Path
|
||||
|
||||
IS_WINDOWS = sys.platform == "win32"
|
||||
|
||||
if IS_WINDOWS:
|
||||
_local = os.environ.get("LOCALAPPDATA", str(Path.home() / "AppData" / "Local"))
|
||||
PID_REGISTRY = Path(_local) / "codex-proxy" / "pids.json"
|
||||
CODEX_DIR = Path.home() / ".codex"
|
||||
_local_share = Path(_local)
|
||||
_cache = Path(_local)
|
||||
else:
|
||||
PID_REGISTRY = Path.home() / ".cache" / "codex-proxy" / "pids.json"
|
||||
CODEX_DIR = Path.home() / ".codex"
|
||||
_local_share = Path.home() / ".local" / "share"
|
||||
_cache = Path.home() / ".cache"
|
||||
|
||||
|
||||
def kill_group(pid):
|
||||
if IS_WINDOWS:
|
||||
subprocess.run(["taskkill", "/F", "/T", "/PID", str(pid)],
|
||||
capture_output=True, timeout=10)
|
||||
else:
|
||||
import signal
|
||||
try:
|
||||
pgid = os.getpgid(pid)
|
||||
os.killpg(pgid, signal.SIGTERM)
|
||||
time.sleep(0.5)
|
||||
try:
|
||||
os.killpg(pgid, signal.SIGKILL)
|
||||
except OSError:
|
||||
pass
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
print("[cleanup] Cleaning up stale Codex Launcher processes...", file=sys.stderr)
|
||||
|
||||
if PID_REGISTRY.exists():
|
||||
try:
|
||||
with open(PID_REGISTRY) as f:
|
||||
registry = json.load(f)
|
||||
except Exception as e:
|
||||
print(f"[cleanup] Failed to read PID registry: {e}", file=sys.stderr)
|
||||
registry = {}
|
||||
|
||||
for kind, info in registry.items():
|
||||
pid = info.get("pid") if isinstance(info, dict) else info
|
||||
if pid and isinstance(pid, int):
|
||||
print(f"[cleanup] Killing {kind} (PID {pid})", file=sys.stderr)
|
||||
kill_group(pid)
|
||||
|
||||
try:
|
||||
PID_REGISTRY.unlink()
|
||||
except OSError:
|
||||
pass
|
||||
else:
|
||||
print("[cleanup] No PID registry found — nothing to stop", file=sys.stderr)
|
||||
|
||||
stale_files = []
|
||||
if IS_WINDOWS:
|
||||
stale_files = [
|
||||
_cache / "codex-desktop" / ".codex-desktop-pid",
|
||||
_cache / "codex-desktop" / ".webview-pid",
|
||||
]
|
||||
else:
|
||||
stale_files = [
|
||||
CODEX_DIR / ".launch-action-socket",
|
||||
CODEX_DIR / ".codex-desktop-launch-action",
|
||||
CODEX_DIR / ".codex-desktop-pid",
|
||||
CODEX_DIR / ".webview-pid",
|
||||
_local_share / "codex-desktop" / ".codex-desktop-pid",
|
||||
_local_share / "codex-desktop" / ".webview-pid",
|
||||
_cache / "codex-desktop" / ".codex-desktop-pid",
|
||||
_cache / "codex-desktop" / ".webview-pid",
|
||||
]
|
||||
|
||||
for fp in stale_files:
|
||||
try:
|
||||
if fp.exists():
|
||||
fp.unlink()
|
||||
print(f"[cleanup] Removed {fp}", file=sys.stderr)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
print("[cleanup] Done", file=sys.stderr)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
6067
translate-proxy.py
Executable file
6067
translate-proxy.py
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user