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::shutdownfor an awaitable clean exit. - Recorder
Config - Configuration for
Recorder::start.
Constants§
- DEFAULT_
REDACT_ HEADERS - Headers redacted from saved cassette entries by default.