Skip to main content

clodtok

Capture the x-api-key header that Claude Code sends to Anthropic, by funneling its traffic through a temporary mitmproxy instance.

Requirements

External CLIs that must already be on PATH:

  • uvx (from uv)
  • claude (Claude Code CLI), configured with x-api-key auth

Usage

uvx clodtok

Flags:

  • --prompt TEXT — prompt sent to claude -p to trigger an API call (default: "hi")
  • --host HOST — proxy listen host (default: 127.0.0.1)
  • --port PORT — proxy listen port (default: 8888)
  • --timeout SECONDS — how long to wait for the key (default: 60)
  • --debug — show mitmdump and claude output

The captured API key is printed to stdout. Errors go to stderr.

How it works

  1. Launches mitmdump (via uvx --from mitmproxy) on the configured port with a small Python addon.
  2. Launches claude -p <prompt> with HTTPS_PROXY, HTTP_PROXY, and NODE_TLS_REJECT_UNAUTHORIZED=0 set so its TLS traffic is intercepted.
  3. The addon scans each request for an x-api-key header and writes it to a sentinel file the parent process is watching.
  4. As soon as the key appears, both subprocesses are torn down and the key is printed.

Caveats

  • Only works when Claude Code authenticates with x-api-key. OAuth, Bedrock, and Vertex flows use different headers and will not produce a key here.
  • The configured port (default 8888) must be free.

Metadata

Release files for clodtok 0.1.4

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

Source distribution (sdist)

Source distribution for clodtok 0.1.4
File Size Uploaded Provenance Actions
clodtok-0.1.4.tar.gz 5.2 kB Without provenance Details for clodtok-0.1.4.tar.gz

Built distribution (wheel)

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

Total release size: 11.1 kB

Release files / clodtok-0.1.4.tar.gz

Download URL clodtok-0.1.4.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a953b1ffc667a0b1b162ed9e76051a1f680bf185dc9bf386646c8d36608c3986
BLAKE2b-256 checksum
How to use checksums
4daf2218fe06d8c2386a8f12838850549b8f9694078193902cfe4d6c8783dab3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.13

Release files / clodtok-0.1.4-py3-none-any.whl

Download URL clodtok-0.1.4-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54a99ed992944daf587b448fa22281e67d92b75363a4ac7f01e5affde72707c7
BLAKE2b-256 checksum
How to use checksums
aa1f7ddd7a7cab6e9789ddd2bf8fb832b0b8a878b6f8de3f1c554fe872134b93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.13

Security for clodtok 0.1.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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