Caveman
The proxyOverview

The proxy

Point an agent at http://127.0.0.1:8787 and provider traffic runs through the standalone Caveman proxy. It is single-operator, BYOK, and local. Default mode records traffic without changing request bodies.

Fig. — the proxy request path
Agentbase-URL swapcaveman-proxy · 127.0.0.1:8787matchauthtransformbyte-safemeterProviderBYOK upstreambytes intactresponse~/.caveman/caveman.dbinferred spend · SQLite

The proxy matches provider routes, resolves credentials, forwards upstream through an SSRF-guarded client, and records local spend in SQLite. Savings basis is always inferred.

Base-URL swap, nothing else

The proxy speaks provider wire protocols directly, so many agents need only a base URL override:

terminal
# build and start it with your own key
go build -o ./bin/caveman-proxy ./public/proxy/cmd/caveman-proxy
ANTHROPIC_API_KEY=sk-ant-… ./bin/caveman-proxy

# point any Anthropic-speaking agent at it
export ANTHROPIC_BASE_URL=http://127.0.0.1:8787

The cave CLI wraps both halves: caveman start launches the binary and caveman wrap <agent> starts a supported agent with the right environment.

The request lifecycle

Every request runs the same five steps:

Match

The route resolves to a provider adapter. Unknown route returns 404.

Authenticate

Provider key comes from environment first. If unset, the proxy passes through the inbound request's own auth header.

Inspect & transform (byte-safe)

In record mode, nothing is transformed. In compress mode, schema-aware providers can extract text segments, run the engine, and reassemble the body. Any problem falls back to the original.

Upstream

The request is forwarded to the provider through an always-on SSRF-guarded client.

Meter

The round trip is written to local SQLite. Rows are labeled inferred.

Public package boundary

Provider adapters live under public/proxy/providers. They depend on public types and take a small RouteContext, so the standalone proxy does not import private services.

Honesty rule

Standalone records Basis: "inferred" on every spend row. It never writes verified and never reprojects local rows into monthly savings. The SSRF guard is always on in standalone mode; CAVE_SSRF_ALLOWLIST is the escape hatch for local model servers.

Dig in