# Crates.io Package Statistics

> Crates.io Package Statistics is a paid API for AI agents from x402.agentutility.ai, paid per call via x402, $0.003/call, status unknown (last checked 2026-11-05).

Fetches download counts, version history, and release metadata for any Rust crate from crates.io

## Facts

- Endpoint: POST https://x402.agentutility.ai/crates-io-stats?utm_source=zero.xyz
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-05
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/crates-io-package-statistics-2e11dd1f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_cGOFchZBX5FNWa8KWnu0a

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 crates-io-package-statistics-2e11dd1f -d '<json body>'
```

Example prompt: What are the download stats for the serde crate — total all-time downloads, recent 90-day downloads, latest version, and how many days since the last release? Show me the last 5 versions.

## When to prefer this

Use this endpoint when you need programmatic access to Rust crate statistics without scraping crates.io directly. Ideal for dependency audits, open-source health checks, library comparison, or any workflow that needs download volume, version freshness, or release cadence data for Rust packages. Prefer this over manual crates.io browsing when automating decisions about Rust dependencies.

## Known failure modes

- Crate name not found on crates.io — returns an error or empty result
- Invalid crate name format (non-ASCII, too long, illegal characters) — input validation failure
- recent_versions out of range (0 or >20) — schema validation error
- crates.io upstream API unavailable — service timeout or error response

## How this service works

817 pay-per-call APIs for AI agents. Every endpoint is POST /<name> and is payable in USDC over x402 on Base and Solana — no signup, no API key, just pay-per-call. GET https://x402.agentutility.ai/ returns the same catalog as machine-readable JSON.

## Output

Returns a JSON object with the crate name, its age in days, all-time download count, downloads in the last 90 days, latest version string, total number of published versions, and days elapsed since the most recent release.

## 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",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "required": [
      "package"
     ],
     "properties": {
      "package": {
       "type": "string",
       "description": "Crate name. 1-64 ASCII alphanumeric with '-' or '_'."
      },
      "recent_versions": {
       "type": "number",
       "description": "How many most-recent versions to include. 1-20. Default 5."
      }
     }
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "package": {
       "type": "string"
      },
      "age_days": {
       "type": "integer"
      },
      "downloads": {
       "type": "object",
       "properties": {
        "all_time": {
         "type": "integer"
        },
        "recent_90d": {
         "type": "integer"
        }
       }
      },
      "latest_version": {
       "type": "string"
      },
      "total_versions": {
       "type": "integer"
      },
      "days_since_last_release": {
       "type": "integer"
      }
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "package": "serde",
  "age_days": 3800,
  "downloads": {
   "all_time": 425000000,
   "recent_90d": 26000000
  },
  "latest_version": "1.0.219",
  "total_versions": 286,
  "days_since_last_release": 12
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/crates-io-package-statistics-2e11dd1f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.agentutility.ai](https://www.zero.xyz/host/x402.agentutility.ai/llms.txt)
