--- name: aiapipk-check description: >- Audit third-party LLM API proxies, relays, and gateways across three strict security tiers: (1) Default local zero-upload CLI via `npx -y llm-api-purity-check` to detect hidden/conditional prompt injection, model substitution (38-model 1-355 numerical fingerprinting), silent downgrade, fake Prompt Caching, Anthropic Thinking signature forgery, multimodal image stripping, fake streaming, and token billing inflation; (2) Explicit opt-in AIAPIPK online full suite (Pelican/Zebra 2D SVG visual comparison, exact official tokenizer recount, dual anti-backtest reasoning, public report lookup); (3) Zero-key provider lookup & pricing/reliability benchmark across 412+ relays. Use when users ask to verify an API relay, check for prompt injection/downgrade/model swap/fake caching, inspect an AIAPIPK report link, compare relay prices, or check provider reliability (中转站验真、检测暗中注入/条件注入/降智/模型换壳掉包/假缓存/伪造Thinking签名、查中转站靠不靠谱/历史口碑/比价与调价异动). license: MIT --- # AIAPIPK LLM API Purity Check (`aiapipk-check`) Verify third-party LLM API relays, proxies, and gateways for **prompt injection, model substitution, silent downgrade, broken Prompt Caching, forged thinking signatures, stripped multimodal vision, and billing inflation**, or look up live reliability and pricing across **412+ providers** — built for **Claude Code**, **Cursor**, **Codex**, **Antigravity**, and any Agent Skills-compatible client. --- ## Security & Privacy Boundaries Follow these non-negotiable boundaries at all times: 1. **Mode 1 — Default · Local Zero-Upload CLI (`npx -y llm-api-purity-check`)**: - All probe traffic travels **directly from the user's local machine** to the user-specified `--base-url`. - API keys are **never uploaded** to `aiapipk.com` or any third-party server. - Always pass keys via child-process environment variables (`LLM_API_KEY`) rather than CLI flags when possible; **never echo plaintext API keys** in shell output, markdown cards, or chat replies (mask as `sk-****...`). - Always recommend a **low-limit, immediately revocable temporary test key**. 2. **Mode 2 — Explicit Opt-In · AIAPIPK Online Full Suite (`/api/detect/suite`)**: - **HARD PROHIBITION**: **NEVER** automatically read, extract, or transmit ANY local environment variable or local config file credential (`ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `OPENAI_API_KEY`, `LLM_API_KEY`, `~/.claude/settings.json`, `~/.codex/config.toml`, `.env`, etc.) to `aiapipk.com` or any remote service. - **NEVER** pass a temporary key in `curl -d '{"apiKey":"..."}'` CLI arguments (exposes secrets in `ps` and shell history); always construct JSON inside `node` via a temporary subprocess env var or stdin. - **Browser-First Default**: Direct users to `https://www.aiapipk.com/detect/` first so they can submit a temporary key directly in their browser. - **Three Mandatory Hard Gates for Direct Agent API Calls**: Only invoke `POST https://www.aiapipk.com/api/detect/suite` when **ALL THREE** conditions hold in the current conversation: 1. **Explicit Online Instruction**: The user explicitly asks the Agent to run the online full suite via API; 2. **User-Pasted Temporary Key**: The user manually pastes a dedicated low-limit, revocable temporary test key for this probe; 3. **Explicit Single-Probe Consent**: The user explicitly confirms sending that temporary test key to `https://www.aiapipk.com/api/detect/suite` for a single in-memory probe (server clears memory immediately on completion, never persists keys to DB/logs, and redacts secrets from public reports). - **Zero-Key Report Reading Exception**: Reading any `https://www.aiapipk.com/detect/report/` link via `GET https://www.aiapipk.com/api/detect/records/public/:jobId` uses **zero API keys** and is always safe. 3. **Mode 3 — Zero-Key Online Benchmark & Provider Lookup**: - Uses **zero API keys**, reads **zero local files or environment variables**, and makes **read-only HTTPS `GET` requests** to public endpoints only. --- ## Mode Selection Guide | User Intent | Mode | Key Handling | | :--- | :--- | :--- | | "Test my relay for injection, fake cache, swap, downgrade, or signature forgery" | **Mode 1 (Default)** | Local-only via `npx -y llm-api-purity-check`; zero upload | | "Run the online full suite (Pelican/Zebra SVG comparison + exact tokenizer recount)" | **Mode 2 (Opt-In)** | Link to `/detect/` first; API call ONLY after all 3 hard gates | | "Explain this report: `https://www.aiapipk.com/detect/report/`" | **Mode 2 (Read-Only)** | Zero key (`GET /api/detect/records/public/:jobId`) | | "Is `example.com` reliable? Recommend cheap transparent relays. Who changed prices?" | **Mode 3 (Zero-Key)** | Zero key (`benchmark-summary.json` + `/api/arena/site/:domain` + `/timeline`) | --- ## Mode 1 (Default): Offline / Local Zero-Upload CLI Requires **Node.js >= 18** (`llm-api-purity-check` has **zero npm dependencies**). Prefer `--json` for structured parsing or `--markdown` (`v1.4.0+`) for a secret-redacted forum card. ### Step 1 — Gather Target Parameters Safely Obtain `--base-url` and `--model` (append `--protocol openai-responses` for `/v1/responses` or Codex relays; otherwise protocol is auto-inferred and common affixes like `us.anthropic.`, `-v1:0`, `:thinking`, `[官转]` are normalized automatically). Ask for a **temporary test key** — or, ONLY when the user explicitly asks to audit their own local client setup strictly locally in Mode 1, forward the existing local env var directly inside the local subprocess without printing it. ### Step 2 — Run Tiered Local Probes (Lowest Cost First) ```bash # Set LLM_API_KEY in the child process environment (temporary revocable test key; never hardcode in files) # 1. 10-second quick check (~sub-cent): A/B/C single-char prompt-injection + streaming/16-channel check npx -y llm-api-purity-check \ --base-url "$TARGET_BASE_URL" --model "$TARGET_MODEL" \ --checks inject,stream --json # 2. Full 5-check local audit: inject + stream/billing + 2-round Prompt Caching + logic + 38-model fingerprint npx -y llm-api-purity-check \ --base-url "$TARGET_BASE_URL" --model "$TARGET_MODEL" \ --checks inject,stream,cache,logic,fingerprint --rounds 3 --json # 3. Advanced opt-in checks: Anthropic Thinking signature roundtrip + 4-color 64x64 PNG multimodal vision npx -y llm-api-purity-check \ --base-url "$TARGET_BASE_URL" --model "$TARGET_MODEL" \ --verify-signature --multimodal --json # 4. Secret-redacted Markdown report card (CLI v1.4.0+, mutually exclusive with --json) npx -y llm-api-purity-check \ --base-url "$TARGET_BASE_URL" --model "$TARGET_MODEL" \ --checks inject,stream,cache --markdown # List all 38 bundled reference models (zero network calls) npx -y llm-api-purity-check --list-models ``` **Version & npm Registry Compatibility**: - `--markdown` requires **CLI `v1.4.0+`**. If `npx -y llm-api-purity-check ... --markdown` fails with `Unknown option: --markdown` (e.g., npm still serves `1.3.0` or local cache is stale), either re-run with `--json` and format the equivalent secret-redacted Markdown card directly, or use `npx -y github:yiios/llm-api-purity-check ... --markdown`. - If a corporate/CN npm mirror stalls or fails (`E401` / `ETIMEDOUT` / `E404`), retry with `npx --registry=https://registry.npmjs.org/ -y llm-api-purity-check ...` or `npx -y github:yiios/llm-api-purity-check ...`. ### Step 3 — Interpret Results Without False Positives - **Separate preflight errors (`status === "error"`) from cheating**: `auth_error` (401/403), `model_not_found` (404/no channel), `quota_exhausted` (402), `rate_limited` (429/529), `waf_blocked`, `bad_request`, `server_error`, and `request_error` (network/DNS) are connectivity/config issues — **never** label them as fraud. - **Respect thinking-model billing exemption**: If `results.stream.thinkingExempt === true`, state that honest reasoning tokens were exempted; only flag inflation when `billingInflationSuspect === true`. - **Respect neutral metadata**: `upstreamChannel.channel === "unknown"`, `results.signature.verdict === "skipped"`, and `results.fingerprint.claimedMatchStatus === "not_in_bank"` / `"low_confidence"` carry **zero red-card penalty**. - See `references/cli-and-interpretation.md` for full JSON fields & Markdown fallback card layout. --- ## Mode 2 (Explicit Opt-In): AIAPIPK Online Full Suite ### Four Exclusive Online Capabilities (Beyond Local CLI) 1. **Pelican / Zebra 2D SVG Visual Downgrade Comparison**: Official side-by-side drawing comparison. 2. **Exact Official Tokenizer Output Recount**: Server-side BPE/Tiktoken recount. 3. **Dual Anti-Backtest Reasoning Guard**: Classic Candy + randomized Dynamic puzzle (`suspectedBacktestCheat`). 4. **Permanent De-Identified Public Report Page**: Shareable snapshot at `https://www.aiapipk.com/detect/report/` (**zero API key stored**). ### Default Flow: Browser-First + Short Friendly Confirmation Offer `https://www.aiapipk.com/detect/` first. If the user wants the Agent to submit via API instead, keep the gate check **brief and friendly** (never a scary legal wall): > **EN template**: *"You can run the online visual & tokenizer suite directly in your browser at `https://www.aiapipk.com/detect/`. If you'd like me to submit and track it for you here, I won't read any local env/config keys — just paste a **low-limit, revocable temporary test key** and confirm sending it once to `https://www.aiapipk.com/api/detect/suite` (held in memory only and cleared immediately after)."* > **ZH template**: see `references/zh-guide.md`. ### Opt-In API Flow (ONLY After Passing All 3 Hard Gates) 1. **Start Suite (`POST https://www.aiapipk.com/api/detect/suite`)** + **Poll (`GET https://www.aiapipk.com/api/detect/jobs/:jobId` with `X-Detect-Token`)**: - **Never** use `curl -d '{"apiKey":...}'`. Use the safe, zero-dependency `node` submit+poll script in `references/online-api.md` (reads temporary key from `TEMP_DETECT_KEY` env var / stdin, holds `accessToken` in memory only, never prints either secret). - **Polling & Progress UX**: Online suites typically take **30–90 seconds** (occasionally up to 180s if drawing is slow). Poll every **5 seconds** up to **180 seconds**, share brief progress updates, and note that objective verdicts are ready as soon as `suite.objectiveReady === true` while the Pelican 2D SVG completes. - **Graceful `429` Fallback**: Limits are **20 starts/hour per IP** (`429`), **1 active suite per client/IP**, **12 global concurrent jobs**. If `429` triggers, politely explain the hourly limit and offer to run **Mode 1 local CLI** immediately instead. - Once finished, share the clean public report URL: `https://www.aiapipk.com/detect/report/`. ### Zero-Key Public Report Reader (Always Allowed) For any pasted `https://www.aiapipk.com/detect/report/` (`suite_*`, `fp_*`, or `iq_*`), fetch `GET https://www.aiapipk.com/api/detect/records/public/` via zero-dependency `node -e` (no `jq` required; strips raw `svgPreview` before printing): ```bash JOB_ID="" node -e ' (async () => { const r = await fetch(`https://www.aiapipk.com/api/detect/records/public/${encodeURIComponent(process.env.JOB_ID.trim())}`); if (!r.ok) { console.error("HTTP", r.status, await r.text()); process.exit(1); } const d = await r.json(); if (d.record) delete d.record.svgPreview; console.log(JSON.stringify(d, null, 2)); })().catch(e => { console.error(e.message); process.exit(1); }); ' ``` Branch cleanly on `data.kind` (field names differ by kind — full schemas in `references/online-api.md`): - `suite`: `record.verdict`, `verdictLabel`, `verdictSummary`, `injectionTier`, `matchStatus`/`attributionModel`, `candyOutcome`/`dynamicOutcome`/`suspectedBacktestCheat`, `drawingOutcome`, `redFlags`, `warnings`, `speedPercentiles`. - `fingerprint`: `record.score`, `verdict`, `verdictLabel`, `matchStatus`/`attributionModel`, `avgTtftMs`, `avgTps`, `maxOutputRatio`, `redFlags`, `warnings`, `speedPercentiles`. - `iq`: `record.kind` (`reasoning` | `drawing`), `questionId`, `okCount`/`plannedRuns`, `wrongCount`, `errorCount`, `runDots`, `verdict`, `officialCompareLabel`, `officialRatioPct`, `svgBytes`, `elementCount` (note: `iq` has no `verdictLabel`, `redFlags`, or `speedPercentiles`). --- ## Mode 3 (Zero-Key): Online Benchmark & Provider Lookup Always use **zero-dependency `node -e` (native `fetch`, Node >= 18)** — **never rely on `jq`** (often not installed) and avoid raw `curl` dumps (responses are 70–90 KB). 1. **Global Benchmark, Top 50 Multipliers & Latest 30 Pricing Changes** (`GET https://www.aiapipk.com/data/benchmark-summary.json`): ```bash node -e ' (async () => { const b = await fetch("https://www.aiapipk.com/data/benchmark-summary.json").then(r => r.json()); console.log(JSON.stringify({ updatedAt: b.updatedAt, stats: b.stats, top15: (b.topSites || []).slice(0, 15).map(s => ({ rank: s.rank, domain: s.domain, name: s.name, status: s.status, rmbPerUsd: s.rmbPerUsd, keyVerified: s.keyVerified, multiplier: s.frontier?.officialMultiplierText, primaryModel: s.frontier?.primaryModel, avail24h: s.probe?.availability24h ?? null, verdict: s.probe?.bestVerdictLabel ?? null })), priceMoves: (b.recentChanges || []).filter(c => c.deltaPct != null).slice(0, 12) }, null, 2)); })().catch(e => { console.error(e.message); process.exit(1); }); ' ``` 2. **Single Provider Lookup Across ALL 415+ Relays (Avoids False "Unlisted" for #51–415!)**: - `benchmark-summary.json` only lists Top 50, and `/api/detect/site//timeline` returns `totalValidRecords: 0` for both indexed providers with no tests yet AND unlisted domains. - Always query **both** `GET https://www.aiapipk.com/api/arena/site/` (full profile, health, pricing groups, `frontierSummary.primaryPrice`, cache-assassin warnings, live probes) **and** `GET https://www.aiapipk.com/api/detect/site//timeline?limit=20` (see combined zero-`jq` snippet in `references/online-api.md`). - Treat a domain as **indexed** whenever `arena.candidate` exists, `arena.groups.length > 0`, `timeline.totalValidRecords > 0`, or it appears in `topSites`. Link `https://www.aiapipk.com/site//`; if genuinely unlisted, link `https://www.aiapipk.com/directory/` and offer Mode 1 local CLI / `https://www.aiapipk.com/detect/`. 3. **Clean Canonical Links**: Never append `?q=`, `?from=`, or `utm_*` parameters to AIAPIPK URLs. --- ## Response Format & UX Standards Never dump raw JSON or raw SVG to the user. Structure every final reply so the verdict is scannable in 3 seconds: 1. **One-line Verdict Header**: `🟢 Pass` / `🟡 Needs Review` / `🔴 High Risk` / `⛔ Preflight Error` (in the user's language). 2. **Compact Evidence Table**: `Dimension | Status | Measured Metric | Plain-Language Meaning` (translate metrics into real impact, e.g., *"0% cache hit → Coding Agent bills can jump 5x–10x"*). 3. **Clear Next Step (1–2 bullets)**: Remind user to revoke their temporary test key if one was used, plus the most relevant clean link (`/site//`, `/detect/`, or `/directory/`). --- ## References & Links - Online Model & Cache Verifier: https://www.aiapipk.com/detect/ - AIAPIPK Live Probe Arena & Provider Radar: https://www.aiapipk.com/ - 2026 LLM API Relay Community Audit Report: https://www.aiapipk.com/guide/2026-llm-api-relay-community-audit-report/ - Open-Source CLI & Skill Repository: https://github.com/yiios/llm-api-purity-check Bundled reference docs in this skill directory: - `references/online-api.md` — Verified schemas, safe zero-`jq` `node -e` scripts, polling/429 handling, and Modes 2 & 3 contracts. - `references/cli-and-interpretation.md` — Mode 1 CLI flags, version/registry fallbacks, JSON field guide, and Markdown fallback card template. - `references/zh-guide.md` — 中文速查、友好确认话术与中文报告展示模板。