jacek4yang

Cline Proxy — Development skill for Claude Code

Development community

High-fidelity Rust gateway for aggregating multiple Cline API keys with Claude Code and OpenAI compatibility.

How to install Cline Proxy

This entry records only its repository, not the path inside it, so there is no exact command to give. Open jacek4yang/cline-proxy and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Cline Proxy does

High-fidelity Rust gateway for aggregating multiple Cline API keys with Claude Code and OpenAI compatibility.

Alternatives in Development

README

cline-proxy

`cline-proxy` is a small Rust gateway that exposes OpenAI Chat Completions and Anthropic Messages APIs over one or more Cline API keys. Its primary use is running Claude Code against Cline while filling one configured key at a time.

**Routing invariant: ONLY an effective upstream HTTP 429 may trigger Cline API-key switching.** This includes a direct HTTP 429 and a high-confidence proxy wrapper that explicitly reports an upstream HTTP 429. Generic 5xx, network failures, timeouts, ambiguous error text, and interrupted streams never switch keys or replay a request.

Architecture

The binary contains five intentionally small subsystems:

  • Axum serves /v1/messages, /v1/messages/count_tokens, /v1/chat/completions, /v1/models, /healthz, and /readyz.
  • One long-lived rustls reqwest::Client provides HTTP/2, gzip, pooling, keep-alive, connect timeout, and read-inactivity timeout behavior.
  • A concurrency-safe pool holds the sticky active key, per-key effective-429 cooldown metadata (Healthy → Cooling → HalfOpen with single-flight probing), and runtime counters. No lock is held over a network await.
  • A debounced writer persists key cooldowns and the active key to a local JSON state file (name-keyed, wall-clock deadlines, atomic rename) so restarts never re-probe keys with known quota cooldowns.
  • The Anthropic adapter converts structured messages, images, tool use/results, reasoning, usage, stop reasons, and stateful OpenAI SSE into Anthropic SSE.
  • Central error and redaction paths remove configured secrets, Bearer values, API-key fields, cookies, and JWT-like values.

There is no OAuth, credential refresh, database, Redis, web UI, or balance poller. Configuration is read once from JSON at startup; `/admin/status` is a read-only, authenticated operational snapshot.

Build and install

Rust 1.88 or newer is required by the locked dependency graph.

cargo build --release
install -m 0755 target/release/cline