Skip to main content

tokensaver-egress

Client-side HTTPS egress capture proxy for the TokenSaver control plane (ACP-4).

Runs on the client (Claude Code, Cursor, n8n, custom agents). Captures outbound HTTP/HTTPS — including flows that protocol-aware SDKs never see — then ships metadata (and optionally bodies) to POST /api/v1/egress/ingest.

PyPI Python 3.10+ License: MIT

Install

pip install tokensaver-egress

Editable (monorepo):

pip install -e "packages/egress[dev]"

Quick start

export TOKENSAVER_API_KEY=ts_...
export TOKENSAVER_INGEST_URL=https://api.tokensaver.fr/api/v1/egress/ingest

# Optional MITM (model / tokens / tool names)
tokensaver-egress init-ca
# Trust ~/.tokensaver-egress/ca/ca.crt on the client OS (+ NODE_EXTRA_CA_CERTS for Node)
export EGRESS_MITM_ENABLED=true

tokensaver-egress serve --port 8888

Point any client at the proxy:

export HTTPS_PROXY=http://127.0.0.1:8888
export HTTP_PROXY=http://127.0.0.1:8888
export NODE_EXTRA_CA_CERTS=$HOME/.tokensaver-egress/ca/ca.crt   # Claude Code / Node

Equivalent module form: python -m tokensaver_egress serve --port 8888.

Modes

Mode How Capture
Explicit (default) HTTPS_PROXY → proxy host, bytes, latency; HTTP JSON when parseable
MITM EGRESS_MITM_ENABLED=true + trusted CA model, tokens, MCP/A2A, optional bodies
Transparent tokensaver-egress serve --transparent + scripts/tproxy-setup.sh (Linux) original dst + SNI, metadata

Env (common)

Variable Role
TOKENSAVER_API_KEY Ship audits + governance (authorize, compress, …)
TOKENSAVER_INGEST_URL Default SaaS: https://api.tokensaver.fr/api/v1/egress/ingest
EGRESS_MITM_ENABLED TLS terminate known LLM hosts
EGRESS_CAPTURE_BODIES Persist request/response bodies (auth headers masked)
EGRESS_ENFORCE_ENABLED Pre-flight catalogue deny (zero-trust)
OTEL_EXPORTER_OTLP_ENDPOINT Optional OTLP traces (e.g. http://localhost:4318/v1/traces)

Monorepo helpers

From the TokenSaver platform repo:

./scripts/start-egress.sh --mode mitm --capture-bodies
./scripts/stop-egress.sh

Docs: RUNBOOK-EGRESS-ACP-4 · SPEC-ACP-4

Security note

HTTPS_PROXY is convenience, not a hard boundary. Real anti-bypass needs network controls (TPROXY / NetworkPolicy). MITM requires trusting a local CA you generate — only do this on machines you control.

Related

License

MIT © TokenSaver

Release files for tokensaver-egress 0.1.2

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

Source distribution (sdist)

Source distribution for tokensaver-egress 0.1.2
File Size Uploaded
tokensaver_egress-0.1.2.tar.gz 69.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tokensaver-egress 0.1.2
File Interpreter ABI Platform
tokensaver_egress-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 139.4 kB

Release files / tokensaver_egress-0.1.2.tar.gz

Download URL tokensaver_egress-0.1.2.tar.gz
Size 69.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0bca5e63b4998d9067b9dbd7137c73f2081804fcbc73093c829edd24a6d6fcf5
BLAKE2b-256 checksum
How to use checksums
4cde2a7d53730ba4e1f7bd3acf77bcb392b78de6ddc7e1079e083ee29b43648b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / tokensaver_egress-0.1.2-py3-none-any.whl

Download URL tokensaver_egress-0.1.2-py3-none-any.whl
Size 70.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3b063cb36a4b414c04740a466e3c7a637fc35c6b43ffaef3d7410523c428a0f
BLAKE2b-256 checksum
How to use checksums
7feef5ad75bbe8d9bdefd7ba17ce67bb15d3e4f5fb49e923a5a18d2dc0f66d9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

0.1.35

2 release files

0.1.34

2 release files

0.1.33

2 release files

0.1.32

2 release files

0.1.31

2 release files

0.1.30

2 release files

0.1.29

2 release files

0.1.28

2 release files

0.1.27

2 release files

0.1.26

2 release files

0.1.25

2 release files

0.1.24

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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