lij768423-svg/grok2api-egress-enhancements

Grok2API & CPA egress quality guard with proxy recovery, quarantine, migration, and operations UI

What it solves

This project is an unofficial enhancement pack for grok2api, a proxy that exposes Grok AI models through an API. When running grok2api in production with many residential IP addresses and accounts, operators face two problems: proxy connections fail and need fast recovery, and some responses are "degraded" — they lack the thinking/reasoning content that should accompany the answer. This pack adds patches and a companion "Quality Guard" process to detect and handle both issues automatically.

How it works

The pack works in three layers:

  • Patches to grok2api add "fixed proxy fast recovery": if a proxy connection fails before a request is sent, the node is cooled down and immediately retested, without replaying requests or confusing auth/rate-limit errors with proxy faults.
  • A Quality Guard sidecar (a separate process) passively measures each node's throughput (tokens per second), actively probes nodes with a fixed prompt, isolates nodes that fail thresholds, and can rotate to a new IP. It also provides an admin page and APIs.
  • Request-path thinking interception holds streaming responses until real thinking evidence appears (like reasoning deltas or encrypted content above a minimum size). If a response is just a short stub or lacks thinking, it's not sent to the user — the system retries with another account, and after several failures returns a "quality degraded" error.

The README also describes a CPA plugin (v1.1.0) that does similar quality guarding natively within the CPA proxy system, without depending on grok2api.

Who it's for

Operators who run grok2api at scale with many residential proxies and accounts, and need to keep response quality high and proxy failures under control. It's not for single-account or stable static proxy setups — the README says those can skip the CPA plugin.

Highlights

  • Fixed proxy fast recovery: failed nodes are cooled down and retested asynchronously, with no replay of submitted requests.
  • Quality Guard sidecar: passive TPS auditing, active probing, node isolation, and optional IP rotation via webhook or 1024Proxy sticky sessions.
  • Thinking interception: holds responses until real streaming thinking is seen; short stubs and bare-over-floor flushes are rejected.
  • Retry logic: up to 6 attempts, then 503 quality_degraded; accounts that fail thinking are cooled down or disabled.
  • Admin UI with probe profiles, degraded-account panel, and batch operations.
  • CPA native plugin for proxy quality management without grok2api dependency.

Related

  • Project
  • Dispatch
  • Dispatch
  • Dispatch
  • Dispatch