# OpenNext R2 Cache Cleanup

> OpenNext R2 Cache Cleanup is a paid API for AI agents from api.aiskills402.com, paid per call via x402, $0.05/call, status unknown (last checked 2026-10-21).

Analyzes an OpenNext incremental cache setup on Cloudflare R2 or Workers KV and identifies which old build folders are safe to delete without affecting the live build.

## Facts

- Endpoint: GET https://api.aiskills402.com/v1/skills/opennext-r2-cache-cleanup/file?utm_source=zero.xyz
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/opennext-r2-cache-cleanup-b6a25218
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_X5cKdt3EMDFyb3mymhR-J

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 opennext-r2-cache-cleanup-b6a25218
```

Example prompt: I have an OpenNext incremental cache on Cloudflare R2 and want to know which old build folders are safe to delete — here's my wrangler config, open-next config, next.config, the public build ID, and a listing of my cache folders. Which ones can I remove without touching the live build?

## When to prefer this

Use this endpoint when managing OpenNext incremental caches on Cloudflare R2 or Workers KV after Next.js redeployments, especially when unsure which folders belong to the live build versus old deploys. Ideal for DevOps automation agents handling post-deploy cache hygiene without risking deletion of active build assets.

## Known failure modes

- Missing or incomplete wrangler config causes incorrect cache root identification
- Mismatched build ID in public HTML vs folder listing leads to uncertain live build detection
- Unsupported cache folder naming convention (custom prefix vs deploymentId vs constant) may reduce accuracy
- Payment not settled results in 402 response before skill file is returned
- Malformed or incomplete folder listing may cause incomplete cleanup recommendations

## How this service works

OpenNext R2 Cache Cleanup for Next.js on Cloudflare — Decides which old build folders of an OpenNext incremental cache on Cloudflare (R2, or Workers KV) can be deleted, from a pasted setup (wrangler config, open-next config, next.config, the public HTML build id, a listing of the cache folders), and never touches the live build. It reads the cache root and the real folder name (a custom prefix, a deploymentId, a constant deploymentId, a no-build-id folder), finds the live build from the public …

## Output

Returns a SKILL.md file containing detailed guidance identifying which old build folders in the OpenNext incremental cache (R2 or Workers KV) can be safely deleted, which folder represents the live build, and instructions for safely performing the cleanup without disrupting the active deployment.

## 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"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "file": {
   "name": "SKILL.md",
   "content": "<the SKILL.md file>",
   "encoding": "utf-8"
  },
  "name": "OpenNext R2 Cache Cleanup for Next.js on Cloudflare",
  "skill": "opennext-r2-cache-cleanup",
  "sha256": "<sha256 of SKILL.md>",
  "receipt": {
   "tx": "0x<settlement transaction>",
   "settled": true
  },
  "version": "1.0.0",
  "redownload": {
   "url": "<api>/v1/purchases/<token>",
   "token": "<64 hex chars>"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/opennext-r2-cache-cleanup-b6a25218/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.aiskills402.com](https://www.zero.xyz/host/api.aiskills402.com/llms.txt)
