Skip to main content

Antiglaude

PyPI CI Release Python uv FastAPI Claude Code OpenAI Compatible License

A high-performance local protocol gateway and inference server. Antiglaude translates Anthropic Messages and OpenAI Chat Completions requests into Google Cloud Code and Gemini execution formats, enabling Claude Code CLI and standard AI toolchains to operate against upstream models including claude-sonnet-4-6, claude-opus-4-6-thinking, gemini-3-flash, and gemini-2.5-pro.


Contents


Overview

Interfacing external developer tooling with enterprise cloud backends introduces protocol impedance mismatches:

  • Token Expiration: Upstream access tokens expire after 60 minutes. Antiglaude Bridge extracts permanent refresh credentials from local application state and transparently renews access tokens in the background.
  • Protobuf Schema Incompatibilities: Advanced JSON Schema keywords emitted by agentic runtimes (propertyNames, anyOf, const) cause HTTP 400 rejection in Google protobuf serializers. The bridge applies bidirectional AST normalizations to guarantee full tool calling compatibility.
  • Header & Identity Filtering: Third-party billing headers and self-identification banners trip strict upstream quota filters. The gateway neutralizes identity markers and scrubs unsupported metadata.
  • Keep-Alive Resilience: Long reasoning turns can trigger client connection drops. The gateway emits periodic SSE keep-alive heartbeats and handles TCP resets with pooled connection limits and instant retry failover.

Quick Start

Option A: Install from PyPI

Install the CLI toolchain via pip or Astral's uv:

# Using pip
pip install antiglaude

# Or using uv tool
uv tool install antiglaude

# Or run instantly without installing
uvx antiglaude start

Once installed, use the antiglaude CLI directly:

# Start the gateway server
antiglaude start

# Launch the live Terminal Control Panel
antiglaude tui

# Configure Claude Code system-wide (/model picker + default bridge)
antiglaude setup-claude

# Install macOS LaunchAgent daemon (auto-starts on boot)
antiglaude daemon install

Option B: Clone from Source

For development or direct Makefile execution via Astral's uv:

git clone https://github.com/sksarvesh007/antiglaude.git
cd antiglaude

# Bootstrap virtual environment and start gateway on port 8080
make start

# Configure Claude Code system-wide and install macOS background daemon
make setup-claude
make daemon-install

Terminal Control Panel

Antiglaude Bridge includes a terminal-based dashboard for real-time monitoring of daily request quotas, account identity, upstream latency, and inference logs.

make tui
+--------------------------------------------------------------------------------------------------------+
| ANTIGLAUDE BRIDGE  |  ONLINE (http://127.0.0.1:8080)  |  Default: claude-sonnet-4-6  |  2026-11-04   |
+--------------------------------------------------------------------------------------------------------+
| Upstream Authentication                    | Rate Limits & Quota Meter                                 |
| Account:        user@antigravity           | Daily Limit:        1,500 reqs/day                        |
| Project ID:     aicode-consumers           | Requests Today:     14 [==......................] 0.9%    |
| Tier:           Google AI Pro              | Requests Remaining: 1,486                                 |
| Service:        Active (launchd)           | Lifetime Requests:  248                                   |
| Uptime:         1,840 seconds              | Tokens (In / Out):  104,200 / 14,800                      |
+--------------------------------------------+-----------------------------------------------------------+
| Routing Matrix & Supported Models                                                                      |
| Model Identifier           Target Backend                 Status      Requests  Description            |
| > claude-sonnet-4-6        Claude 3.7 Sonnet (Thinking)   Active            12  Primary agentic engine |
|   claude-opus-4-6-thinking Claude 3 Opus (Thinking)       Active             2  Deep reasoning & arch  |
|   gemini-3-flash           Gemini 3 Flash                 Active             0  Low-latency throughput |
|   gemini-2.5-pro           Gemini 2.5 Pro                 Active             0  Large context analysis |
+--------------------------------------------------------------------------------------------------------+
| Request Journal & Latency Log                                                                          |
| Time      Client       Endpoint             Model              Tokens    Latency  Status               |
| 02:49:09  claude-code  /v1/messages         claude-sonnet-4-6  23,609    1820 ms  200                  |
+--------------------------------------------------------------------------------------------------------+
| [r] Refresh   [m] Switch Model   [c] Run Claude   [s] Restart Server   [d] Daemon Manager   [q] Quit   |
+--------------------------------------------------------------------------------------------------------+

Keybindings

Key Action
r Force refresh account tier, token status, and quota metrics
m Switch active default model in ~/.claude/settings.json
c Launch interactive Claude Code session within the terminal
s Restart local gateway process and clear stale network sockets
d Open macOS LaunchAgent daemon management dialog
q Exit the dashboard

Claude Code Integration

In-Session Model Picker (/model)

Claude Code supports native model switching via the /model command when configured with a valid modelPicker manifest. Run:

make setup-claude

This writes the required schema to ~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "http://127.0.0.1:8080",
    "ANTHROPIC_API_KEY": "test",
    "CLAUDE_CODE_AUTO_MODE_SERVER": "0",
    "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
  },
  "model": "claude-sonnet-4-6",
  "modelPicker": {
    "replaceBuiltInOptions": false,
    "options": [
      {
        "model": "claude-sonnet-4-6",
        "label": "Claude Sonnet 4.6 (Thinking)",
        "description": "Fast agentic reasoning via Antiglaude Bridge",
        "behavesAs": "claude-3-7-sonnet"
      },
      {
        "model": "claude-opus-4-6-thinking",
        "label": "Claude Opus 4.6 (Thinking)",
        "description": "Deep reasoning with extended thinking via Antiglaude Bridge",
        "behavesAs": "claude-3-opus"
      },
      {
        "model": "gemini-3-flash",
        "label": "Gemini 3 Flash",
        "description": "High-speed completions via Antiglaude Bridge",
        "behavesAs": "claude-3-5-haiku"
      },
      {
        "model": "gemini-2.5-pro",
        "label": "Gemini 2.5 Pro",
        "description": "Analytical large-context model via Antiglaude Bridge",
        "behavesAs": "claude-3-7-sonnet"
      }
    ]
  }
}

Typing /model inside any Claude Code session displays the interactive selection menu with full keyboard navigation.

System-Wide Persistence

The make setup-claude command sets configurations in ~/.claude/settings.json and exports environment variables to ~/.zshrc. After setup, you can launch Claude Code from any terminal or process without passing flags:

claude

Auto Mode Classifier Billing Protocol

Claude Code versions 2.1+ include an auto-mode classifier protocol. Local gateways that do not return structured safeguard evaluations trigger billing fallback warnings.

Antiglaude Bridge resolves this through two complementary mechanisms:

  1. Safeguard Protocol Handling: The bridge parses the safeguards request parameter and returns structured safeguard_results matching Claude Code's internal schema (dangerous_tool_use, status available, outcome not_flagged).
  2. Local Classifier Delegation: CLAUDE_CODE_AUTO_MODE_SERVER="0" instructs the CLI harness to perform classifications locally without external billing queries.

Background Service (macOS launchd)

To run Antiglaude Bridge permanently in the background:

# Register and start launchd daemon
make daemon-install

Operational Characteristics

  • Installed to ~/Library/LaunchAgents/com.antiglaude.bridge.plist.
  • Automatically loads on macOS login and runs continuously with KeepAlive: true.
  • Starts before Antigravity IDE or Claude Code CLI sessions open; port 8080 is always available.
  • Logs are written to ~/.antiglaude/bridge.stdout.log and ~/.antiglaude/bridge.stderr.log.
# Check status or inspect logs
make daemon-status

# Stop and unregister daemon
make daemon-uninstall

OpenAI Compatible API

Antiglaude Bridge provides a drop-in /v1/chat/completions endpoint for standard OpenAI SDKs and third-party AI frameworks.

Python SDK

from openai import OpenAI

client = OpenAI(
    base_url="http://127.0.0.1:8080/v1",
    api_key="sk-antiglaude",
)

response = client.chat.completions.create(
    model="claude-sonnet-4-6",
    messages=[
        {"role": "system", "content": "You are a systems engineer."},
        {"role": "user", "content": "Describe memory paging in one sentence."},
    ],
)

print(response.choices[0].message.content)

Streaming

from openai import OpenAI

client = OpenAI(
    base_url="http://127.0.0.1:8080/v1",
    api_key="sk-antiglaude",
)

stream = client.chat.completions.create(
    model="claude-opus-4-6-thinking",
    messages=[{"role": "user", "content": "Write a quicksort implementation in C."}],
    stream=True,
)

for chunk in stream:
    content = chunk.choices[0].delta.content or ""
    print(content, end="", flush=True)

HTTP Request

# Non-streaming
curl -X POST http://127.0.0.1:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer test" \
  -d '{
    "model": "claude-sonnet-4-6",
    "messages": [{"role": "user", "content": "Ping"}]
  }'

# Streaming
curl -N -X POST http://127.0.0.1:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer test" \
  -d '{
    "model": "gemini-3-flash",
    "messages": [{"role": "user", "content": "Count from 1 to 5"}],
    "stream": true
  }'

Model Directory

Model Identifier Target Backend Optimized Workload
claude-sonnet-4-6 (default) Claude 3.7 Sonnet Agentic workflows, coding, tool calling
claude-opus-4-6-thinking Claude 3 Opus (Thinking) Complex reasoning, mathematical analysis, architecture
gemini-3-flash Gemini 3 Flash Low-latency completions, summaries, high concurrency
gemini-2.5-pro Gemini 2.5 Pro Deep analytical processing, large-context windows
claude-3-7-sonnet-latest claude-sonnet-4-6 Anthropic alias fallback
claude-3-5-haiku-latest gemini-3-flash Lightweight Anthropic alias fallback

Heuristic Fallback: Any arbitrary model identifier requested by a client (such as gpt-4o or legacy strings) is mapped to the most capable active upstream model while returning the requested ID in the completion response.

Third-Party Integrations

Configure your environment or client configuration:

  • LangChain / LlamaIndex: Set base_url="http://127.0.0.1:8080/v1", api_key="test".
  • Cursor / Continue.dev: Add custom OpenAI provider pointing to http://127.0.0.1:8080/v1.
  • AutoGen / CrewAI: Set base_url="http://127.0.0.1:8080/v1".

Architecture

+----------------------------------+     +----------------------------------+
|         Claude Code CLI          |     |      OpenAI Compatible SDKs      |
|    Anthropic Messages Protocol   |     |    LangChain, Cursor, Continue   |
+-----------------+----------------+     +-----------------+----------------+
                  |                                        |
                  | POST /v1/messages                      | POST /v1/chat/completions
                  +-------------------+--------------------+
                                      |
                                      v
+---------------------------------------------------------------------------+
|                         Antiglaude Bridge Gateway                         |
|                                                                           |
|   [Anthropic SSE Parser]                 [OpenAI Request/Response Bridge] |
|   - Stream chunk normalizer              - SSE event-to-chunk mapper      |
|   - Safeguard result emitter             - Token usage synthesizer        |
|                                                                           |
|   [Protocol & Schema Transformation]                                      |
|   - OpenAPI-to-Protobuf schema sanitizer (strips propertyNames, anyOf)    |
|   - System turn extraction & identity scrubber                            |
|                                                                           |
|   [Authentication & Reliability]                                          |
|   - Zero-touch OAuth token auto-refresher (permanent refresh credentials) |
|   - Rate-limit backoff engine & TCP keep-alive heartbeat watchdog         |
|   - Live telemetry journal & 1,500 daily quota tracking meter             |
+-------------------------------------+-------------------------------------+
                                      |
                                      | Cloud Code REST / Protobuf
                                      v
+---------------------------------------------------------------------------+
|                  Google Cloud Code / Gemini Inference API                 |
|   Claude Sonnet 4.6 (Thinking)         Gemini 3 Flash                     |
|   Claude Opus 4.6 (Thinking)           Gemini 2.5 Pro                     |
+---------------------------------------------------------------------------+

Makefile Reference

Target Description Example
make start Installs dependencies with uv and starts the gateway make start
make serve Alias for make start make serve PORT=8080
make tui Opens the terminal control panel make tui
make setup-claude Configures ~/.claude/settings.json and /model menu make setup-claude
make daemon-install Installs and loads macOS LaunchAgent service make daemon-install
make daemon-status Displays LaunchAgent process status and log output make daemon-status
make daemon-uninstall Stops and unregisters the LaunchAgent service make daemon-uninstall
make claude Starts Claude Code CLI routed through the local bridge make claude
make status Verifies token validity and upstream account resolution make status
make test Executes the test harness make test
make stop Terminates processes listening on the configured port make stop PORT=8080
make clean Removes virtual environment, build artifacts, and cache make clean

Testing

The test harness validates protocol conversions, schema sanitization, streaming event framing, and endpoint compatibility:

make test

All 18 unit tests execute in isolated test environments without consuming upstream inference quota.


Security and Privacy

  • Local Execution: The gateway binds exclusively to loopback (127.0.0.1).
  • No Third-Party Telemetry: Traffic flows directly between local clients and the configured Google infrastructure.
  • Credential Hygiene: Local state databases, OAuth tokens, and log directories are excluded from version control via .gitignore.

License

MIT License. See LICENSE for details.

Metadata

Release files for antiglaude 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for antiglaude 1.0.0
File Size Uploaded Provenance Actions
antiglaude-1.0.0.tar.gz 66.7 kB With provenance Details for antiglaude-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for antiglaude 1.0.0
File Interpreter ABI Platform Actions
antiglaude-1.0.0-py3-none-any.whl Python 3 none any Details for antiglaude-1.0.0-py3-none-any.whl

Total release size: 143.6 kB

Release files / antiglaude-1.0.0.tar.gz

Download URL antiglaude-1.0.0.tar.gz
Size 66.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0077aa5e7ea088bc3465c9e5a81b915effabce9a041d3390f5b6551bd06b2747
BLAKE2b-256 checksum
How to use checksums
e289cbef305623dc7d4d270d1cd6d21c8afb7b96f23ec50c281c35fef3ec808e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / antiglaude-1.0.0-py3-none-any.whl

Download URL antiglaude-1.0.0-py3-none-any.whl
Size 76.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc42d10c9525458cd03a1f499aff3dc7a428905b4781628afda278c949f319f1
BLAKE2b-256 checksum
How to use checksums
f3e73f754c50950477d61912c8590074e24dd6f1e61eefc0e4f56f87207d72f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for antiglaude 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for antiglaude-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page