Files

164 lines
6.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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)