Purpose
API Shakedown is aimed at teams that need to consume an API. Such teams typically need three things that are tedious to write by hand and prone to becoming outdated:
- A realistic API mock service for development and testing;
- Contract tests to detect when the real API no longer conforms to its specification;
- Failure drills to verify how the client behaves when the API is slow, unstable, rate-limited, returns garbage data, or is down.
API Shakedown generates all three types of artifacts at once, starting from an existing OpenAPI specification.
Key capabilities
- Spec loading and validation: Loads YAML/JSON from a path or URL, validates it (issues are turned into warnings), safely inlines
$ref, and splits operations into chunks sized for prompts so that large specs also fit small models. - Multi-agent collaborative generation: The test data agent runs first, and the stubs and tests share its records; the stub, contract, and chaos agents work in parallel; reviewers judge each artifact, and blocking issues are sent back to the author with feedback for revision within a limited number of rounds; the coordinator finally assembles the testing toolchain and its README.
- Code fallback guarantees: The LLM never writes code that will be executed; it only proposes data (response bodies, test cases, failure scenarios, test records), which code validates item by item against the spec and feeds issues back to the model, falling back to deterministic output when the model cannot get it right. Even with no model at all (
--offline), each part still works. - Generated content: WireMock stubs, contract tests, robustness probes, chaos scenarios (such as "createPet returns 503 three times in a row and then recovers", "listPets is rate-limited", "getPet is missing a required field").
Usage
Prerequisites: Python 3.11+, Docker (for WireMock), and Ollama with a model (such as ollama pull qwen3:8b), unless using --offline or a cloud model.
Try it on the bundled example:
shakedown run examples/petstore.yaml --out petstore
A Docker image containing all dependencies is also available. Running the tests in the generated testing toolchain requires Docker (WireMock) and Python.
The project also provides shakedown-mcp(stdio), letting MCP clients such as Claude Code and Claude Desktop generate testing toolchains and run failure drills; its name in the official MCP Registry is io.github.anzar-ahsan-commits/api-shakedown. In addition,skills/api-shakedown/SKILL.md teaches coding agents the full workflow: check the environment, generate offline first, run against stubs, perform chaos drills, safely test the real server, and classify the failures found.
The generated testing toolchain reads environment variables such as SHAKEDOWN_TARGET_URL、SHAKEDOWN_SELECT_STATUS、SHAKEDOWN_SEED、SHAKEDOWN_API_KEY、SHAKEDOWN_BASIC_AUTH、SHAKEDOWN_TIMEOUT、SHAKEDOWN_WIREMOCK_PORT / SHAKEDOWN_WIREMOCK_URL . Settings can also come from .env files, all optional.
Use cases
- Quickly set up a runnable mock service and contract tests for an existing OpenAPI specification;
- Perform fault injection drills on clients to verify their robustness under abnormal API behavior;
- Do the above work locally or in privacy-sensitive environments with the help of local models;
- Let AI assistants drive the test toolchain generation and fault drills via MCP.
Limitations
- It is not a load testing tool, nor a security scanner; virtual services do not retain state between calls.
- Specification support is OpenAPI 3.0–3.2; Swagger 2.0 must be converted first; references to other files are not followed; self-referencing schemas are not validated.
- Probing of stubs only covers operations declared with 4xx in the document, and is mainly intended for real servers.
SHAKEDOWN_SEED=1can only create records that the specification allows to be created with test data ids; records that cannot be created are listed as warnings, and tests that read them will fail with 404 until they are created manually.- Local models have limited speed: a complete run of examples for 5 operations with qwen3:8b takes about 7 minutes (most of the time is spent on review),
--no-reviewabout 2.5 minutes; the Typesense API (79 operations) takes hours end-to-end on a laptop GPU,--offlinetakes only seconds. - Small-model reviewers are not perfect; an 8B reviewer sometimes falsely reports blocking issues, wasting a revision round; using a stronger model for review is recommended.
- Currently in alpha (0.1.3); it runs end-to-end with a local 8B model on the bundled example specification.
The project is licensed under the MIT License.