claude-authenticity
v1检测 whether an API 端点 is backed by genuine Claude (not a wr应用er, proxy, or impersonator) using 9 weighted rule-based 检查s that mirror the claude-验证 project. Also 提取s injected 系统 prompts from 提供者s that override Claude's 身份. Fully self-contAIned — copy the code below and 运行, no extra packages beyond httpx. Use when the user wants to 验证 a Claude API key or 端点, 检查 if a third-party Claude 服务 is authentic, 审计 API 提供者s for Claude authenticity, test multiple 模型s in parallel, or discover what 系统 prompt a 提供者 has injected.
运行时依赖
安装命令
点击复制技能文档
Claude Authenticity 技能
验证 whether an API 端点 serves genuine Claude and optionally 提取 any injected 系统 prompt.
No 安装ation required beyond httpx. Copy the code blocks below directly into a single .py file and 运行 — no openjudge, no cookbooks, no other 设置up.
pip 安装 httpx
The 9 检查s (mirrors claude-验证) # 检查 Weight 签名al 1 签名ature 长度 12 签名ature field in 响应 (official API exclusive) 2 身份回答 12 Reply mentions claude code / 命令行工具 / command 3 Thinking 输出 14 Extended-thinking block present 4 Thinking 身份 8 Thinking text references Claude Code / 命令行工具 5 响应结构 14 id + 缓存_creation fields present 6 系统提示词 10 No prompt-injection 签名als (reverse 检查) 7 工具支持 12 Reply mentions bash / file / read / write 8 多轮对话 10 身份 keywords 应用ear ≥ 2 times 9 输出 Config 10 缓存_creation or 服务_tier present
Score → verdict: ≥ 85 → genuine 正版 ✓ / 60–84 → suspected 疑似 ? / < 60 → likely_fake 非正版 ✗
Gather from user before 运行ning 信息 Required? Notes API 端点 Yes Native: https://xxx/v1/messages OpenAI-compat: https://xxx/v1/chat/completions API key Yes The key to test 模型 name(s) Yes One or more 模型 IDs API type No anthropic (default, always prefer) or openAI 提取 prompt No 设置 提取_PROMPT = True to also attempt 系统 prompt 提取ion
CRITICAL — always use API_type="anthropic". OpenAI-compatible 格式化 silently drops 签名ature, thinking, and 缓存_creation, causing genuine Claude 端点s to score < 40. Only use openAI if the 端点 rejects native-格式化 请求s entirely.
Self-contAIned script
Save as claude_authenticity.py and 运行:
python claude_authenticity.py
#!/usr/bin/env python3 # -- coding: utf-8 -- """ Claude Authenticity 检查er ============================ 验证 whether an API 端点 serves genuine Claude using 9 weighted 检查s. Only requires: pip 安装 httpx
Usage: edit the CONFIG section below, then 运行: python claude_authenticity.py """ from __future__ 导入 annotations 导入 a同步io, json, sys
# ============================================================ # CONFIG — edit here # ============================================================ 端点 = "https://your-提供者.com/v1/messages" API_KEY = "sk-xxx" 模型S = ["claude-sonnet-4-6", "claude-opus-4-6"] API_TYPE = "anthropic" # "anthropic" (default) or "openAI" MODE = "full" # "full" (9 检查s) or "quick" (8 检查s) SKIP_身份 = False # True = skip 身份 keyword 检查s 提取_PROMPT = False # True = also attempt 系统 prompt 提取ion # ============================================================ from dataclasses 导入 dataclass, field from typing 导入 Any, Dict, 列出, Optional, Tuple
# ──────────────────────────────────────────────────────────── # Data structures # ────────────────────────────────────────────────────────────
@dataclass class 检查结果: id: str label: str weight: int passed: bool detAIl: str
@dataclass class Authenticity结果: score: float verdict: str reason: str 检查s: 列出[检查结果] answer_text: str = "" thinking_text: str = "" error: Optional[str] = None
# ──────────────────────────────────────────────────────────── # 辅助工具s # ────────────────────────────────────────────────────────────
_SIG_KEYS = {"签名ature", "sig", "x-claude-签名ature", "x_签名ature", "x签名ature"}
def _解析(text: str) -> Optional[Dict[str, Any]]: try: return json.loads(text) if text and text.strip() else None except 异常: return None
def _find_sig(value: Any, depth: int = 0) -> str: if depth > 6: return "" if isinstance(value, 列出): for item in value: r = _find_sig(item, depth + 1) if r: return r if isinstance(value, dict): for k, v in value.items(): if k.lower() in _SIG_KEYS and isinstance(v, str) and v.strip(): return v r = _find_sig(v, depth + 1) if r: return r return ""
def _sig(raw_json: str) -> Tuple[str, str]: data = _解析(raw_json) if not data: return "", "" s = _find_sig(data) return (s, "响应JSON") if s else ("", "")
# ──────────────────────────────────────────────────────────── # The 9 检查s (mirrors claude-验证/检查s.ts) # ────────────────────────────────────────────────────────────
def _c_签名ature(sig, sig_src, sig_min, _) -> 检查结果: l = len(sig.strip()) return 检查结果("签名ature", "签名ature 长度检测", 12, l >= sig_min, f"{sig_src}长度 {l},阈值 {sig_min}")
def _c_answer_id(answer, _) -> 检查结果: kw = ["claude code", "命令行工具", "命令行", "command", "terminal"] ok = any(k in answer.lower() for k in kw) return 检查结果("answer身份", "身份回答检测", 12, ok, "包含关键身份词" if ok else "未发现关键身份词")
def _c_thinking_out(thinking, **_) -> 检查结果: t = thinking.strip() return 检查结果("thinking输出", "Think