recovered snapshot from suspended aaronjaworski710 (history unavailable)
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
|||||||
|
vani_accounts.jsonl
|
||||||
|
vani_pool.json
|
||||||
|
vanigw_state.json
|
||||||
|
active_cookies.json
|
||||||
|
working_mails.txt
|
||||||
|
used_emails.txt
|
||||||
|
*.log
|
||||||
|
*.png
|
||||||
|
*.mp4
|
||||||
|
*.mp3
|
||||||
|
*.json.tmp
|
||||||
|
__pycache__/
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
# vani-toolkit
|
||||||
|
|
||||||
|
Free-pool toolkit for [Vani.ai](https://c.vani.ai) — mass account registration + OpenAI-compatible gateway with **chat, images, video, TTS audio and Deep Research** over the free tier.
|
||||||
|
|
||||||
|
> 37 chat models (GPT-6.x, Claude Opus 5.x, Kimi K3, GLM-5.3, Grok 4.6, Gemini 3.x, Qwen3.x, DeepSeek, MiniMax…), 4 image models, 5 video models (Seedance 2.x, Grok Imagine), TTS, 3D, Docs/Slides/Design artifacts, Web search and multi-minute cited Deep Research reports — all on **free accounts**, no card.
|
||||||
|
|
||||||
|
```
|
||||||
|
├── register/vani_reg.py mass registration (native Turnstile via cloakbrowser, no captcha services)
|
||||||
|
├── register/build_pool.py extract Supabase JWT pool from account bank
|
||||||
|
├── gateway/vanigw.py OpenAI-compatible gateway over the pool (stdlib only, Python 3.11+)
|
||||||
|
└── docs/API-REVERSE.md full reverse-engineered REST/SSE API reference (Oct 2026)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Quick start
|
||||||
|
|
||||||
|
### 1. Register accounts
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install cloakbrowser requests
|
||||||
|
python -m cloakbrowser install # fetch the browser binary once
|
||||||
|
python register/vani_reg.py 10 voidash # 10 accounts via voidash.bond temp mail
|
||||||
|
# -> vani_accounts.jsonl (email, cookies, verification status)
|
||||||
|
```
|
||||||
|
|
||||||
|
Registration is fully automatic: temp email → magic-link code from IMAP/API → native Cloudflare Turnstile solved in a real browser context (external captcha-solver tokens are **rejected** by their siteverify — hostname binding) → verified session cookies saved. ~2 min/account, ~80% conversion on residential IP.
|
||||||
|
|
||||||
|
Optional: `VANI_IMAP_POOL=/path/working_mails.txt` (lines `email:pass`) to use your own IMAP pool instead of voidash.
|
||||||
|
|
||||||
|
### 2. Run the gateway
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python gateway/vanigw.py # stdlib only; reads ../vani_accounts.jsonl
|
||||||
|
# [vanigw] pool: 31 accounts (31 live)
|
||||||
|
# [vanigw] catalog: 45 models
|
||||||
|
# [vanigw] listening on 127.0.0.1:8500
|
||||||
|
```
|
||||||
|
|
||||||
|
Dashboard with pool health + curl examples: http://127.0.0.1:8500/
|
||||||
|
Key: `X-Gateway-Key: vani-local-2026` (edit `GW_KEY` in the source).
|
||||||
|
|
||||||
|
### 3. Use it — OpenAI compatible
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Chat (any of 37 models, streaming supported)
|
||||||
|
curl http://127.0.0.1:8500/v1/chat/completions \
|
||||||
|
-H "X-Gateway-Key: vani-local-2026" -H "Content-Type: application/json" \
|
||||||
|
-d '{"model":"claude-opus-5","messages":[{"role":"user","content":"hi"}],"stream":true}'
|
||||||
|
|
||||||
|
# Images -> b64_json + /media url (default: gemini-3.1-flash-image, the cheap one)
|
||||||
|
curl http://127.0.0.1:8500/v1/images/generations \
|
||||||
|
-H "X-Gateway-Key: vani-local-2026" -H "Content-Type: application/json" \
|
||||||
|
-d '{"prompt":"an orange cube on white background","model":"gpt-image-2.5","size":"1024x1024"}'
|
||||||
|
|
||||||
|
# TTS -> raw audio/mpeg (voice: Alex)
|
||||||
|
curl http://127.0.0.1:8500/v1/audio/speech \
|
||||||
|
-H "X-Gateway-Key: vani-local-2026" -H "Content-Type: application/json" \
|
||||||
|
-d '{"input":"Hello world"}' --output voice.mp3
|
||||||
|
|
||||||
|
# Video (async): create, then poll
|
||||||
|
curl http://127.0.0.1:8500/v1/videos/generations \
|
||||||
|
-H "X-Gateway-Key: vani-local-2026" -H "Content-Type: application/json" \
|
||||||
|
-d '{"prompt":"red sports car in a neon city, cinematic","model":"seedance-2.0-mini","duration_secs":5,"ratio":"16:9"}'
|
||||||
|
curl http://127.0.0.1:8500/v1/videos/<id> -H "X-Gateway-Key: vani-local-2026"
|
||||||
|
# -> {"status":"succeeded","url":"/media/<id>.mp4"} (720p, ~2 min render)
|
||||||
|
|
||||||
|
# Deep Research (async): plan -> research -> write -> verify -> cited report (~4-8 min)
|
||||||
|
curl http://127.0.0.1:8500/v1/research \
|
||||||
|
-H "X-Gateway-Key: vani-local-2026" -H "Content-Type: application/json" \
|
||||||
|
-d '{"query":"Compare free LLM API aggregators in 2026"}'
|
||||||
|
curl "http://127.0.0.1:8500/v1/research/<id>?format=md" -H "X-Gateway-Key: vani-local-2026"
|
||||||
|
# -> full markdown report with citations; also ?format=pdf|docx|html|pptx
|
||||||
|
```
|
||||||
|
|
||||||
|
Model aliases resolve loosely: `claude-opus-5` → `anthropic/claude-opus-5`, `kimi-k3` → `moonshotai/kimi-k3`, etc. Full live catalog: `GET /v1/models`.
|
||||||
|
|
||||||
|
## How the pool works
|
||||||
|
|
||||||
|
- Each account = Supabase session cookie (`sb-<ref>-auth-token`, refresh token valid ~30 days). The gateway auto-refreshes JWTs via the site middleware and persists rotated cookies.
|
||||||
|
- Free tier: 1M micro-units of text allowance per account per window + weekly media limits. On `429 weekly_limit_reached` the gateway marks the account exhausted and rotates to the next one.
|
||||||
|
- One concurrent request per account (free plan) — the gateway serializes per account and parallelizes across accounts.
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- Image models differ wildly in weekly cost: `gpt-image-2.5` ≈ 30%/image, `gemini-3.1-flash-image` ≈ 1-2%/image (gateway default). Video ≈ one weekly limit hit per account — the pool is your quota.
|
||||||
|
- Deep Research statuses: `scoping → awaiting_answers → planning → awaiting_approval → researching → writing → verifying → succeeded`. The gateway auto-skips clarifying questions and auto-approves the plan.
|
||||||
|
- Everything here talks to documented-by-behavior private endpoints; see `docs/API-REVERSE.md`.
|
||||||
|
|
||||||
|
---
|
||||||
|
Built with ENI. More free-tier stacks: [t.me/AlStack](https://t.me/AlStack)
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
# Vani.ai — Reverse-Engineered API Reference (c.vani.ai, Oct 2026)
|
||||||
|
|
||||||
|
Next.js (RSC) app + Supabase auth. Everything below was observed live from the web client
|
||||||
|
and re-verified from pure-Python urllib (no browser needed once you hold session cookies).
|
||||||
|
|
||||||
|
## 1. Auth
|
||||||
|
|
||||||
|
| Item | Value |
|
||||||
|
|---|---|
|
||||||
|
| Login page | `https://c.vani.ai/login?next=%2Fchat` |
|
||||||
|
| Method | email magic-link + 6-digit code (server action POST) |
|
||||||
|
| Captcha | Cloudflare Turnstile, action `signup`, sitekey served via RSC flight data (`__next_f`), NOT in static JS |
|
||||||
|
| Session | httpOnly cookie `sb-<ref>-auth-token` (Supabase). Value: `base64-<...>` containing access JWT (~1h) + refresh token (~30d) |
|
||||||
|
| Refresh | hit `GET https://c.vani.ai/` with the cookie jar — Next middleware rotates the auth cookie automatically |
|
||||||
|
|
||||||
|
**External captcha-solver tokens (2captcha etc.) are rejected** — server-side siteverify binds
|
||||||
|
the token to hostname/session context. Only a token produced by a real browser rendering the
|
||||||
|
actual page is accepted. cloakbrowser/camoufox headless works.
|
||||||
|
|
||||||
|
Guest (no account): `POST /api/public/chat` — text-only, 3 models.
|
||||||
|
|
||||||
|
## 2. Conversations & chat
|
||||||
|
|
||||||
|
```
|
||||||
|
POST /api/chat/conversations {"title": str} -> {"id": cid}
|
||||||
|
GET /api/chat/conversations?limit=5
|
||||||
|
GET /api/chat/conversations/{cid}/messages?limit=N -> {"turns":[...]}
|
||||||
|
POST /api/chat/stream (SSE)
|
||||||
|
```
|
||||||
|
|
||||||
|
`/api/chat/stream` body (strictly validated — unknown params → 400 `strict_mode`):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"model": "openai/gpt-6.1-sol",
|
||||||
|
"tool_execution": "confirm",
|
||||||
|
"media_prompt_mode": "enhance",
|
||||||
|
"conversation_id": "<cid>",
|
||||||
|
"reasoning_effort": "high",
|
||||||
|
"vani_mode": "standard",
|
||||||
|
"messages": [{"role": "user", "content": "..."}]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
SSE events (`data: {...}`):
|
||||||
|
- `message.start` — assistant message id
|
||||||
|
- `content.delta` `{"text": chunk}`
|
||||||
|
- `tool.*` — tool proposals (see §5)
|
||||||
|
- `usage` `{prompt_tokens, completion_tokens, weekly_used_percent}`
|
||||||
|
- `message.complete`
|
||||||
|
|
||||||
|
Model ids = catalog slugs, e.g. `anthropic/claude-opus-5`, `moonshotai/kimi-k3`,
|
||||||
|
`zhipu/glm-5.3`, `openai/gpt-6.1-sol`, `x-ai/grok-4.6`.
|
||||||
|
|
||||||
|
## 3. Model catalog
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /api/onboarding/guide?kind=all
|
||||||
|
-> {"cards":[{"model":"anthropic/claude-opus-5","kind":"chat","name":"Claude Opus 5","provider":"anthropic","required_plan":null,"enabled":true}, ...]}
|
||||||
|
```
|
||||||
|
|
||||||
|
~45 entries: chat(37) + image + video + audio + 3d + docs/slides/design artifacts.
|
||||||
|
|
||||||
|
## 4. Generations (image / video / audio) — direct, no LLM round-trip
|
||||||
|
|
||||||
|
```
|
||||||
|
POST /api/chat/generations
|
||||||
|
Header: Idempotency-Key: <uuid4> (REQUIRED)
|
||||||
|
```
|
||||||
|
|
||||||
|
Image:
|
||||||
|
```json
|
||||||
|
{"kind":"image","conversation_id":"<cid>","model":"google/gemini-3.1-flash-image",
|
||||||
|
"prompt":"...","variant":"1024x1024","mode":"generate"}
|
||||||
|
```
|
||||||
|
Image models: `openai/gpt-image-2.5`, `google/gemini-3.1-flash-image`,
|
||||||
|
`bytedance/jimeng-image-4.0`, `x-ai/grok-imagine-image-2.0`.
|
||||||
|
Weekly cost differs ~20x: gpt-image-2.5 ≈ 30%/img, gemini flash ≈ 1-2%/img.
|
||||||
|
|
||||||
|
Video:
|
||||||
|
```json
|
||||||
|
{"kind":"video","conversation_id":"<cid>","model":"bytedance/seedance-2.0-mini",
|
||||||
|
"prompt":"...","duration_secs":5,"ratio":"16:9","mode":"text_to_video","variant":"720p"}
|
||||||
|
```
|
||||||
|
Video models: `bytedance/seedance-2.0-mini|2.0-fast-vip|2.0-vip|2.5`,
|
||||||
|
`x-ai/grok-imagine-video-1.5`. `mode: image_to_video` takes an input attachment.
|
||||||
|
Render ~2 min. Weekly: 1 video per account.
|
||||||
|
|
||||||
|
Audio (TTS):
|
||||||
|
```json
|
||||||
|
{"kind":"audio","conversation_id":"<cid>","model":"inworld/realtime-tts-2",
|
||||||
|
"prompt":"text to speak","mode":"text_to_speech","variant":"Alex"}
|
||||||
|
```
|
||||||
|
|
||||||
|
Poll + download:
|
||||||
|
```
|
||||||
|
GET /api/chat/generations/{gid} -> {"status":"queued|running|succeeded|failed","attachment_id":...,"params":{...}}
|
||||||
|
GET /api/chat/attachments/{att_id}/url -> raw bytes (png/mp4/mp3), cookie auth
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. Tool flow via chat (proposals → confirm)
|
||||||
|
|
||||||
|
With `tool_execution: "confirm"`, when the LLM decides to use a tool the stream emits a
|
||||||
|
proposal instead of executing:
|
||||||
|
|
||||||
|
```
|
||||||
|
POST /api/chat/tools/proposals {"assistant_message_id": mid, "execution_mode":"confirm"}
|
||||||
|
POST /api/chat/tools/actions/{action_id}/confirm
|
||||||
|
-> {"generation_id": gid} or {"research_job_id": jid}
|
||||||
|
```
|
||||||
|
|
||||||
|
then poll as in §4 / §6. This is how the UI generates media from chat text.
|
||||||
|
|
||||||
|
## 6. Deep Research (multi-minute, cited reports)
|
||||||
|
|
||||||
|
```
|
||||||
|
POST /api/chat/research/v2 {"conversation_id": cid, "query": "..."}
|
||||||
|
-> 202 {"id": jid, "status":"scoping"}
|
||||||
|
GET /api/chat/research/v2/{jid}
|
||||||
|
POST /api/chat/research/v2/{jid}/answers {"skip": true} # or {"answers":[...]} for clarify.questions
|
||||||
|
POST /api/chat/research/v2/{jid}/start # from awaiting_approval
|
||||||
|
```
|
||||||
|
|
||||||
|
Status graph:
|
||||||
|
```
|
||||||
|
scoping → awaiting_answers → planning → awaiting_approval → researching → writing → verifying → succeeded
|
||||||
|
```
|
||||||
|
`awaiting_answers` exposes `clarify.questions: [{id:"q1", text, options:[4 strings]}]`.
|
||||||
|
`{"skip": true}` = UI "Skip questions". On success the job carries `artifact_id`.
|
||||||
|
|
||||||
|
Artifacts:
|
||||||
|
```
|
||||||
|
GET /api/artifacts/{aid} -> {"artifact":{"preview":..., "formats":[...]}}
|
||||||
|
GET /api/artifacts/{aid}/export?format=md -> clean markdown report with [[n]](url) citations
|
||||||
|
format: md | pdf | docx | html | pptx
|
||||||
|
```
|
||||||
|
|
||||||
|
Total runtime observed: 4–8 min (researching ~2, writing ~3, verifying ~1).
|
||||||
|
|
||||||
|
## 7. Misc
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /api/public/usage weekly % per feature for the session user
|
||||||
|
GET /api/skills skill presets
|
||||||
|
GET /api/sandbox/status code sandbox (free: 5 min/day)
|
||||||
|
```
|
||||||
|
|
||||||
|
## 8. Free-tier economics
|
||||||
|
|
||||||
|
- Text: 1M "micro-units" per account per window (~hundreds of messages) — effectively large.
|
||||||
|
- Weekly caps are per-feature percentages; a big pool + rotation = practical unlimited.
|
||||||
|
- 1 concurrent request per account → gateway serializes per account, parallelizes across pool.
|
||||||
|
- 429 body contains `weekly_limit` / `allowance` → mark exhausted, rotate.
|
||||||
|
|
||||||
|
## 9. Anti-abuse notes
|
||||||
|
|
||||||
|
- Registration: Turnstile `signup` + email verification; residential IP fine for tens of accounts/day.
|
||||||
|
- Cookies live ~30d via refresh token; a plain `GET /` refreshes them — no re-login needed.
|
||||||
|
- All endpoints accept plain cookie auth from urllib/httpx — no CSRF token, no special headers
|
||||||
|
beyond `Content-Type: application/json` (+ `Idempotency-Key` on generations).
|
||||||
|
|
||||||
|
---
|
||||||
|
[t.me/AlStack](https://t.me/AlStack)
|
||||||
@@ -0,0 +1,650 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
VANIGW — OpenAI-compatible gateway over Vani.ai free-account pool.
|
||||||
|
Python 3.11+, stdlib only. Port 8500.
|
||||||
|
|
||||||
|
Features (all reverse-engineered from c.vani.ai, Oct 2026):
|
||||||
|
POST /v1/chat/completions — 37 chat models (GPT-6.x, Claude Opus 5.x, Kimi K3, GLM, Grok, Gemini, Qwen, DeepSeek...)
|
||||||
|
POST /v1/images/generations — gpt-image-2.5 / gemini-3.1-flash-image / jimeng-image-4.0 / grok-imagine-image-2.0
|
||||||
|
POST /v1/audio/speech — inworld/realtime-tts-2 (voice: Alex)
|
||||||
|
POST /v1/videos/generations — seedance-2.0-mini / 2.0-fast-vip / 2.0-vip / 2.5 / grok-imagine-video-1.5 (async)
|
||||||
|
GET /v1/videos/{gen_id} — poll status, get mp4
|
||||||
|
POST /v1/research — Deep Research (plan -> cited report, minutes)
|
||||||
|
GET /v1/research/{job_id} — poll; ?format=md|pdf|docx|html|pptx
|
||||||
|
GET /v1/models — live catalog
|
||||||
|
GET /media/{token} — raw attachment bytes (png/mp4/mp3)
|
||||||
|
GET / — dashboard
|
||||||
|
|
||||||
|
Auth: header X-Gateway-Key: vani-local-2026 (or Authorization: Bearer vani-local-2026)
|
||||||
|
Pool: vani_accounts.jsonl (register with vani_reg.py), state in vanigw_state.json
|
||||||
|
"""
|
||||||
|
import json, sys, time, uuid, base64, threading, mimetypes
|
||||||
|
import urllib.request, urllib.error, http.cookiejar
|
||||||
|
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||||
|
|
||||||
|
sys.stdout.reconfigure(encoding='utf-8')
|
||||||
|
|
||||||
|
PORT = 8500
|
||||||
|
GW_KEY = 'vani-' + 'local-2026'
|
||||||
|
BASE = 'https://c.vani.ai'
|
||||||
|
UA = ('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 '
|
||||||
|
'(KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36')
|
||||||
|
import os as _os
|
||||||
|
_ROOT = _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__)))
|
||||||
|
ACCOUNTS_FILE = _os.environ.get('VANI_ACCOUNTS', _os.path.join(_ROOT, 'vani_accounts.jsonl'))
|
||||||
|
STATE_FILE = _os.environ.get('VANI_STATE', _os.path.join(_ROOT, 'vanigw_state.json'))
|
||||||
|
|
||||||
|
DEFAULT_CHAT = 'openai/gpt-6.1-sol'
|
||||||
|
DEFAULT_IMAGE = 'google/gemini-3.1-flash-image' # cheapest; gpt-image-2.5 burns ~30% weekly
|
||||||
|
DEFAULT_VIDEO = 'bytedance/seedance-2.0-mini'
|
||||||
|
DEFAULT_TTS = 'inworld/realtime-tts-2'
|
||||||
|
|
||||||
|
class Rotate(Exception):
|
||||||
|
"""account unusable for this request — try next"""
|
||||||
|
|
||||||
|
class Account:
|
||||||
|
def __init__(self, email, cookies):
|
||||||
|
self.email = email
|
||||||
|
self.cookies = cookies
|
||||||
|
self.jar = http.cookiejar.CookieJar()
|
||||||
|
self._load_jar(cookies)
|
||||||
|
self.op = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(self.jar))
|
||||||
|
self.lock = threading.Lock() # free plan: 1 concurrent per account
|
||||||
|
self.exhausted = False # weekly limit hit
|
||||||
|
self.dead = False # auth failed after refresh
|
||||||
|
self.weekly_pct = None
|
||||||
|
self.last_err = ''
|
||||||
|
|
||||||
|
def _load_jar(self, cookies):
|
||||||
|
for c in cookies:
|
||||||
|
try:
|
||||||
|
self.jar.set_cookie(http.cookiejar.Cookie(
|
||||||
|
0, c['name'], c['value'], None, False, c['domain'], True,
|
||||||
|
c['domain'].startswith('.'), c['path'], True, c.get('secure', True),
|
||||||
|
int(c.get('expires', 0) or 0), False, None, None, {}))
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def dump_cookies(self):
|
||||||
|
out = []
|
||||||
|
for c in self.jar:
|
||||||
|
out.append({'name': c.name, 'value': c.value, 'domain': c.domain,
|
||||||
|
'path': c.path, 'secure': bool(c.secure), 'httpOnly': bool(c.has_nonstandard_attr('HttpOnly')) or c.name.startswith('sb-'),
|
||||||
|
'expires': c.expires})
|
||||||
|
return out
|
||||||
|
|
||||||
|
def refresh(self):
|
||||||
|
"""hit site root — Next middleware rotates sb-*-auth-token via refresh_token (30d)"""
|
||||||
|
try:
|
||||||
|
r = urllib.request.Request(BASE + '/', headers={'User-Agent': UA, 'Accept': 'text/html'})
|
||||||
|
self.op.open(r, timeout=45).read(200)
|
||||||
|
return True
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def req(self, method, path, body=None, raw=False, timeout=180, stream=False):
|
||||||
|
data = json.dumps(body).encode() if body is not None else (b'{}' if method == 'POST' else None)
|
||||||
|
hdrs = {'User-Agent': UA, 'Content-Type': 'application/json',
|
||||||
|
'Origin': BASE, 'Referer': BASE + '/chat', 'Accept': '*/*',
|
||||||
|
'Idempotency-Key': str(uuid.uuid4())}
|
||||||
|
r = urllib.request.Request(BASE + path, data=data, method=method, headers=hdrs)
|
||||||
|
try:
|
||||||
|
resp = self.op.open(r, timeout=timeout)
|
||||||
|
except urllib.error.HTTPError as e:
|
||||||
|
msg = ''
|
||||||
|
try:
|
||||||
|
msg = e.read().decode(errors='replace')[:300]
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
if e.code == 401:
|
||||||
|
if self.refresh():
|
||||||
|
try:
|
||||||
|
r2 = urllib.request.Request(BASE + path, data=data, method=method, headers=hdrs)
|
||||||
|
resp = self.op.open(r2, timeout=timeout)
|
||||||
|
except urllib.error.HTTPError as e2:
|
||||||
|
self.dead = True; self.last_err = f'401 after refresh'
|
||||||
|
raise Rotate(f'{self.email}: dead (401)')
|
||||||
|
else:
|
||||||
|
self.dead = True; self.last_err = '401, refresh failed'
|
||||||
|
raise Rotate(f'{self.email}: dead (401)')
|
||||||
|
elif e.code == 429 or 'weekly_limit' in msg or 'allowance' in msg:
|
||||||
|
self.exhausted = True; self.last_err = 'weekly limit'
|
||||||
|
raise Rotate(f'{self.email}: weekly exhausted')
|
||||||
|
elif e.code == 403:
|
||||||
|
self.last_err = msg[:120]
|
||||||
|
raise Rotate(f'{self.email}: 403 {msg[:100]}')
|
||||||
|
else:
|
||||||
|
raise VaniError(e.code, msg)
|
||||||
|
if stream:
|
||||||
|
return resp
|
||||||
|
out = resp.read()
|
||||||
|
return out if raw else json.loads(out.decode())
|
||||||
|
|
||||||
|
class VaniError(Exception):
|
||||||
|
def __init__(self, code, msg):
|
||||||
|
self.code = code; self.msg = msg
|
||||||
|
super().__init__(f'{code}: {msg}')
|
||||||
|
|
||||||
|
class Pool:
|
||||||
|
def __init__(self):
|
||||||
|
self.accounts = []
|
||||||
|
self.lock = threading.Lock()
|
||||||
|
self.state = {'media': {}, 'exhausted': [], 'dead': []}
|
||||||
|
try:
|
||||||
|
self.state = json.load(open(STATE_FILE, encoding='utf-8'))
|
||||||
|
self.state.setdefault('media', {}); self.state.setdefault('exhausted', []); self.state.setdefault('dead', [])
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
self.load()
|
||||||
|
|
||||||
|
def load(self):
|
||||||
|
seen = {}
|
||||||
|
for line in open(ACCOUNTS_FILE, encoding='utf-8'):
|
||||||
|
try:
|
||||||
|
r = json.loads(line)
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
if r.get('ok') and r.get('cookies'):
|
||||||
|
seen[r['email']] = r # last record wins (freshest cookies)
|
||||||
|
with self.lock:
|
||||||
|
self.accounts = []
|
||||||
|
for email, r in seen.items():
|
||||||
|
a = Account(email, r['cookies'])
|
||||||
|
if email in self.state['exhausted']:
|
||||||
|
a.exhausted = True
|
||||||
|
if email in self.state['dead']:
|
||||||
|
a.dead = True
|
||||||
|
self.accounts.append(a)
|
||||||
|
return len(self.accounts)
|
||||||
|
|
||||||
|
def save_state(self):
|
||||||
|
with self.lock:
|
||||||
|
self.state['exhausted'] = [a.email for a in self.accounts if a.exhausted]
|
||||||
|
self.state['dead'] = [a.email for a in self.accounts if a.dead]
|
||||||
|
tmp = STATE_FILE + '.tmp'
|
||||||
|
json.dump(self.state, open(tmp, 'w', encoding='utf-8'))
|
||||||
|
import os; os.replace(tmp, STATE_FILE)
|
||||||
|
|
||||||
|
def persist_cookies(self, acc):
|
||||||
|
"""save refreshed cookies back to accounts file (append fresh record)"""
|
||||||
|
try:
|
||||||
|
rec = {'email': acc.email, 'ok': True, 'ts': time.time(), 'cookies': acc.dump_cookies(), 'src': 'gw-refresh'}
|
||||||
|
with open(ACCOUNTS_FILE, 'a', encoding='utf-8') as f:
|
||||||
|
f.write(json.dumps(rec) + '\n')
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def pick(self, need_fresh=False):
|
||||||
|
with self.lock:
|
||||||
|
cands = [a for a in self.accounts if not a.dead and not a.exhausted]
|
||||||
|
if not cands:
|
||||||
|
# weekly reset attempt: clear exhausted older than 7 days is manual; report
|
||||||
|
raise VaniError(503, 'pool exhausted (all accounts dead or weekly-limited); register more with vani_reg.py')
|
||||||
|
cands.sort(key=lambda a: a.weekly_pct if a.weekly_pct is not None else 0)
|
||||||
|
return cands[0]
|
||||||
|
|
||||||
|
def run(self, fn, max_tries=6):
|
||||||
|
"""run fn(account) with rotation"""
|
||||||
|
tried = set()
|
||||||
|
last = None
|
||||||
|
for _ in range(max_tries):
|
||||||
|
acc = self.pick()
|
||||||
|
if acc.email in tried:
|
||||||
|
# pick next unused
|
||||||
|
with self.lock:
|
||||||
|
alt = [a for a in self.accounts if not a.dead and not a.exhausted and a.email not in tried]
|
||||||
|
if not alt:
|
||||||
|
break
|
||||||
|
acc = alt[0]
|
||||||
|
tried.add(acc.email)
|
||||||
|
try:
|
||||||
|
with acc.lock:
|
||||||
|
return fn(acc)
|
||||||
|
except Rotate as e:
|
||||||
|
last = e
|
||||||
|
self.save_state()
|
||||||
|
continue
|
||||||
|
raise VaniError(503, f'no usable account: {last}')
|
||||||
|
|
||||||
|
POOL = Pool()
|
||||||
|
|
||||||
|
# ---------------- helpers ----------------
|
||||||
|
|
||||||
|
CATALOG = {'slugs': [], 'fetched': 0}
|
||||||
|
|
||||||
|
def fetch_catalog():
|
||||||
|
if time.time() - CATALOG['fetched'] < 3600 and CATALOG['slugs']:
|
||||||
|
return CATALOG['slugs']
|
||||||
|
try:
|
||||||
|
def _f(acc):
|
||||||
|
return acc.req('GET', '/api/onboarding/guide?kind=all')
|
||||||
|
d = POOL.run(_f)
|
||||||
|
slugs = [c['model'] for c in d.get('cards', []) if c.get('enabled')]
|
||||||
|
if slugs:
|
||||||
|
CATALOG['slugs'] = slugs; CATALOG['fetched'] = time.time()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return CATALOG['slugs']
|
||||||
|
|
||||||
|
def resolve_model(m, kind='chat'):
|
||||||
|
slugs = fetch_catalog()
|
||||||
|
if not m:
|
||||||
|
return {'chat': DEFAULT_CHAT, 'image': DEFAULT_IMAGE, 'video': DEFAULT_VIDEO, 'audio': DEFAULT_TTS}[kind]
|
||||||
|
if m in slugs:
|
||||||
|
return m
|
||||||
|
m2 = m.replace('vani/', '').replace('vani-', '')
|
||||||
|
for s in slugs:
|
||||||
|
if s == m2 or s.endswith('/' + m2) or s.split('/')[-1] == m2:
|
||||||
|
return s
|
||||||
|
for s in slugs:
|
||||||
|
if m2.lower() in s.lower():
|
||||||
|
return s
|
||||||
|
return m if '/' in m else {'chat': DEFAULT_CHAT, 'image': DEFAULT_IMAGE, 'video': DEFAULT_VIDEO, 'audio': DEFAULT_TTS}[kind]
|
||||||
|
|
||||||
|
def new_conv(acc, title):
|
||||||
|
return acc.req('POST', '/api/chat/conversations', {'title': title[:80]})['id']
|
||||||
|
|
||||||
|
def create_gen(acc, payload):
|
||||||
|
return acc.req('POST', '/api/chat/generations', payload, timeout=60)
|
||||||
|
|
||||||
|
def poll_gen(acc, gid, max_wait=600, interval=4):
|
||||||
|
t0 = time.time()
|
||||||
|
while time.time() - t0 < max_wait:
|
||||||
|
g = acc.req('GET', f'/api/chat/generations/{gid}', timeout=60)
|
||||||
|
st = g.get('status')
|
||||||
|
if st == 'succeeded':
|
||||||
|
return g
|
||||||
|
if st in ('failed', 'error', 'cancelled'):
|
||||||
|
raise VaniError(502, f'generation {st}: {g.get("error")}')
|
||||||
|
time.sleep(interval)
|
||||||
|
raise VaniError(504, 'generation timeout')
|
||||||
|
|
||||||
|
def get_attachment(acc, att_id):
|
||||||
|
return acc.req('GET', f'/api/chat/attachments/{att_id}/url', raw=True, timeout=300)
|
||||||
|
|
||||||
|
def register_media(gid, email, att_id, kind):
|
||||||
|
POOL.state['media'][gid] = {'email': email, 'att': att_id, 'kind': kind, 'ts': time.time()}
|
||||||
|
POOL.save_state()
|
||||||
|
|
||||||
|
def account_by_email(email):
|
||||||
|
for a in POOL.accounts:
|
||||||
|
if a.email == email:
|
||||||
|
return a
|
||||||
|
return None
|
||||||
|
|
||||||
|
# ---------------- features ----------------
|
||||||
|
|
||||||
|
def feat_chat(payload):
|
||||||
|
model = resolve_model(payload.get('model'), 'chat')
|
||||||
|
msgs = payload.get('messages') or []
|
||||||
|
stream = bool(payload.get('stream'))
|
||||||
|
vmsgs = [{'role': m.get('role', 'user'), 'content': m.get('content', '')} for m in msgs
|
||||||
|
if isinstance(m.get('content'), str)]
|
||||||
|
if not vmsgs:
|
||||||
|
vmsgs = [{'role': 'user', 'content': 'Hello'}]
|
||||||
|
|
||||||
|
def _run(acc):
|
||||||
|
cid = new_conv(acc, vmsgs[-1]['content'][:60] or 'gw chat')
|
||||||
|
body = {'model': model, 'tool_execution': 'confirm', 'media_prompt_mode': 'enhance',
|
||||||
|
'conversation_id': cid, 'reasoning_effort': payload.get('reasoning_effort', 'high'),
|
||||||
|
'vani_mode': 'standard', 'messages': vmsgs}
|
||||||
|
resp = acc.req('POST', '/api/chat/stream', body, timeout=600, stream=True)
|
||||||
|
if stream:
|
||||||
|
return ('stream', resp, model)
|
||||||
|
text = []
|
||||||
|
usage = {}
|
||||||
|
for line in resp:
|
||||||
|
line = line.decode('utf-8', 'replace').strip()
|
||||||
|
if not line.startswith('data: '):
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
d = json.loads(line[6:])
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
t = d.get('type')
|
||||||
|
if t == 'content.delta':
|
||||||
|
text.append(d.get('text', ''))
|
||||||
|
elif t == 'usage':
|
||||||
|
usage = {'prompt_tokens': d.get('prompt_tokens', 0),
|
||||||
|
'completion_tokens': d.get('completion_tokens', 0)}
|
||||||
|
acc.weekly_pct = d.get('weekly_used_percent')
|
||||||
|
elif t == 'message.complete':
|
||||||
|
break
|
||||||
|
return ('full', ''.join(text), usage, model)
|
||||||
|
|
||||||
|
return POOL.run(_run)
|
||||||
|
|
||||||
|
def feat_image(payload):
|
||||||
|
prompt = payload.get('prompt', '')
|
||||||
|
if not prompt:
|
||||||
|
raise VaniError(400, 'prompt required')
|
||||||
|
model = resolve_model(payload.get('model'), 'image')
|
||||||
|
variant = payload.get('size') or payload.get('variant') or '1024x1024'
|
||||||
|
n = min(int(payload.get('n', 1)), 4)
|
||||||
|
outs = []
|
||||||
|
for i in range(n):
|
||||||
|
def _run(acc):
|
||||||
|
cid = new_conv(acc, 'gw image')
|
||||||
|
g = create_gen(acc, {'kind': 'image', 'conversation_id': cid, 'model': model,
|
||||||
|
'prompt': prompt, 'variant': variant, 'mode': 'generate'})
|
||||||
|
gid = g['id']
|
||||||
|
g2 = poll_gen(acc, gid, max_wait=300, interval=3)
|
||||||
|
data = get_attachment(acc, g2['attachment_id'])
|
||||||
|
register_media(gid, acc.email, g2['attachment_id'], 'image')
|
||||||
|
return gid, data
|
||||||
|
gid, data = POOL.run(_run)
|
||||||
|
outs.append({'gid': gid, 'data': data})
|
||||||
|
return outs
|
||||||
|
|
||||||
|
def feat_speech(payload):
|
||||||
|
text = payload.get('input') or payload.get('prompt') or ''
|
||||||
|
if not text:
|
||||||
|
raise VaniError(400, 'input required')
|
||||||
|
model = resolve_model(payload.get('model'), 'audio')
|
||||||
|
voice = payload.get('voice') or 'Alex'
|
||||||
|
|
||||||
|
def _run(acc):
|
||||||
|
cid = new_conv(acc, 'gw audio')
|
||||||
|
g = create_gen(acc, {'kind': 'audio', 'conversation_id': cid, 'model': model,
|
||||||
|
'variant': voice, 'prompt': text, 'mode': 'text_to_speech'})
|
||||||
|
g2 = poll_gen(acc, g['id'], max_wait=180, interval=2)
|
||||||
|
data = get_attachment(acc, g2['attachment_id'])
|
||||||
|
register_media(g['id'], acc.email, g2['attachment_id'], 'audio')
|
||||||
|
return g['id'], data
|
||||||
|
return POOL.run(_run)
|
||||||
|
|
||||||
|
def feat_video_create(payload):
|
||||||
|
prompt = payload.get('prompt', '')
|
||||||
|
if not prompt:
|
||||||
|
raise VaniError(400, 'prompt required')
|
||||||
|
model = resolve_model(payload.get('model'), 'video')
|
||||||
|
dur = int(payload.get('duration_secs') or payload.get('duration') or 5)
|
||||||
|
ratio = payload.get('ratio') or payload.get('size') or '16:9'
|
||||||
|
variant = payload.get('variant') or '720p'
|
||||||
|
|
||||||
|
def _run(acc):
|
||||||
|
cid = new_conv(acc, 'gw video')
|
||||||
|
g = create_gen(acc, {'kind': 'video', 'conversation_id': cid, 'model': model,
|
||||||
|
'prompt': prompt, 'duration_secs': dur, 'ratio': ratio,
|
||||||
|
'mode': 'text_to_video', 'variant': variant})
|
||||||
|
POOL.state['media'][g['id']] = {'email': acc.email, 'att': None, 'kind': 'video', 'ts': time.time()}
|
||||||
|
POOL.save_state()
|
||||||
|
return {'id': g['id'], 'status': g['status'], 'model': model, 'conversation_id': cid}
|
||||||
|
return POOL.run(_run)
|
||||||
|
|
||||||
|
def feat_video_status(gid):
|
||||||
|
info = POOL.state['media'].get(gid)
|
||||||
|
if not info:
|
||||||
|
raise VaniError(404, 'unknown video id')
|
||||||
|
acc = account_by_email(info['email'])
|
||||||
|
if not acc:
|
||||||
|
raise VaniError(500, 'owner account gone from pool')
|
||||||
|
with acc.lock:
|
||||||
|
g = acc.req('GET', f'/api/chat/generations/{gid}', timeout=60)
|
||||||
|
st = g.get('status')
|
||||||
|
out = {'id': gid, 'status': st, 'model': g.get('params', {}).get('model')}
|
||||||
|
if st == 'succeeded':
|
||||||
|
info['att'] = g['attachment_id']
|
||||||
|
POOL.save_state()
|
||||||
|
out['url'] = f'/media/{gid}.mp4'
|
||||||
|
if g.get('params'):
|
||||||
|
out['params'] = g['params']
|
||||||
|
elif st in ('failed', 'error'):
|
||||||
|
out['error'] = g.get('error')
|
||||||
|
return out
|
||||||
|
|
||||||
|
def feat_research_create(payload):
|
||||||
|
query = payload.get('query') or payload.get('prompt') or ''
|
||||||
|
if not query:
|
||||||
|
raise VaniError(400, 'query required')
|
||||||
|
|
||||||
|
def _run(acc):
|
||||||
|
cid = new_conv(acc, query[:60])
|
||||||
|
j = acc.req('POST', '/api/chat/research/v2', {'conversation_id': cid, 'query': query})
|
||||||
|
POOL.state['media']['res:' + j['id']] = {'email': acc.email, 'cid': cid, 'kind': 'research', 'ts': time.time()}
|
||||||
|
POOL.save_state()
|
||||||
|
return {'id': j['id'], 'status': j['status'], 'conversation_id': cid}
|
||||||
|
return POOL.run(_run)
|
||||||
|
|
||||||
|
def feat_research_status(jid, fmt='json'):
|
||||||
|
info = POOL.state['media'].get('res:' + jid)
|
||||||
|
if not info:
|
||||||
|
raise VaniError(404, 'unknown research id')
|
||||||
|
acc = account_by_email(info['email'])
|
||||||
|
with acc.lock:
|
||||||
|
j = acc.req('GET', f'/api/chat/research/v2/{jid}', timeout=60)
|
||||||
|
st = j.get('status')
|
||||||
|
# auto-advance
|
||||||
|
try:
|
||||||
|
if st == 'awaiting_approval':
|
||||||
|
j = acc.req('POST', f'/api/chat/research/v2/{jid}/start', {})
|
||||||
|
st = j.get('status')
|
||||||
|
elif st == 'awaiting_answers':
|
||||||
|
j = acc.req('POST', f'/api/chat/research/v2/{jid}/answers', {'skip': True})
|
||||||
|
st = j.get('status')
|
||||||
|
except VaniError:
|
||||||
|
pass
|
||||||
|
out = {'id': jid, 'status': st, 'title': j.get('title'), 'error': j.get('error_code')}
|
||||||
|
if st == 'succeeded' and j.get('artifact_id'):
|
||||||
|
out['artifact_id'] = j['artifact_id']
|
||||||
|
if fmt and fmt != 'json':
|
||||||
|
data = acc.req('GET', f"/api/artifacts/{j['artifact_id']}/export?format={fmt}", raw=True, timeout=120)
|
||||||
|
out['content_type'] = {'md': 'text/markdown', 'html': 'text/html', 'pdf': 'application/pdf',
|
||||||
|
'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
|
'pptx': 'application/vnd.openxmlformats-officedocument.pptx'}.get(fmt, 'application/octet-stream')
|
||||||
|
out['raw'] = data
|
||||||
|
else:
|
||||||
|
art = acc.req('GET', f"/api/artifacts/{j['artifact_id']}", timeout=60)
|
||||||
|
out['report_preview'] = art.get('artifact', {}).get('preview')
|
||||||
|
out['formats'] = art.get('artifact', {}).get('formats')
|
||||||
|
return out
|
||||||
|
|
||||||
|
# ---------------- HTTP server ----------------
|
||||||
|
|
||||||
|
DASH = """<!doctype html><html><head><meta charset="utf-8"><title>VANIGW</title>
|
||||||
|
<style>
|
||||||
|
body{background:#0d1117;color:#c9d1d9;font:14px/1.5 ui-monospace,Consolas,monospace;margin:0;padding:24px}
|
||||||
|
h1{color:#58a6ff;font-size:20px} h2{color:#8b949e;font-size:14px;text-transform:uppercase;margin-top:28px}
|
||||||
|
table{border-collapse:collapse;width:100%;max-width:900px} td,th{border:1px solid #21262d;padding:4px 10px;text-align:left;font-size:13px}
|
||||||
|
th{color:#8b949e} .ok{color:#3fb950}.bad{color:#f85149}.warn{color:#d29922}
|
||||||
|
pre{background:#161b22;border:1px solid #21262d;padding:10px;overflow-x:auto;font-size:12px;max-width:900px}
|
||||||
|
a{color:#58a6ff} .foot{margin-top:40px;color:#484f58;font-size:12px}
|
||||||
|
</style></head><body>
|
||||||
|
<h1>VANIGW — Vani.ai pool gateway</h1>
|
||||||
|
<div>key: <b>""" + GW_KEY + """</b> · port 8500 · accounts: <b>__NACC__</b> · models: <b>__NMOD__</b></div>
|
||||||
|
<h2>Pool</h2><table><tr><th>account</th><th>status</th><th>weekly %</th><th>last err</th></tr>__ROWS__</table>
|
||||||
|
<h2>Quick start</h2>
|
||||||
|
<pre>curl http://127.0.0.1:8500/v1/chat/completions -H "X-Gateway-Key: """ + GW_KEY + """" -H "Content-Type: application/json" \\
|
||||||
|
-d '{"model":"claude-opus-5","messages":[{"role":"user","content":"hi"}]}'
|
||||||
|
|
||||||
|
curl http://127.0.0.1:8500/v1/images/generations -H "X-Gateway-Key: """ + GW_KEY + """" -H "Content-Type: application/json" \\
|
||||||
|
-d '{"prompt":"red cube on white"}' # -> b64_json + /media url
|
||||||
|
|
||||||
|
curl http://127.0.0.1:8500/v1/audio/speech -H "X-Gateway-Key: """ + GW_KEY + """" -H "Content-Type: application/json" \\
|
||||||
|
-d '{"input":"Hello world"}' --output voice.mp3
|
||||||
|
|
||||||
|
curl http://127.0.0.1:8500/v1/videos/generations -H "X-Gateway-Key: """ + GW_KEY + """" -H "Content-Type: application/json" \\
|
||||||
|
-d '{"prompt":"ocean wave at sunset"}' # -> {"id":...}; poll GET /v1/videos/{id}
|
||||||
|
|
||||||
|
curl http://127.0.0.1:8500/v1/research -H "X-Gateway-Key: """ + GW_KEY + """" -H "Content-Type: application/json" \\
|
||||||
|
-d '{"query":"state of LLM inference optimization 2026"}' # poll GET /v1/research/{id}?format=md</pre>
|
||||||
|
<div class="foot">free-tier pool · register more: python vani_reg.py N · <a href="https://t.me/AlStack">t.me/AlStack</a></div>
|
||||||
|
</body></html>"""
|
||||||
|
|
||||||
|
class H(BaseHTTPRequestHandler):
|
||||||
|
protocol_version = 'HTTP/1.1'
|
||||||
|
|
||||||
|
def log_message(self, *a):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _auth(self):
|
||||||
|
k = self.headers.get('X-Gateway-Key') or ''
|
||||||
|
if not k:
|
||||||
|
ah = self.headers.get('Authorization') or ''
|
||||||
|
if ah.startswith('Bearer '):
|
||||||
|
k = ah[7:]
|
||||||
|
return k == GW_KEY
|
||||||
|
|
||||||
|
def _send(self, code, obj, ctype='application/json'):
|
||||||
|
data = obj if isinstance(obj, bytes) else json.dumps(obj, ensure_ascii=False).encode()
|
||||||
|
self.send_response(code)
|
||||||
|
self.send_header('Content-Type', ctype)
|
||||||
|
self.send_header('Content-Length', str(len(data)))
|
||||||
|
self.send_header('Access-Control-Allow-Origin', '*')
|
||||||
|
self.end_headers()
|
||||||
|
try:
|
||||||
|
self.wfile.write(data)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _err(self, code, msg):
|
||||||
|
self._send(code, {'error': {'message': str(msg)[:400], 'code': code}})
|
||||||
|
|
||||||
|
def do_OPTIONS(self):
|
||||||
|
self.send_response(204)
|
||||||
|
self.send_header('Access-Control-Allow-Origin', '*')
|
||||||
|
self.send_header('Access-Control-Allow-Headers', '*')
|
||||||
|
self.send_header('Access-Control-Allow-Methods', '*')
|
||||||
|
self.send_header('Content-Length', '0')
|
||||||
|
self.end_headers()
|
||||||
|
|
||||||
|
def do_GET(self):
|
||||||
|
path = self.path.split('?')[0]
|
||||||
|
qs = self.path.split('?')[1] if '?' in self.path else ''
|
||||||
|
if path == '/':
|
||||||
|
rows = []
|
||||||
|
for a in POOL.accounts:
|
||||||
|
cls = 'bad' if a.dead else ('warn' if a.exhausted else 'ok')
|
||||||
|
st = 'dead' if a.dead else ('weekly-limit' if a.exhausted else 'live')
|
||||||
|
rows.append(f'<tr><td>{a.email}</td><td class="{cls}">{st}</td><td>{a.weekly_pct if a.weekly_pct is not None else "?"}</td><td>{a.last_err[:60]}</td></tr>')
|
||||||
|
slugs = fetch_catalog()
|
||||||
|
html = DASH.replace('__ROWS__', ''.join(rows)).replace('__NACC__', str(len(POOL.accounts))).replace('__NMOD__', str(len(slugs)))
|
||||||
|
return self._send(200, html.encode(), 'text/html; charset=utf-8')
|
||||||
|
if not self._auth():
|
||||||
|
return self._err(401, 'bad key')
|
||||||
|
if path == '/health':
|
||||||
|
live = [a for a in POOL.accounts if not a.dead and not a.exhausted]
|
||||||
|
return self._send(200, {'status': 'ok', 'accounts': len(POOL.accounts), 'live': len(live), 'models': len(fetch_catalog())})
|
||||||
|
if path == '/v1/models':
|
||||||
|
slugs = fetch_catalog()
|
||||||
|
return self._send(200, {'object': 'list', 'data': [{'id': s, 'object': 'model'} for s in slugs]})
|
||||||
|
if path.startswith('/v1/videos/'):
|
||||||
|
gid = path.rsplit('/', 1)[1].replace('.mp4', '')
|
||||||
|
try:
|
||||||
|
return self._send(200, feat_video_status(gid))
|
||||||
|
except VaniError as e:
|
||||||
|
return self._err(e.code, e.msg)
|
||||||
|
if path.startswith('/v1/research/'):
|
||||||
|
jid = path.rsplit('/', 1)[1]
|
||||||
|
fmt = 'md'
|
||||||
|
for kv in qs.split('&'):
|
||||||
|
if kv.startswith('format='):
|
||||||
|
fmt = kv[7:]
|
||||||
|
try:
|
||||||
|
out = feat_research_status(jid, fmt if fmt != 'json' else 'json')
|
||||||
|
if 'raw' in out:
|
||||||
|
return self._send(200, out.pop('raw'), out.pop('content_type'))
|
||||||
|
return self._send(200, out)
|
||||||
|
except VaniError as e:
|
||||||
|
return self._err(e.code, e.msg)
|
||||||
|
if path.startswith('/media/'):
|
||||||
|
token = path[len('/media/'):]
|
||||||
|
gid = token.split('.')[0]
|
||||||
|
info = POOL.state['media'].get(gid)
|
||||||
|
if not info or not info.get('att'):
|
||||||
|
return self._err(404, 'media not ready')
|
||||||
|
acc = account_by_email(info['email'])
|
||||||
|
if not acc:
|
||||||
|
return self._err(500, 'owner gone')
|
||||||
|
try:
|
||||||
|
with acc.lock:
|
||||||
|
data = get_attachment(acc, info['att'])
|
||||||
|
ct = {'image': 'image/png', 'video': 'video/mp4', 'audio': 'audio/mpeg'}.get(info['kind'], 'application/octet-stream')
|
||||||
|
return self._send(200, data, ct)
|
||||||
|
except Exception as e:
|
||||||
|
return self._err(502, str(e)[:200])
|
||||||
|
return self._err(404, 'not found')
|
||||||
|
|
||||||
|
def do_POST(self):
|
||||||
|
path = self.path.split('?')[0]
|
||||||
|
if not self._auth():
|
||||||
|
return self._err(401, 'bad key')
|
||||||
|
try:
|
||||||
|
n = int(self.headers.get('Content-Length') or 0)
|
||||||
|
payload = json.loads(self.rfile.read(n) or b'{}')
|
||||||
|
except Exception:
|
||||||
|
return self._err(400, 'bad json')
|
||||||
|
try:
|
||||||
|
if path == '/v1/chat/completions':
|
||||||
|
res = feat_chat(payload)
|
||||||
|
if res[0] == 'stream':
|
||||||
|
_, resp, model = res
|
||||||
|
self.send_response(200)
|
||||||
|
self.send_header('Content-Type', 'text/event-stream')
|
||||||
|
self.send_header('Cache-Control', 'no-cache')
|
||||||
|
self.send_header('Access-Control-Allow-Origin', '*')
|
||||||
|
self.send_header('Transfer-Encoding', 'chunked')
|
||||||
|
self.end_headers()
|
||||||
|
cid = 'chatcmpl-' + uuid.uuid4().hex[:24]
|
||||||
|
def chunk(s):
|
||||||
|
b = s.encode()
|
||||||
|
self.wfile.write(f'{len(b):x}\r\n'.encode() + b + b'\r\n')
|
||||||
|
try:
|
||||||
|
for line in resp:
|
||||||
|
line = line.decode('utf-8', 'replace').strip()
|
||||||
|
if not line.startswith('data: '):
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
d = json.loads(line[6:])
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
t = d.get('type')
|
||||||
|
if t == 'content.delta':
|
||||||
|
chunk('data: ' + json.dumps({'id': cid, 'object': 'chat.completion.chunk', 'model': model,
|
||||||
|
'choices': [{'index': 0, 'delta': {'content': d.get('text', '')}, 'finish_reason': None}]}) + '\n\n')
|
||||||
|
elif t == 'message.complete':
|
||||||
|
chunk('data: ' + json.dumps({'id': cid, 'object': 'chat.completion.chunk', 'model': model,
|
||||||
|
'choices': [{'index': 0, 'delta': {}, 'finish_reason': 'stop'}]}) + '\n\n')
|
||||||
|
break
|
||||||
|
chunk('data: [DONE]\n\n')
|
||||||
|
self.wfile.write(b'0\r\n\r\n')
|
||||||
|
except Exception:
|
||||||
|
try:
|
||||||
|
self.wfile.write(b'0\r\n\r\n')
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return
|
||||||
|
_, text, usage, model = res
|
||||||
|
return self._send(200, {
|
||||||
|
'id': 'chatcmpl-' + uuid.uuid4().hex[:24], 'object': 'chat.completion', 'model': model,
|
||||||
|
'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': text}, 'finish_reason': 'stop'}],
|
||||||
|
'usage': {'prompt_tokens': usage.get('prompt_tokens', 0), 'completion_tokens': usage.get('completion_tokens', 0),
|
||||||
|
'total_tokens': usage.get('prompt_tokens', 0) + usage.get('completion_tokens', 0)}})
|
||||||
|
if path == '/v1/images/generations':
|
||||||
|
outs = feat_image(payload)
|
||||||
|
data = [{'b64_json': base64.b64encode(o['data']).decode(), 'url': f'/media/{o["gid"]}.png'} for o in outs]
|
||||||
|
return self._send(200, {'created': int(time.time()), 'data': data})
|
||||||
|
if path == '/v1/audio/speech':
|
||||||
|
gid, data = feat_speech(payload)
|
||||||
|
return self._send(200, data, 'audio/mpeg')
|
||||||
|
if path == '/v1/videos/generations':
|
||||||
|
return self._send(200, feat_video_create(payload))
|
||||||
|
if path == '/v1/research':
|
||||||
|
return self._send(200, feat_research_create(payload))
|
||||||
|
return self._err(404, 'not found')
|
||||||
|
except VaniError as e:
|
||||||
|
return self._err(e.code, e.msg)
|
||||||
|
except Exception as e:
|
||||||
|
return self._err(500, f'{type(e).__name__}: {e}')
|
||||||
|
|
||||||
|
def main():
|
||||||
|
print(f'[vanigw] pool: {len(POOL.accounts)} accounts '
|
||||||
|
f'({sum(1 for a in POOL.accounts if not a.dead and not a.exhausted)} live)')
|
||||||
|
print(f'[vanigw] catalog: {len(fetch_catalog())} models')
|
||||||
|
srv = ThreadingHTTPServer(('127.0.0.1', PORT), H)
|
||||||
|
srv.daemon_threads = True
|
||||||
|
print(f'[vanigw] listening on 127.0.0.1:{PORT}')
|
||||||
|
srv.serve_forever()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""Extract Supabase auth tokens from vani_accounts.jsonl -> vani_pool.json
|
||||||
|
Pool entry: {email, access_token, refresh_token?, expires_at, ok}
|
||||||
|
sb-<ref>-auth-token = access JWT (или base64 "token,refresh" split)
|
||||||
|
"""
|
||||||
|
import json, base64, time, sys, os
|
||||||
|
sys.stdout.reconfigure(encoding='utf-8')
|
||||||
|
|
||||||
|
SRC = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'vani_accounts.jsonl')
|
||||||
|
OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'vani_pool.json')
|
||||||
|
|
||||||
|
def b64d(s):
|
||||||
|
s = s.replace('base64-', '')
|
||||||
|
pad = '=' * (-len(s) % 4)
|
||||||
|
try:
|
||||||
|
return base64.urlsafe_b64decode(s + pad).decode('utf-8', 'replace')
|
||||||
|
except Exception:
|
||||||
|
return None
|
||||||
|
|
||||||
|
pool = []
|
||||||
|
for line in open(SRC, encoding='utf-8'):
|
||||||
|
rec = json.loads(line)
|
||||||
|
if not rec.get('ok'):
|
||||||
|
continue
|
||||||
|
email = rec['email']
|
||||||
|
cks = rec.get('cookies') or []
|
||||||
|
if isinstance(cks, str):
|
||||||
|
continue
|
||||||
|
tok = None
|
||||||
|
for c in cks:
|
||||||
|
if c['name'].startswith('sb-') and c['name'].endswith('-auth-token'):
|
||||||
|
tok = c['value']
|
||||||
|
break
|
||||||
|
if not tok:
|
||||||
|
continue
|
||||||
|
raw = b64d(tok) if tok.startswith('base64-') else tok
|
||||||
|
if raw is None:
|
||||||
|
continue
|
||||||
|
# формат: "<jwt>,<refresh>" или чистый jwt
|
||||||
|
parts = raw.split(',')
|
||||||
|
jwt = parts[0]
|
||||||
|
refresh = parts[1] if len(parts) > 1 else None
|
||||||
|
exp = None
|
||||||
|
sub = None
|
||||||
|
try:
|
||||||
|
payload = jwt.split('.')[1]
|
||||||
|
d = json.loads(b64d(payload) or '{}')
|
||||||
|
exp = d.get('exp')
|
||||||
|
sub = d.get('sub')
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
pool.append({
|
||||||
|
'email': email,
|
||||||
|
'access_token': jwt,
|
||||||
|
'refresh_token': refresh,
|
||||||
|
'sub': sub,
|
||||||
|
'expires_at': exp,
|
||||||
|
'expires_in_h': round((exp - time.time()) / 3600, 1) if exp else None,
|
||||||
|
'ts': rec['ts'],
|
||||||
|
})
|
||||||
|
|
||||||
|
json.dump(pool, open(OUT, 'w', encoding='utf-8'), indent=1)
|
||||||
|
print(f'pool: {len(pool)} entries -> {OUT}')
|
||||||
|
for p in pool:
|
||||||
|
print(f" {p['email']:38} exp_in={p['expires_in_h']}h refresh={'Y' if p['refresh_token'] else 'N'}")
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# register/ only — gateway is stdlib-only (Python 3.11+)
|
||||||
|
requests
|
||||||
|
cloakbrowser
|
||||||
@@ -0,0 +1,231 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""Vani.ai autoreg — cloakbrowser native turnstile + voidash/t-online email
|
||||||
|
Flow: /login?next=/chat -> email + native TS token -> Check your email -> code/link -> session
|
||||||
|
"""
|
||||||
|
import sys, re, json, time, random, string, os
|
||||||
|
import requests
|
||||||
|
|
||||||
|
sys.stdout.reconfigure(encoding='utf-8')
|
||||||
|
BASE = 'https://c.vani.ai'
|
||||||
|
LOGIN = BASE + '/login?next=%2Fchat'
|
||||||
|
OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'vani_accounts.jsonl')
|
||||||
|
VOID = 'https://api.voidash.com/api/v1'
|
||||||
|
IMAP_POOL = os.environ.get('VANI_IMAP_POOL', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'working_mails.txt')) # optional t-online pool (email:pass lines)
|
||||||
|
|
||||||
|
r = lambda n: ''.join(random.choices(string.ascii_lowercase + string.digits, k=n))
|
||||||
|
|
||||||
|
def make_voidash():
|
||||||
|
d = requests.post(VOID + '/inboxes', json={'domain': 'voidash.bond'}, timeout=30).json()
|
||||||
|
return ('voidash', d['address'], d['session_key'])
|
||||||
|
|
||||||
|
def load_tonline(n=1):
|
||||||
|
used = set()
|
||||||
|
if os.path.exists('used_emails.txt'):
|
||||||
|
used = set(l.strip() for l in open('used_emails.txt') if l.strip())
|
||||||
|
out = []
|
||||||
|
for line in open(IMAP_POOL, encoding='utf-8'):
|
||||||
|
line = line.strip()
|
||||||
|
if ':' not in line or line.startswith('#'):
|
||||||
|
continue
|
||||||
|
em, pw = line.split(':', 1)
|
||||||
|
if '-' in em.split('@')[0] or em in used: # dash-алиасы мертвы
|
||||||
|
continue
|
||||||
|
out.append(('t-online', em, pw))
|
||||||
|
if len(out) >= n:
|
||||||
|
break
|
||||||
|
return out
|
||||||
|
|
||||||
|
def poll_voidash(key, timeout=240):
|
||||||
|
t0 = time.time()
|
||||||
|
while time.time() - t0 < timeout:
|
||||||
|
try:
|
||||||
|
msgs = requests.get(VOID + '/messages', headers={'Authorization': 'Bea' + 'rer ' + key}, timeout=30).json()
|
||||||
|
items = msgs if isinstance(msgs, list) else msgs.get('messages', msgs.get('data', []))
|
||||||
|
for m in items:
|
||||||
|
body = json.dumps(m, ensure_ascii=False)
|
||||||
|
if 'vani' in body.lower():
|
||||||
|
return body
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
time.sleep(5)
|
||||||
|
return None
|
||||||
|
|
||||||
|
def poll_imap_tonline(email, pw, timeout=240):
|
||||||
|
import imaplib, email as emlib
|
||||||
|
t0 = time.time()
|
||||||
|
while time.time() - t0 < timeout:
|
||||||
|
try:
|
||||||
|
M = imaplib.IMAP4_SSL('secureimap.t-online.de', 993)
|
||||||
|
M.login(email, pw)
|
||||||
|
M.select('INBOX')
|
||||||
|
typ, data = M.search(None, '(SUBJECT "Vani")')
|
||||||
|
ids = data[0].split()
|
||||||
|
if not ids:
|
||||||
|
typ, data = M.search(None, 'ALL')
|
||||||
|
ids = data[0].split()[-5:]
|
||||||
|
for i in ids[-5:]:
|
||||||
|
typ, md = M.fetch(i, '(RFC822)')
|
||||||
|
msg = emlib.message_from_bytes(md[0][1])
|
||||||
|
frm = str(msg.get('From', ''))
|
||||||
|
if 'vani' not in frm.lower():
|
||||||
|
continue
|
||||||
|
body = ''
|
||||||
|
if msg.is_multipart():
|
||||||
|
for part in msg.walk():
|
||||||
|
if part.get_content_type() == 'text/html':
|
||||||
|
body = part.get_payload(decode=True).decode('utf-8', 'replace')
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
body = msg.get_payload(decode=True).decode('utf-8', 'replace')
|
||||||
|
M.logout()
|
||||||
|
return json.dumps({'from': frm, 'subject': str(msg.get('Subject')), 'body': body}, ensure_ascii=False)
|
||||||
|
M.logout()
|
||||||
|
except Exception as e:
|
||||||
|
print(' imap retry:', str(e)[:80])
|
||||||
|
time.sleep(8)
|
||||||
|
return None
|
||||||
|
|
||||||
|
def extract_code_link(mailjson):
|
||||||
|
code = None
|
||||||
|
link = None
|
||||||
|
lk = re.search(r'https://c\.vani\.ai/[^\s"\\<]+', mailjson)
|
||||||
|
if lk:
|
||||||
|
link = lk.group(0).replace('\\u0026', '&').replace('\\/', '/').replace('\\u003d', '=')
|
||||||
|
# 6-digit code — в тексте, часто крупным шрифтом; ищем изолированные 6 цифр
|
||||||
|
for m in re.finditer(r'(?:code[^0-9]{0,40}|>)\s*([0-9]{6})\s*(?:<|$|[^0-9])', mailjson, re.I):
|
||||||
|
code = m.group(1)
|
||||||
|
break
|
||||||
|
if not code:
|
||||||
|
m = re.search(r'\b(\d{6})\b', re.sub(r'https?://\S+', '', mailjson))
|
||||||
|
if m:
|
||||||
|
code = m.group(1)
|
||||||
|
return code, link
|
||||||
|
|
||||||
|
def run(n, provider='voidash'):
|
||||||
|
import cloakbrowser
|
||||||
|
okc = 0
|
||||||
|
for i in range(n):
|
||||||
|
res = {'ok': False, 'ts': int(time.time()), 'provider': provider}
|
||||||
|
b = None
|
||||||
|
try:
|
||||||
|
if provider == 'voidash':
|
||||||
|
kind, emailaddr, cred = make_voidash()
|
||||||
|
else:
|
||||||
|
kind, emailaddr, cred = load_tonline(1)[0]
|
||||||
|
res['email'] = emailaddr
|
||||||
|
print(f'[{i}] email={emailaddr}')
|
||||||
|
b = cloakbrowser.launch(headless=True)
|
||||||
|
pg = b.new_page()
|
||||||
|
pg.goto(LOGIN, wait_until='domcontentloaded', timeout=60000)
|
||||||
|
pg.wait_for_selector('input[type=email]', timeout=25000)
|
||||||
|
pg.wait_for_timeout(2000)
|
||||||
|
# cookie banner accept
|
||||||
|
try:
|
||||||
|
btn = pg.evaluate("""() => { const b=[...document.querySelectorAll('button')].find(e=>(e.innerText||'').trim()==='Accept'); if(b){b.click();return 1;} return 0; }""")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
pg.fill('input[type=email]', emailaddr)
|
||||||
|
# ждём нативный turnstile токен в hidden input
|
||||||
|
tok = None
|
||||||
|
for _ in range(50):
|
||||||
|
v = pg.evaluate("() => document.querySelector('input[name=turnstile_token]')?.value?.length || 0")
|
||||||
|
if v and v > 50:
|
||||||
|
tok = v
|
||||||
|
break
|
||||||
|
pg.wait_for_timeout(2500)
|
||||||
|
res['ts_token_len'] = tok or 0
|
||||||
|
if not tok:
|
||||||
|
res['err'] = 'turnstile token timeout'
|
||||||
|
print(' TS timeout')
|
||||||
|
raise StopIteration
|
||||||
|
pg.wait_for_timeout(1000)
|
||||||
|
pg.evaluate("() => { const b=[...document.querySelectorAll('button')].find(e=>(e.innerText||'').includes('Email me a sign-in')); b.click(); }")
|
||||||
|
pg.wait_for_timeout(9000)
|
||||||
|
body = re.sub(r'\s+', ' ', pg.evaluate('() => document.body.innerText'))[:400]
|
||||||
|
res['after_submit'] = body
|
||||||
|
if 'Check your email' not in body and 'code' not in body.lower():
|
||||||
|
res['err'] = 'no confirmation: ' + body[:200]
|
||||||
|
print(' FAIL submit:', body[:150])
|
||||||
|
raise StopIteration
|
||||||
|
print(' confirmation OK, polling mail...')
|
||||||
|
mail = poll_voidash(cred, 240) if provider == 'voidash' else poll_imap_tonline(emailaddr, cred, 240)
|
||||||
|
if not mail:
|
||||||
|
res['err'] = 'no email'
|
||||||
|
raise StopIteration
|
||||||
|
open(f'mail_{i}.json', 'w', encoding='utf-8').write(mail)
|
||||||
|
code, link = extract_code_link(mail)
|
||||||
|
res['code'] = code
|
||||||
|
res['link'] = (link or '')[:140]
|
||||||
|
print(f' code={code} link={(link or "")[:80]}')
|
||||||
|
verified = False
|
||||||
|
if code:
|
||||||
|
# ввод кода на странице
|
||||||
|
try:
|
||||||
|
inputs = pg.evaluate("() => [...document.querySelectorAll('input')].map(e=>({t:e.type,n:e.name,ml:e.maxLength}))")
|
||||||
|
res['code_inputs'] = inputs
|
||||||
|
filled = False
|
||||||
|
for idx, inp in enumerate(inputs):
|
||||||
|
if inp.get('ml') == 6 or (inp.get('t') == 'text' and inp.get('n', '').lower().find('code') > -1):
|
||||||
|
sel = f"input >> nth={idx}"
|
||||||
|
pg.fill(sel, code)
|
||||||
|
filled = True
|
||||||
|
break
|
||||||
|
if not filled:
|
||||||
|
# OTP-style раздельные боксы
|
||||||
|
boxes = pg.query_selector_all("input[maxlength='1']")
|
||||||
|
if len(boxes) >= 6:
|
||||||
|
for j, ch in enumerate(code):
|
||||||
|
boxes[j].fill(ch)
|
||||||
|
filled = True
|
||||||
|
if filled:
|
||||||
|
pg.wait_for_timeout(2000)
|
||||||
|
pg.evaluate("() => { const b=[...document.querySelectorAll('button')].find(e=>/verify|continue|sign in|submit/i.test(e.innerText||'')); if(b) b.click(); }")
|
||||||
|
pg.wait_for_timeout(8000)
|
||||||
|
except Exception as e:
|
||||||
|
res['code_err'] = str(e)[:120]
|
||||||
|
body2 = re.sub(r'\s+', ' ', pg.evaluate('() => document.body.innerText'))[:300]
|
||||||
|
res['after_code'] = body2
|
||||||
|
if pg.url.rstrip('/').endswith('chat') or 'chat' in pg.url or 'welcome' in body2.lower() or 'new chat' in body2.lower():
|
||||||
|
verified = True
|
||||||
|
if not verified and link:
|
||||||
|
pg.goto(link, wait_until='domcontentloaded', timeout=60000)
|
||||||
|
pg.wait_for_timeout(8000)
|
||||||
|
body3 = re.sub(r'\s+', ' ', pg.evaluate('() => document.body.innerText'))[:300]
|
||||||
|
res['after_link'] = body3
|
||||||
|
res['final_url'] = pg.url
|
||||||
|
if '/login' not in pg.url:
|
||||||
|
verified = True
|
||||||
|
if verified:
|
||||||
|
cks = pg.context.cookies() if hasattr(pg, 'context') else pg.evaluate('() => document.cookie')
|
||||||
|
res['cookies'] = cks if isinstance(cks, list) else str(cks)[:500]
|
||||||
|
res['final_url'] = pg.url
|
||||||
|
res['ok'] = True
|
||||||
|
okc += 1
|
||||||
|
print(f' [{i}] OK verified, url={pg.url}')
|
||||||
|
else:
|
||||||
|
res['err'] = res.get('err') or 'not verified'
|
||||||
|
pg.screenshot(path=f'fail_{i}.png')
|
||||||
|
print(f' [{i}] FAIL: {res.get("err")}')
|
||||||
|
except StopIteration:
|
||||||
|
pass
|
||||||
|
except Exception as e:
|
||||||
|
res['err'] = str(e)[:200]
|
||||||
|
print(f' [{i}] EXC: {str(e)[:150]}')
|
||||||
|
finally:
|
||||||
|
if b:
|
||||||
|
try:
|
||||||
|
b.close()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
with open(OUT, 'a', encoding='utf-8') as f:
|
||||||
|
f.write(json.dumps(res, ensure_ascii=False) + '\n')
|
||||||
|
if res.get('email'):
|
||||||
|
with open('used_emails.txt', 'a') as f:
|
||||||
|
f.write(res['email'] + '\n')
|
||||||
|
time.sleep(random.randint(5, 12))
|
||||||
|
print(f'DONE ok={okc}/{n}')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
n = int(sys.argv[1]) if len(sys.argv) > 1 else 1
|
||||||
|
provider = sys.argv[2] if len(sys.argv) > 2 else 'voidash'
|
||||||
|
run(n, provider)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
cloakbrowser
|
||||||
|
requests
|
||||||
|
# cloakbrowser pulls a patched Firefox; run `cloakbrowser fetch` once if prompted.
|
||||||
Reference in New Issue
Block a user