Skip to content

ShimonZhan/new-api-checker

Repository files navigation

New API Checker

A lightweight web tool to check API Key quota and usage for New API instances. Paste your API key and forward URL to quickly query balance, usage, and model limits.

Privacy: This is a pure frontend project. All API requests are sent directly from your browser to the target New API instance. No data is stored on any server, no backend, no tracking, no analytics. Query history is stored only in your browser's localStorage.

Demo: https://apikey.cigo.cc


What is New API?

New API is an open-source API management and distribution platform. This tool provides a simple frontend to check the token usage and quota of any New API deployment via its /api/usage/token/ endpoint.


Features

  • Paste detection: auto-recognizes API Keys and URLs from JSON, env vars, or plain text
  • Usage dashboard: total quota, used, remaining with visual progress bar
  • Unlimited quota support: properly handles unlimited_quota responses
  • Query history: locally stored, supports re-query
  • Dark mode & i18n: Chinese / English, light / dark / auto theme
  • Mobile friendly: responsive layout for all screen sizes
  • Cloudflare Workers deployment: fast global access

Tech Stack

  • Vue 3 + Vite
  • Tailwind CSS v4
  • Cloudflare Workers (static assets)

Local Development

# Install dependencies
npm install

# Start dev server
npm run dev

# Build for production
npm run build

# Preview production build
npm run preview

Deploy to Cloudflare Workers

Prerequisites

  1. A Cloudflare account
  2. A domain added to Cloudflare (e.g., cigo.cc)
  3. Node.js 18+

Steps

1. Install wrangler CLI

npm install -g wrangler

2. Login to Cloudflare

wrangler login

This opens a browser for OAuth authentication.

3. Configure wrangler.toml

Edit the wrangler.toml file in the project root:

name = "api-token-checker"
compatibility_date = "2025-01-01"

[assets]
directory = "./dist"

[[routes]]
pattern = "apikey.your-domain.com"
custom_domain = true

Replace apikey.your-domain.com with your actual subdomain.

4. Build & Deploy

npm run build
wrangler deploy

Cloudflare will automatically create DNS records for the custom domain. Your site will be live at https://apikey.your-domain.com.

Updating

After making changes, simply run:

npm run build && wrangler deploy

CLI Script Version

A standalone Bash script (new_api_token_usage_checker.sh) is also included for terminal usage. No Node.js required — only curl and optionally jq.

Usage

# Make executable
chmod +x new_api_token_usage_checker.sh

# Interactive mode
./new_api_token_usage_checker.sh

# Quick check with arguments
./new_api_token_usage_checker.sh https://api.example.com sk-your-token

# Custom exchange rate
./new_api_token_usage_checker.sh https://api.example.com sk-your-token 500000

# Using environment variables
export NEW_API_URL=https://api.example.com
export NEW_API_TOKEN=sk-your-token
./new_api_token_usage_checker.sh

Features: colored table output, usage percentage, expiration info, model limits, unlimited quota detection.


New API Checker (中文)

一个轻量级的 New API 额度查询工具。粘贴 API Key 和转发地址,快速查询余额、用量和模型限制。

隐私安全:本项目为纯前端应用,不存储任何数据。所有 API 请求由浏览器直接发送到目标 New API 实例,无后端服务、无数据收集、无追踪。查询历史仅保存在浏览器本地 localStorage 中。

在线演示: https://apikey.cigo.cc


什么是 New API?

New API 是一个开源的 API 管理与分发平台。本工具提供了一个简洁的前端界面,通过 New API 的 /api/usage/token/ 接口查询令牌的用量和额度信息。


功能特性

  • 智能粘贴识别:自动从 JSON、环境变量、纯文本中提取 API Key 和 URL
  • 用量仪表盘:总额度、已使用、剩余,带可视化进度条
  • 无限额度支持:正确处理 unlimited_quota 响应
  • 查询历史:本地存储,支持一键重新查询
  • 暗色模式 & 国际化:中文/英文,浅色/深色/跟随系统
  • 移动端适配:响应式布局,小屏幕大金额也能正常显示
  • Cloudflare Workers 部署:全球加速访问

技术栈

  • Vue 3 + Vite
  • Tailwind CSS v4
  • Cloudflare Workers(静态资源托管)

本地开发

# 安装依赖
npm install

# 启动开发服务器
npm run dev

# 构建生产版本
npm run build

# 预览生产构建
npm run preview

部署到 Cloudflare Workers

前置条件

  1. 一个 Cloudflare 账号
  2. 一个已添加到 Cloudflare 的域名(如 cigo.cc
  3. Node.js 18+

步骤

1. 安装 wrangler CLI

npm install -g wrangler

2. 登录 Cloudflare

wrangler login

会打开浏览器进行 OAuth 授权。

3. 配置 wrangler.toml

编辑项目根目录的 wrangler.toml 文件:

name = "api-token-checker"
compatibility_date = "2025-01-01"

[assets]
directory = "./dist"

[[routes]]
pattern = "apikey.your-domain.com"
custom_domain = true

apikey.your-domain.com 替换为你的实际子域名。

4. 构建并部署

npm run build
wrangler deploy

Cloudflare 会自动为自定义域名创建 DNS 记录。部署完成后即可通过 https://apikey.your-domain.com 访问。

更新部署

修改代码后,只需运行:

npm run build && wrangler deploy

命令行脚本版本

项目还包含一个独立的 Bash 脚本 (new_api_token_usage_checker.sh),可在终端中使用。无需 Node.js,只需 curl(可选 jq)。

使用方法

# 添加执行权限
chmod +x new_api_token_usage_checker.sh

# 交互式模式
./new_api_token_usage_checker.sh

# 命令行参数模式
./new_api_token_usage_checker.sh https://api.example.com sk-your-token

# 自定义汇率
./new_api_token_usage_checker.sh https://api.example.com sk-your-token 500000

# 环境变量模式
export NEW_API_URL=https://api.example.com
export NEW_API_TOKEN=sk-your-token
./new_api_token_usage_checker.sh

功能:彩色表格输出、使用百分比、到期时间、模型限制、无限额度检测。

License

MIT

About

New API 额度查询工具 — 一键查询 API Key 余额、用量和模型限制 | Lightweight quota checker for New API instances

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors