Tavily Key Generator + API Proxy
Skill by ara.so β Daily 2026 Skills collection
Automates bulk Tavily account registration using Playwright + CapSolver (Cloudflare Turnstile), then pools the resulting API keys behind a unified proxy gateway with round-robin rotation, usage tracking, token management, and a web console.
What It Does
| Component |
Location |
Purpose |
| Key Generator |
root / |
Playwright-driven headless Firefox registers Tavily accounts, solves Turnstile CAPTCHAs, verifies email, extracts API key |
| API Proxy |
proxy/ |
FastAPI service that round-robins requests across pooled keys, exposes /api/search and /api/extract, serves web console at /console |
Each free Tavily account yields 1,000 API calls/month. The proxy aggregates quota: 10 keys = 10,000 calls/month via one endpoint.
Installation
Key Generator
git clone https://github.com/skernelx/tavily-key-generator.git
cd tavily-key-generator
pip install -r requirements.txt
playwright install firefox
cp config.example.py config.py
python main.py
API Proxy (Docker β recommended)
cd proxy/
cp .env.example .env
docker compose up -d
Configuration (config.py)
CAPTCHA Solver (required)
CAPTCHA_SOLVER = "capsolver"
CAPSOLVER_API_KEY = "CAP-..."
CAPTCHA_SOLVER = "browser"
Email Backend (required β pick one)
Option A: Cloudflare Email Worker (self-hosted, free)
EMAIL_BACKEND = "cloudflare"
EMAIL_DOMAIN = "mail.yourdomain.com"
EMAIL_API_URL = "https://mail.yourdomain.com"
EMAIL_API_TOKEN = "your-worker-token"
Option B: DuckMail (third-party temporary email)
EMAIL_BACKEND = "duckmail"
DUCKMAIL_API_BASE = "https://api.duckmail.sbs"
DUCKMAIL_BEARER = "dk_..."
DUCKMAIL_DOMAIN = "duckmail.sbs"
If both backends are configured, the CLI prompts you to choose at runtime.
Registration Throttle (anti-ban)
THREADS = 2
COOLDOWN_BASE = 45
COOLDOWN_JITTER = 15
BATCH_LIMIT = 20
Auto-upload to Proxy (optional)
PROXY_AUTO_UPLOAD = True
PROXY_URL = "http://localhost:9874"
PROXY_ADMIN_PASSWORD = "your-admin-password"
Running the Key Generator
python main.py
Generated api_keys.md format (used for bulk import into proxy):
tvly-abc123...
tvly-def456...
tvly-ghi789...
API Proxy Usage
Calling the Proxy (drop-in Tavily replacement)
curl -X POST http://your-server:9874/api/search \
-H "Authorization: Bearer tvly-YOUR_PROXY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"query": "latest AI news", "search_depth": "basic"}'
curl -X POST http://your-server:9874/api/extract \
-H "Authorization: Bearer tvly-YOUR_PROXY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"urls": ["https://example.com/article"]}'
Token can also be passed in the request body as api_key (Tavily SDK compatible):
import requests
response = requests.post(
"http://your-server:9874/api/search",
json={
"query": "Python web scraping",
"api_key": "tvly-YOUR_PROXY_TOKEN"
}
)
print(response.json())
Python SDK Integration
from tavily import TavilyClient
client = TavilyClient(
api_key="tvly-YOUR_PROXY_TOKEN",
base_url="http://your-server:9874"
)
results = client.search("machine learning trends 2025")
Admin API Reference
All admin endpoints require header: X-Admin-Password: your-password
Keys Management
curl http://localhost:9874/api/keys \
-H "X-Admin-Password: secret"
curl -X POST http://localhost:9874/api/keys \
-H "X-Admin-Password: secret" \
-H "Content-Type: application/json" \
-d '{"key": "tvly-abc123..."}'
curl -X POST http://localhost:9874/api/keys \
-H "X-Admin-Password: secret" \
-H "Content-Type: application/json" \
-d '{"bulk": "tvly-abc...\ntvly-def...\ntvly-ghi..."}'
curl -X PUT http://localhost:9874/api/keys/{id}/toggle \
-H "X-Admin-Password: secret"
curl -X DELETE http://localhost:9874/api/keys/{id} \
-H "X-Admin-Password: secret"
Token Management
curl -X POST http://localhost:9874/api/tokens \
-H "X-Admin-Password: secret" \
-H "Content-Type: application/json" \
-d '{"label": "my-app"}'
curl http://localhost:9874/api/tokens \
-H "X-Admin-Password: secret"
curl -X DELETE http://localhost:9874/api/tokens/{id} \
-H "X-Admin-Password: secret"
Stats
curl http://localhost:9874/api/stats \
-H "X-Admin-Password: secret"
Change Admin Password
curl -X PUT http://localhost:9874/api/password \
-H "X-Admin-Password: current-password" \
-H "Content-Type: application/json" \
-d '{"new_password": "new-secure-password"}'
Proxy Behavior
- Round-robin: requests distributed evenly across active keys
- Auto-disable: key disabled after 3 consecutive failures
- Quota tracking: total = active_keys Γ 1,000/month; updates automatically on add/delete/toggle
- Token format: proxy tokens use
tvly- prefix, indistinguishable from real Tavily keys to clients
Proxy .env Configuration
ADMIN_PASSWORD=change-this-immediately
PORT=9874
# Optional: restrict CORS origins
CORS_ORIGINS=https://myapp.com,https://app2.com
Nginx Reverse Proxy + HTTPS
server {
listen 443 ssl;
server_name tavily-proxy.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:9874;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Integration Pattern: Auto-replenish Pool
import requests
PROXY_URL = "http://localhost:9874"
ADMIN_PASSWORD = "your-password"
MIN_ACTIVE_KEYS = 10
def get_stats():
r = requests.get(f"{PROXY_URL}/api/stats",
headers={"X-Admin-Password": ADMIN_PASSWORD})
return r.json()
def trigger_registration