Integration tests need a stable API to hit. Hard-coding responses breaks the moment a field changes, and hand-written mocks drift as soon as the spec updates.
APIGhost reads an OpenAPI 3.x spec and starts a mock server with realistic fake data. Here is the shortest path from "I have a spec" to "my tests pass."
pip install git+https://github.com/Coding-Dev-Tools/apighost.git
APIGhost is not on public PyPI. If you use Homebrew, the tap is also available: brew tap Coding-Dev-Tools/homebrew-tap && brew install apighost.
Point APIGhost at a spec file and it generates endpoints with fake data. Property-name hints do the heavy lifting: email fields get emails, id fields get IDs.
apighost serve petstore.yaml
That starts a server on port 8080. Hit it like you would hit the real API.
For CI, deterministic responses matter more than faker randomness.
apighost record petstore.yaml --output fixtures/cassette.json
apighost replay fixtures/cassette.json -p 8080
The record step captures real responses. The replay step serves the same JSON every time. Your tests no longer depend on faker seeds or a live upstream.
APIGhost ships with named scenario presets. Add an error scenario once and flip to it with a flag:
apighost serve spec.yaml --scenario error
You can also create custom scenarios: apighost scenario create error-test -d "API error scenarios", then edit specific routes and status codes.
Regenerate the fixtures from the spec and the endpoints, fields, and response shapes update together. No copy-pasted JSON to maintain.
Free tier covers local and dev use. Pro is $12/mo (or $119/yr) for unlimited requests, VCR cassettes, and CI integration. Suite is $49/mo for all Coding-Dev-Tools tools under one license.
If you want the full CI walkthrough — GitHub Actions, pytest examples, scenario switching in automation — the companion tutorial covers the six-step path from spec to CI.