Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

check-claude-api

一键检测你的 Claude API 是不是真官方接口、支不支持 Prompt Cache、有没有被悄悄换成便宜模型。 Verify whether your Claude API endpoint is the genuine Anthropic API, supports prompt caching, and isn't silently swapped to a cheaper model.

灵眸AI 团队开源维护 · 一个透明转发官方 Anthropic API 的国内 Claude API 网关

用第三方 Claude API 中转/网关时,一个容易被忽略的问题:你付的是 Claude Opus 的钱,跑的真的是 Opus 吗?接口是官方的还是逆向的?Cache 是真支持还是假支持?

这个工具帮你一条命令验证,不依赖平台的自我描述。

用法

无需安装,克隆下来直接跑(需要 Node.js ≥18):

git clone https://github.com/LMU-AI/check-claude-api.git
cd check-claude-api
node index.js --url <BASE_URL> --key <API_KEY>

例如:

# 测官方
node index.js -u https://api.anthropic.com -k sk-ant-xxx

# 测任意中转/网关
node index.js -u https://your-gateway.com -k your-key

也支持环境变量 ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN(和 Claude Code 一致)。

它检测什么

检测项 原理 意义
官方接口 vs 逆向接口 发带 cache_control 的请求,看 usage 是否返回 cache_creation_input_tokens / cache_read_input_tokens 字段 官方 API 一定返回这些字段;缺失通常说明底层是逆向反代(反代 Cursor/Kiro 等的内部通道),不是真实 Anthropic API
Prompt Cache 真支持 连发两次,看第二次是否命中缓存(cache_read_input_tokens > 0 Cache 能把长会话成本降 50–70%,逆向接口做不到

为什么这事重要

逆向接口的低价背后有隐性代价:不支持 Prompt Cache(实际总成本可能更贵)、模型可能被替换(标 Opus 实际跑 Haiku)、Anthropic 一更新就可能失效。而这些返回格式完全一样,不专门验证发现不了

关于模型真实性的完整判断方法(含难题测能力、文风对比等),见文末相关阅读

输出示例

检测目标: https://api.anthropic.com  (model: claude-opus-4-8)

[1/2] 检测接口真实性 + Prompt Cache 支持...
✓ 官方接口:usage 返回了 cache 字段,是透明转发的官方 Anthropic API
✓ Prompt Cache 真实支持:第二次请求命中缓存 (cache_read_input_tokens=2400)

[2/2] 结论
✓ 通过:官方接口 + Cache 真实支持。

相关阅读

姐妹工具

说明

  • 本工具通用,可检测任何 Claude API 兼容服务(官方、各家中转/网关)
  • 每次检测会消耗极少量 token(几十个)
  • 不收集、不上传任何数据,纯本地运行
  • MIT License

Roadmap

  • --benchmark 难题测能力(数学题对比正确率,识别模型降级)
  • 批量检测多个 endpoint 并生成对比报告
  • 输出 JSON 供 CI 集成

关于

本工具由 灵眸AI(api.lmuai.ai) 团队开源维护。

我们做的是一个透明转发官方 Anthropic API 的国内 Claude API 网关——正因为每天和"接口真实性、Prompt Cache、模型一致性"打交道,才做了这个工具,希望帮开发者不被"假 Claude / 假 Cache"坑到。工具完全通用,欢迎用它检测任何服务(包括我们自己)。如果你想要一个用本工具测下来「官方接口 ✓ + Cache 支持 ✓」的现成服务,可以了解一下灵眸AI。

发现问题或有功能建议,欢迎提 Issue / PR。

About

一键检测你的 Claude API 是不是真官方接口、支不支持 Prompt Cache。Verify if your Claude API is the genuine Anthropic endpoint with working prompt caching.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages