A test that passes at 9am and fails at 11am because a shared staging server hiccuped is worse than no test. VCR-style recording turns live API interactions into a cassette you can replay identically on every run - no network, no drift, no flakes.
Last updated: 2026-08-23 · APIGhost on GitHub
Not on public PyPI; the self-hosted index is currently unavailable. The git+ form above is the documented working pip path. Homebrew also works: brew tap Coding-Dev-Tools/homebrew-tap && brew install apighost.
Hand-written fixtures go stale the moment the API contract moves. Shared staging environments add latency, rate limits, and data that other people change under you. The result is the classic flake: same code, different answer.
The fix is to make the HTTP layer a constant. Record the request/response pairs once, commit the cassette to your repo, and replay it in CI and local runs. Your tests then exercise your code against byte-identical responses every time.
# Capture interactions into a named cassette
apighost record petstore.yaml
# Replay the exact recorded responses
apighost replay my-recording -p 8080
record generates a mock server from the spec, fires sample requests at it (--requests N, default 5), and saves the interactions to a cassette file.replay serves those recorded pairs back verbatim on a local port - no spec parsing, no generation, just the captured behavior.cassette list / cassette info <name> show what was captured so reviews stay inspectable.- name: Run integration tests against recorded cassette
run: |
apighost replay my-recording -p 8080 &
sleep 2
pytest tests/integration/
Because the replay server is local and offline, CI needs no secrets, no staging credentials, and no network access to third parties. When the OpenAPI contract changes, regenerate the mock from the spec, re-record, review the cassette diff alongside your code diff.
| Tier | Price | Includes |
|---|---|---|
| Free | $0 | Unlimited local use, 100 requests/session |
| Pro | $12/mo ($119/yr) | Unlimited requests, VCR cassettes, CI/CD integration |
| Suite | $49/mo ($39 billed annually) | All Coding-Dev-Tools tools under one license |
MIT-licensed source, Python 3.10+.
No - they complement it. Use apighost serve with scenarios when you need edge-case behaviors you have not observed yet; use record/replay when you want a frozen, deterministic copy of known-good behavior.
No. replay takes only the cassette. The spec matters when generating or re-recording.
Clone or pip-install from source and point record at any OpenAPI spec you already have: