Most teams test their happy path against a mock server and discover their error handling in production. APIGhost's scenario system lets you define named sets of failure responses - 500s, empty bodies, wrong shapes - and serve them from your OpenAPI spec with one flag.
Last updated: 2026-08-26 ยท APIGhost on GitHub
What does your frontend do when GET /users returns a 500? What about a valid 200 with an unexpected shape? If those answers live in code review comments rather than tests, it's because spinning up a deliberately-broken API has always been more work than it's worth.
APIGhost reads your OpenAPI 3.0/3.1 spec and stands up a mock server. A scenario is a named set of route overrides layered on top:
# not on public PyPI - install from source or Homebrew
pip install git+https://github.com/Coding-Dev-Tools/apighost.git
# 1. Create a named scenario
apighost scenario create error-test -d "API error scenarios"
# 2. Make GET /users fail with a 500 and a specific body
apighost scenario edit error-test "GET /users" --status 500 --body '{"error":"oops"}'
# 3. Start the mock server WITH the scenario active
apighost serve petstore.yaml --scenario error-test
# 4. Manage what you have
apighost scenario list
apighost scenario delete error-test
Every request to GET /users now returns the overridden response, while every other route keeps serving realistic Faker-generated data from the spec. Flip back by dropping the flag - same command, happy path again.
Because scenarios are just JSON under ~/.apighost/scenarios/, they commit cleanly alongside your tests.
Scenarios cover deliberate failures; VCR-style recording covers deterministic success. Record real interactions once into a cassette and replay them forever - see our guide to deterministic API tests with VCR record/replay, or start with getting started with APIGhost.
pip install git+https://github.com/Coding-Dev-Tools/apighost.git
# or via Homebrew
brew tap Coding-Dev-Tools/homebrew-tap
brew install apighost
APIGhost is not on public PyPI; the source install above is the documented pip path.
Free: $0 - unlimited local use, 100 requests per 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.