TachiBot Infra Plan
tachibot-mcp + tachi-ui · researched 2026-07-03 · 51 Sonnet agents, 5 angles, 81-claim pool, 15 load-bearing claims adversarially verified (10 survived, 5 killed & corrected) · gitignored — internal only
- Infra config lives in each app's own repo (Dockerfile, compose,
fly.toml). No separate infra repo, no Terraform/Pulumi/SST at this scale. If IaC ever becomes necessary, OpenTofu is the default. - Host tachi-ui on Fly.io: one machine + volume at
/data+ Litestream backup to S3-compatible storage. Real cost ≈ $5–8/mo. Fixed-cost alternative: Hetzner CX23 (€5.49/mo) + Coolify/Dokploy. Eliminated: Vercel (no SQLite, official KB) and Cloudflare Containers (ephemeral disk → would force a Durable Objects rewrite). - Stay single-node SQLite. Add Litestream for continuous backup; move to Turso embedded replicas ($0 free tier → $4.99/mo) only if managed/multi-region ever matters. Do not touch LiteFS/distributed SQLite.
- Model sourcing for tachibot-mcp (users' own keys): keep the current hybrid. Direct APIs for Perplexity/Grok/OpenAI/Gemini (users get 85–90% provider cache discounts OpenRouter doesn't cleanly expose), OpenRouter for the long tail (Kimi, DeepSeek, GLM, MiniMax, StepFun, Qwen, ERNIE). Ship no gateway dependency in the npm package.
- Future hosted judge API: same hybrid on developer-paid keys, spend caps in app logic. Defer LiteLLM until multi-tenant per-key budgets are genuinely needed (self-hosting it has $100–400/mo + ops hidden costs). Avoid Helicone (maintenance mode after Mintlify acquisition).
- Decided 2026-07-03: host & sell tachi-ui — BYOK + credits hybrid (keep BYOK permanently), extend the existing Hono backend in the tachi-ui repo, prepaid credit packs with app-level metering. Build July, launch August (~$500 total startup cash). See §5.
1 · Where infra lives: in-repo, no IaC
verified Keeping infra config next to application code enables atomic commits across app+infra changes and is the practitioner consensus for small teams; separate infra repos are justified by privilege/audit boundaries that don't exist for a solo developer (Harness, HungryDevOps). PaaS config formats agree: verified fly.toml is designed to sit per-app in the app's own repo (Fly docs); Railway's railway.json/toml works the same way.
Concretely:
tachi-ui/keeps its Dockerfile + afly.toml(orrailway.toml) + optionalcompose.yamlfor local runs.tachibot-mcp/needs no deploy config today — it ships via npm/.mcpb and runs on user machines. When the hosted judge API arrives, it gets its ownfly.tomlin whichever repo hosts that service.- No Terraform/OpenTofu/Pulumi/SST now. The 2026 small-team pattern is Docker (Compose) + a PaaS config file, or Kamal 2 for raw-VPS deploys. The claim "Terraform is explicitly called overkill for this" was killed in verification (source misquoted — the article actually calls Kubernetes overkill), but the practical takeaway stands on the other sources: at 1–2 small apps, a PaaS file is all the IaC you need. If resource count ever grows, pick OpenTofu (MPL license) over Terraform (BSL).
2 · Hosting tachi-ui
Constraint that drives everything: better-sqlite3 writes a file at process.cwd() — the platform must offer a persistent disk (or you rearchitect the data layer).
| Platform | SQLite persistence | Real cost (small, always-on) | Verdict |
|---|---|---|---|
| Fly.io | Volumes ($0.15/GB/mo) verified | Machine (shared-cpu-1x/256MB) ≈ $2.32/mo; volumes billed hourly even when the machine is stopped, plus $0.08/GB/mo for the default 5 retained daily snapshots (since Jan 2026) — all-in volume cost can run 2–5× the raw GB rate. Budget $5–8/mo total. | Primary pick |
| Hetzner VPS + Coolify/Dokploy | Bind-mounted host volume — full control verified | CX23 (4GB) = €5.49/mo (~$6.49) after the June 15 2026 price adjustment (verification corrected the researched "€4–5" figure). You self-manage OS, security, backups. | Fixed-cost / control alternative |
| Railway | Volumes supported; documented pattern is containerized sqld (libSQL server) + volume not price-verified |
Usage-based; not adversarially verified in this research pass. | Convenience alternative |
| Render | Persistent disks exist (docs read, no claim verified) | unverified | Viable, unexamined |
| Vercel | None. Official KB: "SQLite is not supported on Vercel" — Functions (incl. Docker/OCI containers) are stateless and ephemeral with no shared filesystem verified, 0/3 refutes | — | Eliminated |
| Cloudflare | Container disk is fully ephemeral (resets to image on sleep/restart); persistence means rearchitecting onto Durable Objects SQLite — which is solid (GA since Apr 2025, 10GB/object on paid plan) but a rewrite, not a lift-and-shift. Container snapshots still "coming soon". | — | Eliminated for lift-and-shift |
Data layer: single-node + backup, nothing fancier
- verified Turso free tier: 500M row reads/mo, 10M writes/mo, 5GB across 100 DBs; first paid tier $4.99/mo; libSQL embedded replicas give local-disk-speed reads with a durable cloud primary (pricing). The managed escape hatch if self-managed backups ever chafe.
- LiteFS: the researched claim that it's "dead, avoid" was killed — LiteFS Cloud (the managed backup add-on) was sunset Oct 2024, but LiteFS itself is maintained; Fly's own guidance is topology-based: Litestream for single-node, LiteFS for multi-node. tachi-ui is single-node → Litestream to Tigris/R2/S3.
Pre-deploy hardening (found in local recon, do before any deploy)
- Docker CMD currently runs
vite previewfor the SPA — replace with Hono serving the builtdist/statically on one port (drops the second exposed port and a dev-server in production). - DB path is hardcoded to
process.cwd()(src/db/connection.ts:101) — make it env-configurable (DATABASE_PATH=/data/tachi.db) so it lands on the mounted volume. - Ports are inconsistent (Dockerfile EXPOSEs 3005, package.json docker:run maps 3002) — pick one.
3 · Where models come from
3a · tachibot-mcp today (local-first, users' own keys)
Keep the current hybrid — it matches what the research says is optimal.
- Direct APIs for the big four (Perplexity, Grok, OpenAI, Gemini): provider-side prompt caching is the decisive reason — discounts OpenRouter's abstraction doesn't cleanly expose. Verified cache pricing: Grok 4.3 cached input $0.20/1M (~85% off $1.25); GPT-5.5 cached input $0.50/1M (90% off $5.00); Gemini 3.1 Pro cached input $0.20/1M (90% off $2.00). Batch APIs add a stacking 50% where supported.
- OpenRouter for the long tail (Kimi, DeepSeek, GLM, MiniMax, StepFun, Qwen, ERNIE): verified no per-token markup on most models; the real costs are a 5.5% credit-purchase fee (5% crypto) and a 5% BYOK fee waived up to a free monthly quota — OpenRouter's own docs state that quota inconsistently ($25k–$200k/mo list-price inference on the pricing page vs. 1M free BYOK requests/mo in the BYOK docs), so re-check at time of use. One aggregator key for seven providers is worth 5.5% to end users.
- The popular "$500/mo → OpenRouter, $2,000/mo → direct" rule was killed for this project: it's calibrated for a company aggregating spend on one key. TachiBot users each bring their own keys and will never individually hit direct-API tier thresholds — the hybrid is chosen for model access and caching, not spend tiers.
- Ship no gateway. A LiteLLM/Portkey proxy is a second service end users would have to run alongside a stdio MCP server — wrong shape for an npm-distributed local tool. Users who want routing control can point OpenRouter BYOK at their own provider keys.
- Reliability note verified: OpenRouter had two acknowledged outages Feb 17 & 19 2026 (same root cause, 80–90% request failures at peak). TachiBot's architecture already absorbs this — the big four are direct, so an OpenRouter outage degrades only the long-tail tools. Keep it that way; don't consolidate the big four onto OpenRouter.
3b · Future hosted judge API (developer-paid keys)
- Start with the same hybrid on your own keys: direct big four + OpenRouter long tail. Add hard spend caps in app logic from day one.
- Defer a gateway. verified (2/3) LiteLLM is free to self-host but carries $100–400/mo hidden costs (managed Postgres with backups/HA) plus ongoing DevOps — only worth it once you have multi-tenant per-key budgets to enforce. Its virtual-keys/budgets system is the most battle-tested when that day comes; Portkey OSS is the runner-up.
- Managed zero-markup gateways (Vercel AI Gateway, Cloudflare AI Gateway) are only compelling if the service already lives on that platform; Cloudflare's uniquely offers dollar-denominated spend limits and edge caching. search-stage, not adversarially verified
- Avoid Helicone for new dependencies: acquired by Mintlify (announced Mar 2026) and reportedly in maintenance mode. search-stage, not adversarially verified
- Claude via OpenRouter reportedly carries a ~100% markup vs. direct — moot today (TachiBot doesn't call Claude; Claude is the host), but if the judge API ever adds Claude jurors, go direct to Anthropic. search-stage, not adversarially verified
- xAI reportedly offers up to $175/mo in free API credits via data-sharing opt-in — useful for dev/test spend if acceptable. search-stage, not adversarially verified
Verified price sheet (as of 2026-07-03)
| Item | Figure | Status |
|---|---|---|
| OpenRouter platform fee | 0 per-token markup (most models); 5.5% credit-purchase fee; BYOK 5% with free quota (docs inconsistent — recheck) | verified |
| Grok 4.3 direct | $1.25 in / $2.50 out per 1M; cached in $0.20 (~85% off — shallowest of the big three) | verified + corrected |
| GPT-5.5 direct | $5.00 in / $30.00 out per 1M; cached in $0.50 (90% off); batch stacks 50% ($2.50/$15) | triple-checked in verification |
| Gemini 3.1 Pro cached input | $0.20/1M vs $2.00 standard (90% off) | from verification pass |
| Fly.io small app | ≈$2.32/mo machine + $0.15/GB/mo volume + $0.08/GB/mo default snapshots → ~$5–8/mo all-in | verified |
| Hetzner CX23 (4GB) | €5.49/mo (~$6.49) since 2026-06-15 | corrected in verification |
| Turso | Free: 500M reads / 10M writes / 5GB; paid from $4.99/mo | verified |
4 · Phased roadmap
Phase 0 — now, $0
Keep all infra config in-repo. Harden tachi-ui for deployability: Hono serves dist/ (drop vite preview), env-configurable DATABASE_PATH, single port, .env.example. tachibot-mcp: no infra work — npm/.mcpb distribution is the infra.
Phase 1 — first tachi-ui deploy, ~$5–8/mo
Fly.io: fly.toml in the tachi-ui repo, one shared-cpu machine, volume mounted at /data, Litestream sidecar replicating to Tigris/R2. Trim snapshot retention below the default 5 to control the volume-cost multiplier. (If preferring fixed cost + full control: Hetzner CX23 + Coolify, same Dockerfile, bind mount, Coolify's backup job → S3.)
Phase 2 — hosted judge API, when design partners exist
Deploy next to tachi-ui on the same platform, developer-paid keys, hybrid sourcing (direct big four + OpenRouter long tail), spend caps in app logic. Adopt LiteLLM only when multi-tenant per-key budgets are real; revisit Cloudflare AI Gateway if the service moves to Workers. Keep direct-API fallbacks for anything critical, given OpenRouter's Feb 2026 outage record.
5 · Selling it: hosted tachi-ui, credits + BYOK (decided 2026-07-03)
The decision: host and sell tachi-ui as a service. The thinner judge-API wedge (prior council's pick) stays on the shelf as Phase 2 of the roadmap — hosted tachi-ui is the product now, and it can later call the judge API as a pipeline node.
Backend: extend, don't build
tachi-ui already has a backend — the Hono server in src/server/ (16 routes: pipeline execution, AI providers, SSE, tools, MCP). It has zero auth, users/orgs, or billing. The commercial layer goes into the same repo, same server, one deployable — no separate backend repo/service at this scale (consistent with §1's in-repo verdict):
- Auth + organizations (better-auth, or Clerk free to 10k MAU) — the biggest new code surface
- Tenancy: one SQLite file at cwd today → add
org_idto the Drizzle schema, or per-tenant Turso DBs (free tier covers 100 databases — the native fit) - Encrypted per-tenant storage of users' provider keys (the BYOK trust surface)
- Stripe Checkout (one-time credit packs — far less code than metered subscriptions) + per-tenant rate limits
- The §2 Phase-0 hardening in the same pass: Hono serves
dist/, env-varDATABASE_PATH, one port
Tiers — keep BYOK permanently
BYOK and credits are two tiers of one product, not competing options. BYOK costs nothing to keep (it's the current architecture), is the acquisition funnel (fed by tachibot-mcp's ~1,600/mo npm downloads), and insulates the business — a provider limiting your account doesn't touch BYOK users. Removing it would make you sole payment processor for all inference: maximum float + abuse risk.
| Tier | Price | Keys | What it's for | Gross margin |
|---|---|---|---|---|
| Free | $0 | BYOK | Funnel — limited pipelines, community support | — |
| Pro | ~$19/mo per seat | BYOK | Unlimited pipelines, persistence, sharing, teams — the profit backbone | ~95% |
| Credits | Prepaid packs $10/$25/$100 | Yours (developer-paid) | "No keys needed" onboarding + access to the OpenRouter long tail through your account | ~25–40% markup + caching arbitrage |
| Later (≥10 paying teams) | ~2× Pro | Included credit allowance | Bundle priced from real usage data, not guesses | blended |
Mental model: seats are the profit; credits are the onboarding ramp. Credits alone rarely make a solo product profitable early — but they remove the single biggest signup barrier ("go get API keys"), and those users later buy seats.
Credits mechanics (the safe version)
- Prepaid only, never postpaid. Users buy packs, you deduct per request, hard-stop at zero. Their money lands before your provider spend — float shrinks to a $200–500 provider prepay buffer covering the few-day Stripe payout lag.
- Metering is app code, not infrastructure. The Vercel AI SDK returns token usage per call; keep a per-model price table (provider list + markup), write a ledger row, deduct. No LiteLLM/gateway until multi-tenant budgets are real (§3b).
- Margin: 25–40% over provider list is the normal band. Real extra margin is caching — pipelines share big prompt prefixes; you charge full input price, you pay the cached price (90% off on GPT-5.5/Gemini, ~85% on Grok — §3 price sheet). A $25 pack ≈ $6–10 gross after provider costs and Stripe's ~2.9% + 30¢.
- Abuse controls from day one: card required before any credits (or max ~$1 free grant), per-minute spend cap, model allowlist per tier.
Credit-ledger schema sketch (Drizzle)
orgs id · name · plan (free|pro) · created_at
users id · org_id · email · role
provider_keys id · org_id · provider · key_encrypted · created_at // BYOK, encrypt at rest
credit_ledger id · org_id · delta_usd_micros · reason (purchase|usage|grant|refund)
· request_id · model · tokens_in · tokens_out · created_at
// balance = SUM(delta) per org — append-only, never UPDATE
model_prices model · in_usd_per_mtok · out_usd_per_mtok · markup_pct · updated_atAppend-only ledger: balance is a SUM, disputes are auditable, refunds are negative rows. Store micros (integers), never floats.
July → August checklist (salary lands ~August)
July — build, ~$0 cash
Auth + orgs → tenancy (org_id / Turso) → encrypted BYOK key storage → credit ledger + model price table → Stripe Checkout for packs → rate limits. Phase-0 hardening in the same pass. BYOK mode doubles as your dev/test environment throughout.
August — launch, ~$500 total
Provider prepay float $200–500 · Fly.io ~$10/mo · domain ~$12/yr · Turso $0 (free tier) · business registration (PL JDG ≈ 0 zł to open; restructure later if needed). Launch all three tiers at once; the Free/BYOK tier is announced to the existing tachibot-mcp install base.
Sept–Oct — measure, then bundle
Watch which tier converts for 2–3 months. Price the Pro+credits bundle (~2× Pro) from observed usage. Revisit the judge API as a paid pipeline node once hosted tachi-ui has paying teams.
Startup cost summary
| Item | Cost |
|---|---|
| Fly.io machine + volume (or Hetzner CX23 €5.49/mo) | ~$6–8/mo |
| Domain | ~$12/yr |
| Turso | $0 → $4.99/mo |
| Stripe / better-auth / Resend | $0/mo + ~2.9% + 30¢ per charge |
| Provider credit float (credits tier only) | $200–500 one-time buffer |
| Cash to launch | ~$10–15/mo + ~$500 one-time in August |
| Real cost | 4–8 focused solo weeks on the commercial layer — the infrastructure is a rounding error |
6 · Provenance & limitations
Method: 5 Sonnet search agents (one per angle: hosting, infra-config placement, OpenRouter, gateways, direct-API economics + SQLite-on-PaaS) → 81-claim pool → Sonnet triage picked 15 load-bearing claims → each claim attacked by 3 adversarial fact-checkers (currency / primary-source accuracy / context lenses) that fetched primary sources; ≥2 refutes kills. 10 survived, 5 killed. 51 agents, ~1.79M tokens, 311 tool calls, ~8 min.
Limitations: the dedicated deep-read stage failed on a script bug (sandbox lacks the URL constructor; used only for display labels), so the claim pool came from search agents alone — partially compensated by verifiers fetching primary sources directly. Items tagged not adversarially verified come from search-stage summaries (notably: Helicone/Mintlify maintenance mode, Claude's ~100% OpenRouter markup, xAI free credits, Portkey/Vercel/Cloudflare gateway details) — re-verify before acting on those specifically.
Killed claims (what verification caught — read before trusting blog posts on these topics)
Primary sources deep-read during verification
- fly.io/docs/about/pricing · fly.toml reference
- Vercel KB: SQLite · Vercel KB: Docker
- Cloudflare Containers FAQ · DO limits
- OpenRouter pricing · BYOK docs · Feb 2026 outage postmortem
- xAI model pricing · OpenAI pricing · Gemini caching
- Turso pricing · Railway volumes · Render disks
- LiteLLM proxy docs · Harness GitOps repo structure · Hetzner price adjustment