Skip to main content

Module recorder

Module recorder 

Source
Expand description

Live recording proxy for claude-api-test.

Recorder runs an in-process HTTP forwarder on 127.0.0.1 that captures every request a claude_api::Client sends through it, tees the exchange to a JSONL cassette file, and returns the upstream response unchanged. Pair with mount_cassette and Cassette::from_path for replay.

let recorder = Recorder::start(RecorderConfig {
    upstream: "https://api.anthropic.com".into(),
    cassette_path: "./cassette.jsonl".into(),
    ..Default::default()
}).await?;

let client = claude_api::Client::builder()
    .api_key(env!("ANTHROPIC_API_KEY"))
    .base_url(recorder.url())
    .build()?;

// ... drive the client; every request lands in cassette.jsonl ...

recorder.shutdown().await?;

Structs§

Recorder
Live in-process recording proxy. Drop the value to begin shutdown, or call Self::shutdown for an awaitable clean exit.
RecorderConfig
Configuration for Recorder::start.

Constants§

DEFAULT_REDACT_HEADERS
Headers redacted from saved cassette entries by default.