Skip to content
Projects

About

API Key 测活工具 - 用于批量检测 OpenAI、Claude、Gemini 等 API 密钥有效性 | Modern API Key Tester - Used for batch testing the validity of API keys such as OpenAI, Claude, Gemini

Web & App Development

How these counts are measured

Measured star growth

in 24h
0
in 7 days
+1
in 15 days
+1
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.en.md

Original

🔑 API Key Tester

A modern online tool for batch testing API key validity across multiple LLM providers

中文 | English

Contributors GitHub stars GitHub forks

License Node Version Top Language

Live Demo Deploy with Vercel

📸 Preview

Preview

✨ Features

  • 🚀 Batch test multiple API keys
  • 🎯 Support for OpenAI, Claude, Gemini, DeepSeek, SiliconCloud, xAI, OpenRouter
  • 🔄 Smart retry mechanism for improved detection accuracy
  • 🌐 Bilingual interface (Chinese/English)
  • 🌙 Light/Dark/System theme toggle
  • 📊 Real-time statistics and error details
  • 📋 Copy keys by status group (all/valid/invalid/rate-limited/paid)
  • 🎛️ Custom model names and auto-detected models
  • ⚡ Adjustable concurrency and retry count
  • 💰 Gemini paid key detection
  • 📝 Optional verbose API call logging
  • 🔧 Customizable API provider configuration
  • 💻 Frontend-only, no installation required

🚀 Usage

  1. Visit: https://weiruchenai1.github.io/api-key-tester
  2. Select API provider (left sidebar)
  3. Enter API address (optional, uses official endpoint by default)
  4. Paste or import (.txt) API key list
  5. Select or enter custom model name
  6. Adjust concurrency and retry count as needed
  7. Click start testing

⚠️ Important Notice

Due to browser CORS restrictions, direct API calls may be blocked:

Public Proxy Risks:

  • ⚠️ Security Risk: API keys may be logged by proxy servers
  • 📉 Poor Stability: May fail or be slow at any time
  • 🚫 Usage Limits: May have request frequency or quantity restrictions

Strongly recommend using your own reverse proxy for better security, stability, and success rate.

🛠️ How to Set Up Your Own Reverse Proxy

If you have your own overseas server, you can use Nginx to set up a reverse proxy:

Prerequisites:

  • An overseas server (VPS)
  • A domain with the following subdomains pointing to your server IP:
    • openai.your-domain.com
    • claude.your-domain.com
    • gemini.your-domain.com

1. Install Nginx

sudo apt-get update
sudo apt-get install nginx

2. Configure Domain and SSL Certificate

# Apply for SSL certificate (using Let's Encrypt)
sudo apt-get install certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com

3. Create Reverse Proxy Configuration

# Create separate configuration files for each API
sudo nano /etc/nginx/sites-available/openai-proxy

4. Add OpenAI Configuration

# OpenAI reverse proxy
server {
    listen 443 ssl;
    server_name openai.your-domain.com;

    ssl_certificate /etc/letsencrypt/live/claude.your-domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/claude.your-domain.com/privkey.pem;

    location / {
        # DNS resolver, disable IPv6
        resolver 8.8.8.8 ipv6=off;

        # Reverse proxy configuration
        proxy_pass https://api.openai.com/;
        proxy_ssl_server_name on;
        proxy_set_header Host api.openai.com;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        # Hide backend server CORS headers to avoid duplication
        proxy_hide_header Access-Control-Allow-Origin;
        proxy_hide_header Access-Control-Allow-Methods;
        proxy_hide_header Access-Control-Allow-Headers;
        proxy_hide_header Access-Control-Allow-Credentials;

        # Handle OPTIONS preflight requests
        if ($request_method = 'OPTIONS') {
            add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS';
            add_header Access-Control-Allow-Headers '*';
            add_header Access-Control-Max-Age 86400;
            return 204;
        }

        # Add CORS headers for all other requests
        add_header Access-Control-Allow-Origin * always;
        add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS' always;
        add_header Access-Control-Allow-Headers '*' always;
    }
}

5. Create Claude Configuration

sudo nano /etc/nginx/sites-available/claude-proxy

Add the following content:

# Claude reverse proxy
server {
    listen 443 ssl;
    server_name claude.your-domain.com;

    ssl_certificate /etc/letsencrypt/live/claude.your-domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/claude.your-domain.com/privkey.pem;

    location / {
        # DNS resolver, disable IPv6
        resolver 8.8.8.8 ipv6=off;

        # Reverse proxy configuration
        proxy_pass https://api.anthropic.com/;
        proxy_ssl_server_name on;
        proxy_set_header Host api.anthropic.com;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        # Hide backend server CORS headers to avoid duplication
        proxy_hide_header Access-Control-Allow-Origin;
        proxy_hide_header Access-Control-Allow-Methods;
        proxy_hide_header Access-Control-Allow-Headers;
        proxy_hide_header Access-Control-Allow-Credentials;

        # Handle OPTIONS preflight requests
        if ($request_method = 'OPTIONS') {
            add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS';
            add_header Access-Control-Allow-Headers '*';
            add_header Access-Control-Max-Age 86400;
            return 204;
        }

        # Add CORS headers for all other requests
        add_header Access-Control-Allow-Origin * always;
        add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS' always;
        add_header Access-Control-Allow-Headers '*' always;
    }
}

6. Create Gemini Configuration

sudo nano /etc/nginx/sites-available/gemini-proxy

Add the following content:

# Gemini reverse proxy
server {
    listen 443 ssl;
    server_name gemini.your-domain.com;

    ssl_certificate /etc/letsencrypt/live/claude.your-domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/claude.your-domain.com/privkey.pem;

    location / {
        # DNS resolver, disable IPv6
        resolver 8.8.8.8 ipv6=off;

        # Reverse proxy configuration
        proxy_pass https://generativelanguage.googleapis.com/;
        proxy_ssl_server_name on;
        proxy_set_header Host generativelanguage.googleapis.com;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        # Hide backend server CORS headers to avoid duplication
        proxy_hide_header Access-Control-Allow-Origin;
        proxy_hide_header Access-Control-Allow-Methods;
        proxy_hide_header Access-Control-Allow-Headers;
        proxy_hide_header Access-Control-Allow-Credentials;

        # Handle OPTIONS preflight requests
        if ($request_method = 'OPTIONS') {
            add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS';
            add_header Access-Control-Allow-Headers '*';
            add_header Access-Control-Max-Age 86400;
            return 204;
        }

        # Add CORS headers for all other requests
        add_header Access-Control-Allow-Origin * always;
        add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS' always;
        add_header Access-Control-Allow-Headers '*' always;
    }
}

7. Enable Configurations

# Enable all proxy configurations
sudo ln -s /etc/nginx/sites-available/openai-proxy /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/claude-proxy /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/gemini-proxy /etc/nginx/sites-enabled/

Configuration Notes:

  • Replace your-domain.com with your actual domain
  • Each API uses a separate configuration file for easier management
  • Certificate paths are automatically generated after applying for SSL certificates

8. Restart Nginx

sudo nginx -t  # Check configuration
sudo nginx -s reload  # Reload configuration

Proxy URLs: After successful testing, use the following proxy URLs in the API Key tester:

  • OpenAI: https://openai.your-domain.com/v1
  • Claude: https://claude.your-domain.com/v1
  • Gemini: https://gemini.your-domain.com/v1

Quick Start

Requirements

  • Node.js >= 20.19.0
  • npm >= 8.0.0

Install Dependencies

npm install

Start Development Server

npm run dev

The application will start at http://localhost:5173

Build for Production

npm run build

Build artifacts will be generated in the dist/ directory

🚀 Deployment Options

1. Docker Deployment

docker run -d \
  --name api-key-tester \
  -p 8080:80 \
  --restart unless-stopped \
  ghcr.io/weiruchenai1/api-key-tester:latest

Visit http://localhost:8080

2. Docker Compose Deployment

Using the provided docker-compose.yml file:

# Download configuration file
curl -O https://raw.githubusercontent.com/weiruchenai1/api-key-tester/main/docker-compose.yml

# Start service
docker-compose up -d

# View logs
docker-compose logs -f

# Stop service
docker-compose down

Custom configuration:

services:
  web:
    image: ghcr.io/weiruchenai1/api-key-tester:latest
    ports:
      - "3000:80"  # Change port
    restart: unless-stopped
    environment:
      - TZ=Asia/Shanghai

3. Cloudflare Pages Deployment

  1. Fork this repository to your GitHub account
  2. Login to Cloudflare Dashboard
  3. Go to Workers & Pages > Create application > Pages > Connect to Git
  4. Select your forked repository
  5. Configure build settings:
    • Build command: npm run build
    • Build output directory: dist
    • Node.js version: 20 or higher
  6. Click Save and Deploy

4. Vercel Deployment

One-Click Deploy:

Deploy with Vercel

5. Static File Server Deployment

Suitable for any server that supports static files:

# Build project
npm run build

# Upload the contents of dist directory to your web server
# Ensure server is configured with proper routing rules (SPA support)

Nginx Configuration Example:

server {
    listen 80;
    server_name your-domain.com;
    root /path/to/dist;
    index index.html;

    location / {
        try_files $uri $uri/ /index.html;
    }

    # Enable gzip compression
    gzip on;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
}

💡 Use Cases

  • Batch API key validation
  • Cleanup expired keys
  • Quick key status detection
  • Team key management

🛡️ Privacy & Security

  • ✅ Pure frontend, keys are not uploaded
  • ✅ Open source and transparent, code can be audited
  • ✅ Only for validation, no data storage

🛠️ Tech Stack

  • Frontend Framework: React 19
  • Type System: TypeScript
  • Styling: Tailwind CSS 4
  • Build Tool: Vite 7
  • i18n: i18next

📄 License

MIT License


If you find it useful, please give it a ⭐!

Star History

Explore related projects

Loading…