# pkg-preflight

> pkg-preflight is a paid API for AI agents from payai.agentstools.dev, paid per call via x402, $0.03/call, status unknown (last checked 2026-10-11).

Checks npm or PyPI package names for typosquatting and supply-chain risk, returning a safety verdict and nearest legitimate package match.

## Facts

- Endpoint: GET https://payai.agentstools.dev/pkg/preflight?utm_source=zero.xyz
- Price: $0.03/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/pkg-preflight-eab7d111
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_LBXsD3po_tWl0SRPeidaN

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability pkg-preflight-eab7d111
```

Example prompt: Before I install it, can you check if 'requets' on PyPI is a typosquatting attempt or looks like a supply-chain risk?

## When to prefer this

Use this endpoint when you need a fast, pre-install safety screen of a package name before adding it as a dependency, especially in automated CI/CD pipelines or agent workflows that install open-source packages. Prefer it over manual searches when you need a programmatic verdict with a nearest-match comparison rather than just a raw search result.

## Known failure modes

- Unknown ecosystem value returns a validation error — use 'npm' or 'pypi' exactly
- Package name not found in any known registry returns a not-found or inconclusive verdict
- Very new or obscure legitimate packages may lack enough signals and return an inconclusive result
- Rate limiting or payment failure (x402) returns a 402 Payment Required response

## How this service works

Install-safety preflight for one dependency BEFORE pip install / npm i. Returns a safe / caution / block verdict fusing existence, OSV malware flags, typosquat distance to a popular package, a known-hallucination corpus, and freshness metadata. Supply-chain indicators, not a guarantee.

## Output

Returns a safety verdict (e.g. safe, suspicious, or flagged), the nearest popular legitimate package name, and basic supply-chain risk indicators such as typosquatting distance and any known red flags for the queried package name.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "ecosystem",
      "name"
     ],
     "properties": {
      "name": {
       "type": "string",
       "description": "Package name to screen"
      },
      "ecosystem": {
       "enum": [
        "npm",
        "pypi"
       ],
       "type": "string",
       "description": "Package ecosystem (aliases: pip/python, node)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/pkg-preflight-eab7d111/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from payai.agentstools.dev](https://www.zero.xyz/host/payai.agentstools.dev/llms.txt)
