【CPA 28-Day Challenge】(2026.10.19 – 11.15)
Over the next 28 days, each day we’ll either ship one CPA tip that is a clear improvement and relevant for most CPA (Codex / Kimi / Antigravity / Claude / Grok / Muse / Devin) users or do a full reset. Let the improvements begin.
在接下来的 28 天里,每天我们要么分享一个对大多数 CPA(Codex / Kimi / Antigravity / Claude / Grok / Muse / Devin)用户真正有用的硬核技巧,要么来一次全面重置(Full Reset)。让改进开始吧。
@counterbeing@bornio@theo No restart needed: CPA has a management API to refresh the model list on demand:
curl -X POST http://127.0.0.1:8317/v8/management/models/refresh -H "Authorization: Bearer <management-key>"
New models show up in /v1/models right away, and live streams keep running.
[CPA 28-Day Challenge · Day 12]
One HTML file to run your entire gateway: meet the redesigned CLI Proxy API Management Center (CPAMC).
Over the past 11 days, we wired up OAuth subscriptions, protocol translation, model aliases, priority tiers, session affinity, and retry policies in config.yaml.
Now you can see and orchestrate all of it from a single browser tab—zero extra containers, zero Node.js runtime, bundled directly inside CLIProxyAPI as one self-contained file at /management.html:
1. Live Operations Dashboard:
Real-time request throughput, rolling-window success rate (e.g., 99.3% across 20,000+ calls), traffic burst detection, and instant counts of active credentials, provider keys, and exposed models.
2. Unified AI Provider Hub (Light & Dark Themes):
Manage Claude, Codex, Gemini, Interactions API, Kimi, Muse (Meta), xAI, Vertex, and OpenAI-compatible endpoints in one place—with per-key success/failure counters and 100% health bars.
3. Visual Routing & Failover Orchestration:
Preview how any model routes across priority tiers (e.g., Priority 100 -> 50 -> 10). When a primary account drops or cools down, watch traffic cascade to the next tier automatically, and toggle Round-Robin / Weighted / Fill-First, Session Affinity, and Retry Rounds on the fly.
4. Per-Account Subscription Quota Cards:
Check remaining 5-hour and weekly quota windows at a glance across Claude (Max 20x), Codex (Pro 200), xAI (SuperGrok), Kimi (Allegretto), and Antigravity without opening five different billing dashboards.
5. YAML Config Editor with Pre-Save Diff Review:
Edit settings visually or in raw YAML, and inspect a Git-style line-by-line diff modal ("Confirm Changes") before saving—hot-reloaded by CPA in milliseconds without dropping active streams.
Task for Day 12: open your built-in CPAMC console in your browser (or launch it from EZCPA), check your live subscription quotas, and preview your routing tiers:
http://127.0.0.1:8317/management.html
[CPA 28-Day Challenge · Day 11]
Pre-first-byte self-healing & retry rounds: recover silent TLS hangs, early stream drops, and hidden HTTP-200 overloads before your client ever notices.
In streaming AI APIs, once HTTP 200 headers are flushed to the client, a traditional proxy can no longer switch credentials if the upstream errors out a split second later. Even worse, providers like Codex sometimes return HTTP 200, emit a couple of handshake frames ("response.created", "https://t.co/TqE9KNIKFa_progress"), and then smuggle a "server_is_overloaded" error inside the stream.
CPA closes these failure windows with three layers of pre-first-byte self-healing:
1. Multi-Round Credential Retries ("routing.retry"):
Control how many additional retry rounds CPA runs across your pool on HTTP 403/408/429/500/502/503/504 failures:
routing:
retry:
request-retry: 3 # Additional retry rounds after Round 0 (can override per key/auth JSON)
max-retry-credentials: 0 # Cap credentials tried per round (0 = try all eligible)
max-retry-interval: 30 # Max seconds to wait if all accounts are briefly in cooldown
2. Safe Streaming Bootstrap Retries & TLS Handshake Bounds ("requests"):
If an upstream connection hangs during the TLS handshake or drops a stream before any payload bytes are committed downstream, CPA transparently re-runs the stream on the next credential:
requests:
tls-handshake-timeout-seconds: 10 # Bound stalled uTLS handshakes so retry can kick in; lifted once connected
nonstream-keepalive-interval: 15 # Emit blank lines every 15s on non-streaming calls to prevent proxy 504s
streaming:
bootstrap-retries: 2 # Retry streaming calls before the first byte is sent to the client
keepalive-seconds: 15 # Emit ": keep-alive" SSE heartbeats
send-keepalive-before-ft: false # Keep false when pairing with bootstrap buffering so headers stay uncommitted
3. Codex Stream Bootstrap Buffering ("upstream.codex"):
Hold back uncommitted response headers across empty handshake frames ("response.created", "https://t.co/TqE9KNIKFa_progress", empty "*.added", heartbeats) until the first real generated token or tool call arrives:
upstream:
codex:
stream-bootstrap-buffering: true
stream-bootstrap-timeout: "20s" # Safety ceiling for Nginx/Cloudflare timeouts (48-frame / 1 MiB buffer cap)
If Codex smuggles a "server_is_overloaded" or rate-limit rejection right after the handshake, CPA discards the buffered handshake and fails over to another credential seamlessly—your coding client only sees a clean, uninterrupted stream.
Task for Day 11: enable "bootstrap-retries: 2" and "stream-bootstrap-buffering: true" (with "stream-bootstrap-timeout: 20s" if behind Nginx/Cloudflare) in config.yaml or EZCPA, and test a streaming request:
curl -N http://127.0.0.1:8317/v1/responses \
-H "Authorization: Bearer YOUR_ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-6.1-sol","stream":true,"input":[{"role":"user","content":"Stream a short haiku about self-healing gateways."}]}'
Credit where it's due: after my earlier post on gemini-4-argon's brutal quota drain (https://t.co/r5IqsFQr48), Google stepped up, fixed the implicit cache accounting bug, and even gave us a quota reset. Fast turnaround — respect for that.
That said, after cross-checking Google's updated caching docs (https://t.co/PkkiSBoM4i) against 6,500+ real Coding Agent turns from my local gateway, 3 major pain points still stand out:
1️ Gemini Flash in Agents: ~3-min amnesia & the 4,096-token step trap Pause for just ~3 mins to review a diff and Flash starts dropping cache hard (>5 mins is basically a wipeout). Worse, its cache pointer only moves in 4,096-token chunks. Whenever a turn adds <4,096 tokens, cache progress stalls completely, and those unabsorbed 1k–4k tokens get re-billed at full uncached rates on every single turn until you finally cross the next 4k mark.
2️ Argon: Longer TTL, but a sneaky 2,050-token tail tax & random drops • Longer TTL, still flaky: Argon killed explicit caching completely. Implicit cache now holds up for 15–30 mins (80%–92% survival at 3–10 mins). Yet even on a single account in rapid back-and-forth (<45s apart), ~1.5% of turns still randomly drop to 0-cache and re-prefill 150k+ tokens from scratch. • The 2,050-token tail tax: Google's docs claim: "For smaller additions [<2,050 tokens], Gemini re-processes the last 2,050 tokens of the previous request at the standard input rate. Most agent turns exceed this threshold." Honestly, whoever wrote "most agent turns exceed this threshold" doesn't run coding agents. Running rg, git status, or a small edit only adds a few hundred tokens. Across 5,867 cache-hit turns, over half got slapped with an exact 2,049-token re-billing penalty — paying full uncached price again for the tail of the previous turn, inflating total uncached billing by +46%.
3️ Argon's TTFT is painfully slow compared to everything else Even with >80% cache hit on 100k+ context, Argon takes 17–20s on average just to produce the first token (P50 14s, P90 40s). For comparison, my TTFT tracker explicitly strips out GPT's encrypted_content tokens so it only measures real visible/reasoning output — and even then, GPT-Sol takes just ~5s, while Claude Opus, DeepSeek, and GLM take ~2s. Waiting 15–40s per step makes single-tool agent loops brutal unless you batch tool calls into scripts.
Google Antigravity has a quota accounting bug on Gemini 4 Argon: it ignores the 95% implicit cache discount and bills cached tokens as 100% full input, draining the $200/mo Ultra weekly limit ~7x faster than it should.
I tracked token telemetry on my $200/mo Google AI Ultra plan before and after my weekly quota reset — here is the side-by-side proof:
1. Prior Cycle (`gemini-3.8-flash-high` — Cache Discount Works):
On `gemini-3.8-flash-high` ($1.50/1M in, $7.50/1M out, $0.15/1M cached at 90% off), processing ~1.2B total input tokens (~888M cached, 74% cache hit rate) + ~33.8M output tokens equals ~$875 in standard API value.
That consumed ~30% of the weekly Ultra limit — meaning a $200/mo Ultra plan normally gives ~$2,900–$3,000/week in list-price Gemini quota (~$1,450–$1,500/week at 50% intro pricing).
If Flash hadn't discounted those 888M cached tokens by 90%, it would have burned over $2,000 (~70% of the weekly quota). So Flash caching works as advertised.
2. Current Cycle (`gemini-4-argon-high` — Cache Discount Broken):
Published Gemini 4 Argon API pricing (through Nov 30):
- Uncached Input: $2.00 / 1M ($4.00 after Dec 1)
- Output (incl. thinking): $10.00 / 1M ($20.00 after Dec 1)
- Implicit Cached Input: $0.10 / 1M (95% OFF — 1/20th of input)
After my weekly reset, I ran `gemini-4-argon-high` in multi-turn agentic coding sessions:
- Total Input: ~425.0M tokens
- Uncached Input: ~85.6M tokens
- Implicit Cache Hits: ~339.4M tokens (~80% cache hit rate)
- Total Output (incl. thinking): ~4.2M tokens
At published introductory API rates ($2/$10/$0.10), this entire workload costs just ~$247 (or ~$495 at post-Dec 1 full rates).
Yet it wiped out ~62% of my entire weekly Ultra quota in a single day!
At that burn rate, a $200/mo Ultra plan running pure Argon hits 0% weekly quota after only ~$400 of intro-priced API usage.
3. The Exact Upstream Bug:
Why did ~$247 of Argon eat ~62% of a ~$2,900/week Ultra quota pool?
In Gemini's `usageMetadata`, `promptTokenCount` reports TOTAL input (uncached + `cachedContentTokenCount`).
For `gemini-4-argon` (which uses durable implicit caching only), Antigravity's quota meter appears to bill `promptTokenCount` directly at the full $4.00/1M rate without subtracting `cachedContentTokenCount` at 95% off (and without applying the Nov 30 50% intro discount):
425.0M total input × $4.00/1M + 4.2M output × $20.00/1M = $1,700 + $84 = $1,784.
And what is $1,784 divided by the ~$2,900 Ultra weekly cap?
61.5% — matching the ~62% weekly quota drop almost to the decimal!
4. Community Reports & Telemetry Showing the Exact Same Issue:
- @1984_is_today ($200 Ultra telemetry: 19.5M uncached in / 2.7M out / 315M cached = $97.50 intro cost, yet it ate 1/3rd of the weekly limit — billing all 334.5M total input at full rate is ~$1,050+, which is ~35% of a $3,000 cap):
https://t.co/QNfsJGzX6w
https://t.co/MsuooJrYLx
- @MarshGradivus ($200 Ultra burning ~30% of weekly quota in 2 hours across 3 sessions):
https://t.co/JBeKkDkRcT
- @ashen_one ($100 Ultra hitting limit in 30 mins):
https://t.co/vFGcsJmxyw
- @khatabxbt (One-shotting session usage limit on Argon):
https://t.co/vnVI4W7vcp
In multi-turn agentic coding, every step re-sends 100k+ tokens of cached context. Billing `cachedContentTokenCount` as full uncached input penalizes Antigravity Ultra users by ~6.5x to 7x on every turn.
Could the team check if `cachedContentTokenCount` is being discounted by 95% in the `gemini-weekly` / `gemini-5h` quota calculation for Gemini 4 Argon (and consider a quota reset once patched)?
cc @_mohansolo@kevinhou22@OfficialLoganK@_anshulr@vikaskansalHQ@antigravity@googleaidevs
Powered by gemini-4-argon-high