Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

api-mock-ai

Latest version: v0.1.0

Overview

Last scanned
1 Dec 2026
Published
1 Dec 2026
PyPI package Publisher: engrkashif96
0 Stars
0 Forks
1 Versions
Python Repo language

Scan summary

api-mock-ai was last scanned on 1 Dec 2026 at version 0.1.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: First and only release on 1 Dec 2026.
  • Findings: No rules fired in version 0.1.0.

Versions

1 version published
Versions and the rules that fired in each
VersionPublishedStatus
0.1.0 LATEST 1 Dec 2026 No rules fired

No rules fired in 0.1.0

Findings

Findings for v0.1.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.1.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

api-mock-ai

Realistic, stateful mock APIs from any OpenAPI spec, powered by Faker or LLMs.

CI PyPI Python License: MIT

Frontend developers often wait for the backend. Mock servers help, but most of them return placeholder data like "name": "string" and forget everything between requests.

api-mock-ai reads your OpenAPI spec and starts a mock server that:

  • returns realistic data: real-looking names, emails, prices, addresses and dates, chosen from field names and formats
  • is stateful: POST creates a record, GET returns it, DELETE removes it
  • keeps relations consistent: GET /users/42/orders only returns user 42's orders, and order.items[].productId points to products that exist
  • can generate data with any LLM (OpenAI, Anthropic, Gemini, or a local model through Ollama), cached so the model is called only once
  • speaks your users' country: --locale pk, in, eu, uk, us... with local phone formats, cities, currency, price levels and banking data (banks, IBAN, BIC, IFSC)
  • serves interactive API documentation at /docs, with live examples and a "Try it" console
  • validates requests against the spec, supports pagination, filtering, sorting and search, and can simulate latency and errors
pip install api-mock-ai
api-mock-ai serve openapi.yaml
GET /api/users/96da1dac-72ff-4d2a-b86e-cbe06b65a6a4

{
  "id": "96da1dac-72ff-4d2a-b86e-cbe06b65a6a4",
  "firstName": "Yaman",
  "lastName": "Ayyubi",
  "email": "yaman.ayyubi18@gmail.com",
  "phone": "+92 308 5918715",
  "role": "customer",
  "address": { "street": "386 Qamar Radial", "city": "Lahore", "postalCode": "92007", "country": "Pakistan" },
  "createdAt": "2026-05-01T16:28:22Z",
  "isVerified": true
}

Contents

  • Installation
  • Quick start
  • Features
  • Countries, regions and banking data
  • Interactive documentation
  • CLI reference
  • AI-generated data
  • Use it from Python and pytest
  • Docker
  • How it works
  • Comparison
  • Limitations and roadmap
  • Development

Full documentation lives in docs/ and can be served with mkdocs serve.

Installation

pip install api-mock-ai            # Faker-based data, no API key needed
pip install "api-mock-ai[ai]"      # adds LLM support through LiteLLM

Or install the latest version straight from GitHub:

pip install "git+https://github.com/kashy96/api-mock-ai.git"
pip install "api-mock-ai[ai] @ git+https://github.com/kashy96/api-mock-ai.git"

To run it without installing it into a project, use pipx or uv:

pipx run api-mock-ai serve openapi.yaml
uvx api-mock-ai serve openapi.yaml

Requires Python 3.10 or newer.

Quick start

Try it with the bundled example, a small e-commerce API:

api-mock-ai serve examples/ecommerce.yaml --locale pk
+------------------------------- api-mock-ai -------------------------------+
| ShopSphere Commerce API 2.3.0  |  mocked by api-mock-ai 0.1.0             |
|                                                                           |
| API     http://localhost:8000/api                                         |
| Docs    http://localhost:8000/docs                                        |
| Admin   http://localhost:8000/__mock__/resources                          |
|                                                                           |
| Data    Faker  |  10 per resource  |  seed 42                            |
| Locale  pk: Pakistan (en_PK, currency PKR)                                |
|                                                                           |
| Resources: /api/users, /api/products, /api/categories,                    |
|            /api/users/{userId}/orders                                     |
+---------------------------------------------------------------------------+

Then:

curl "http://localhost:8000/api/users?page=1&per_page=5"
curl "http://localhost:8000/api/products?sort=-price&limit=3"
curl -X POST http://localhost:8000/api/users \
     -H "Content-Type: application/json" \
     -d '{"firstName": "Ali", "lastName": "Raza", "email": "ali@example.com"}'

Open http://localhost:8000/docs for interactive documentation of your API, where "Try it" sends real requests to the mock.

To check how a spec will be mocked without starting a server:

api-mock-ai validate examples/ecommerce.yaml

Features

Realistic data from field names, formats and context
Field Example value
email (or format: email) ayesha.khan42@gmail.com, matching the name in the same object
firstName, lastName, fullName, username one consistent person per object
name on a user / product / pet / category / company Ayesha Khan / Wireless Headphones / Biscuit / Electronics / Acme Ltd
price, amount, total 315.18
createdAt, updated_at, format: date-time 2026-05-01T16:28:22Z
avatarUrl, imageUrl https://picsum.photos/seed/1680/400/300 (a real image)
phone, city, country, postalCode country-aware (--locale pk, in, eu, de_DE, ...)
iban, bic, bankName, accountNumber real-format bank details for the country
status active / pending, or shipped / delivered on orders

Schema constraints always win: enum, const, minimum/maximum, minLength/maxLength, minItems/maxItems, allOf/oneOf/anyOf and nullable are respected, and every generated record is valid against its schema (this is tested).

Server-side fields

When a request can't contain a field the stored record has (for example POST /transfers takes only an amount and a payee), the mock fills it in like a real server would: ids, timestamps, readOnly fields, a reference number, a status. Order totals are computed from their line items.

Stateful CRUD

Collections are detected automatically from your paths:

Request Behaviour
GET /pets list (with filtering, search, sorting, pagination)
POST /pets validate the body, assign an id, add timestamps, store it, 201
GET /pets/{petId} the stored record, or 404
PUT /pets/{petId} replace (keeps id and createdAt)
PATCH /pets/{petId} merge
DELETE /pets/{petId} remove (and its nested children), 204

Nested collections get several records per parent: every account has its own statement, every user has a few orders.

Changes live in memory until you restart or call POST /__mock__/reset.

Relations
  • Nested resources: /users/{userId}/orders only lists that user's orders, returns 404 for unknown users, and other users' orders are not reachable through it.
  • Foreign keys: fields like categoryId or items[].productId point to existing records.
  • Embedded objects: product.category is a copy of a real category.
  • Custom routes reuse real data: GET /users/me returns one of the generated users.
Lists: pagination, filtering, sorting, search
Query Effect
?status=active exact match on any field
?q=khan (or search, query) case-insensitive search in all text fields
?sort=price, ?sort=-price, ?sort_by=price&order=desc sorting
?limit=10&offset=20, ?page=3&per_page=10 pagination (size, pageSize, skip, take also work)

If your spec wraps lists in an envelope, it is filled in correctly:

{ "data": [ ... ], "meta": { "total": 57, "page": 3, "per_page": 10, "total_pages": 6 } }
{ "items": [ ... ], "total": 57, "limit": 10, "offset": 20, "hasMore": true }
Request validation

Bodies are checked against the spec; mistakes get a clear 422:

{
  "error": "Request body does not match the API spec",
  "status": 422,
  "details": ["species: 'dragon' is not one of ['dog', 'cat', 'rabbit', 'parrot', 'hamster']"]
}

readOnly fields are not required in requests, PATCH bodies may be partial, and --no-validate turns validation off.

Chaos testing

Test loading spinners and error states in your frontend:

api-mock-ai serve openapi.yaml --latency 200-1500 --error-rate 0.1

Or per request, with headers:

curl -H "X-Mock-Delay: 3000" http://localhost:8000/api/users   # wait 3 s
curl -H "X-Mock-Status: 503" http://localhost:8000/api/users   # force an error
Admin endpoints
Endpoint Purpose
GET /docs interactive documentation
GET /openapi.json the original spec, pointed at the mock
GET /__mock__/health health check
GET /__mock__/resources detected resources and record counts
GET /__mock__/data every record currently stored
POST /__mock__/reset throw away changes and restore the generated data

Countries, regions and banking data

api-mock-ai serve examples/banking.yaml --locale pk   # Pakistan: PKR, +92, HBL/Meezan, PK IBANs
api-mock-ai serve examples/banking.yaml --locale in   # India: INR, +91, SBI/HDFC, IFSC, PAN, UPI
api-mock-ai serve examples/banking.yaml --locale eu   # euro area: each record from another country
--locale Data
pk, in, us, uk, de, fr, es, it, nl one country, with its phone format, cities, currency, price level and banks
eu, south_asia a region: each record comes from one of its countries
de_DE, ja_JP, ... any Faker locale

A sample account generated with --locale pk:

{
  "accountTitle": "Wafa Wadood",
  "bankName": "Allied Bank",
  "iban": "PK46ABPA6426212997220033",
  "bic": "ABPAPKAN",
  "accountNumber": "5807302157368193",
  "currency": "PKR",
  "balance": 390420.1
}

The IBAN has valid check digits, and the bank name, BIC and IBAN bank code all describe the same bank. Transactions get a type, a matching narration ("Salary credit", "ATM cash withdrawal"), a reference and a channel. See docs/data-packs.md.

Interactive documentation

Every mock serves API documentation at /docs: endpoints grouped by tag, schemas, live examples from the mock, and a "Try it" console with pre-filled ids that exist, error simulation and cURL export. It works offline, in light and dark mode, and on phones.

api-mock-ai documentation page

See docs/documentation-page.md.

CLI reference

api-mock-ai serve SPEC [options]      start a mock server
api-mock-ai generate SPEC [options]   print or save mock data as JSON
api-mock-ai validate SPEC             check a spec and show how routes are mocked
api-mock-ai --version

SPEC is a path or an http(s) URL to an OpenAPI 3.0 or 3.1 document (YAML or JSON).

Option Default Description
--host 127.0.0.1 interface to bind (use 0.0.0.0 in Docker)
--port, -p 8000 port
--count, -n 10 records per resource
--seed 42 same seed, same data
--locale, -l en_US country (pk, in, us, uk, de...), region (eu) or Faker locale
--ai off generate data with an LLM
--model, -m $API_MOCK_AI_MODEL LiteLLM model for --ai
--latency 0 delay in ms: 300 or 100-500
--error-rate 0 share of requests (0-1) that fail with 500/502/503
--cors / --no-cors on allow requests from other origins
--validate / --no-validate on validate request bodies
--base-path from servers route prefix, e.g. /v1; / for none
--cache-dir .api-mock-ai AI data cache
--refresh off regenerate AI data instead of using the cache
--output, -o stdout (generate) file to write

AI-generated data

Faker is fast and free. An LLM understands meaning: product descriptions that match product names, reviews that match ratings, bios that match job titles.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases api-mock-ai

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Vulnerability Insights

OpenSSH Password Authentication Bypass on Alpine Linux (*sshole) – CVE-2026-123158

PolinRider Returns
Research

PolinRider Returns: Hijacked npm Packages Use Ethereum Blockchain to Conceal Malware Infrastructure

Copy of Template Design OX Blog (1)
Research

Thousands Of GitHub Accounts Hijacked With wfx-loot CI Secret Stealing Malware Via GitHub Actions & npm

Frame 2085668439 (1)
Group 1261154229