English | 简体中文
Call TypeSafe Jev through a single HTTP endpoint that rotates API keys automatically, and manage the keys from a web page.
- Rotates through available keys in order, with at most 50 upstream calls per key per second
- Disables a key automatically when upstream returns
401/402, and pauses it and switches to another key on429 - Web admin panel for keys: add, check, search, delete (one at a time, the selected keys, or every disabled key at once), plus JSONL import and export
- The admin panel shows how many times clients called the proxy, how many calls succeeded and how many failed, with failures counted per status code, plus a chart of calls per hour (last 24 hours), day (last 30 days) or week (last 12 weeks) in Beijing time (UTC+8)
- Keys and request counters live in Redis (Upstash), shared by every instance and kept across redeploys
- Optional Redis-free mode: keys come from an environment variable (see Running without Redis)
- One-click deployment to Vercel, or a single Docker Compose command on your own server
Note
Each proxied request uses about 4 Redis commands (pick a key, release the slot, record the request count, reset the rate-limit streak on success), and each refresh of the admin panel uses 2 (the key list and the call chart). Keep an eye on the command quota of your Upstash plan.
Note
Running without Redis
Set USE_REDIS=false and put your keys in TYPESAFE_API_KEYS. You don't need an Upstash database. Every instance reads the same key list, but everything else stays in each instance's memory:
- To add or remove keys, edit
TYPESAFE_API_KEYSand redeploy. The admin panel can only check and export keys. - Each instance enforces the 50 requests per second limit on its own, so when Vercel runs several instances, a key can receive more than that in total.
- Keys disabled after
401/402, cooldowns, check results and request counts reset when an instance restarts, and are not shared with other instances. The admin panel shows the state of whichever instance answered.
- Click the Deploy with Vercel button above and follow the prompts to create the repository.
- When prompted, create an Upstash Redis database (the free plan is enough). Its connection environment variables are added automatically.
- Fill in the
ADMIN_PASSWORDandAUTHORIZATION_TOKENenvironment variables, then deploy. - Open the deployed site and sign in with
ADMIN_PASSWORD. - Add your TypeSafe API keys, or import a JSONL file you exported earlier.
To skip Redis, use the Deploy without Redis button instead: no database is created, USE_REDIS is prefilled with false, and you enter your keys in TYPESAFE_API_KEYS, separated by commas. See Running without Redis for what changes in this mode.
git clone https://github.com/left0ver/jev-proxy-pool.git
cd jev-proxy-pool
printf 'ADMIN_PASSWORD=%s\nAUTHORIZATION_TOKEN=%s\n' "$(openssl rand -hex 16)" "$(openssl rand -hex 24)" > .env && cat .env
docker compose up -d --buildRequires Node.js 22.9 or later and an Upstash Redis database (create one for free in the Upstash console).
git clone https://github.com/left0ver/jev-proxy-pool.git
cd jev-proxy-pool
npm ci
cp .env.example .env # fill in ADMIN_PASSWORD, AUTHORIZATION_TOKEN, and the database's KV_REST_API_URL and KV_REST_API_TOKEN
npm run devOpen http://127.0.0.1:3000, sign in, and add your keys.
| Name | Required | Purpose |
|---|---|---|
ADMIN_PASSWORD |
Yes | Password for the admin panel |
AUTHORIZATION_TOKEN |
Yes | Bearer token clients use to call the API |
USE_REDIS |
No | false turns off Redis and reads keys from TYPESAFE_API_KEYS, defaults to true |
TYPESAFE_API_KEYS |
When USE_REDIS=false |
Keys, one per line or separated by commas; JSONL lines exported from the admin panel also work |
KV_REST_API_URL / KV_REST_API_TOKEN |
Unless USE_REDIS=false |
Upstash Redis REST URL and token, added automatically when the database is connected on Vercel; UPSTASH_REDIS_REST_URL / UPSTASH_REDIS_REST_TOKEN also work |
REDIS_KEY_PREFIX |
No | Prefix for Redis keys, defaults to jev: |
PORT |
No | Local development port, defaults to 3000; with Docker Compose, the port published on the host, defaults to 8791 |
Use different random strings for ADMIN_PASSWORD and AUTHORIZATION_TOKEN.
POST /v1/systemone (also available at /api/v1/systemone):
curl --fail-with-body 'https://your-project.vercel.app/v1/systemone' \
-H 'Authorization: Bearer YOUR_AUTHORIZATION_TOKEN' \
-H 'Content-Type: application/json' \
--data '{"state":{"text":"Hello"},"questions":{"check":{"type":"noul","instructions":"Does the text contain Hello?"}}}'| Field | Required | Description |
|---|---|---|
state |
Yes | Text or JSON data to evaluate; must not be null |
questions |
Yes | Non-empty object keyed by question name; type can be noul, choice or score |
model |
No | TypeSafe model name; the SDK default is used when omitted |
A successful response contains model, answers and usage. In the example above, the result is at answers.check.noul, a value from 0 to 1 giving the probability that the answer is "yes".
| Status | Meaning |
|---|---|
400 |
Invalid request parameters |
401 |
Wrong client token |
429 |
Every available key has hit its per-second limit or is cooling down; wait for Retry-After |
502 |
TypeSafe rejected the upstream credentials (401 / 403) |
503 |
No keys available; add or import some |
504 |
The 30-second deadline passed, or TypeSafe could not be reached |
500 |
Internal error, for example Redis being unreachable |
Other upstream errors are passed through with TypeSafe's status code, and the response body includes upstreamStatus and detail.
