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

Decisions
  1. 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.
  2. 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).
  3. 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.
  4. 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.
  5. 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).
  6. 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:

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).

PlatformSQLite persistenceReal 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

Pre-deploy hardening (found in local recon, do before any deploy)

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.

3b · Future hosted judge API (developer-paid keys)

Verified price sheet (as of 2026-07-03)

ItemFigureStatus
OpenRouter platform fee0 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-inverified
Hetzner CX23 (4GB)€5.49/mo (~$6.49) since 2026-06-15corrected in verification
TursoFree: 500M reads / 10M writes / 5GB; paid from $4.99/moverified

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):

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.

TierPriceKeysWhat it's forGross margin
Free$0BYOKFunnel — limited pipelines, community support
Pro~$19/mo per seatBYOKUnlimited pipelines, persistence, sharing, teams — the profit backbone~95%
CreditsPrepaid packs $10/$25/$100Yours (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× ProIncluded credit allowanceBundle priced from real usage data, not guessesblended

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)

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_at

Append-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

ItemCost
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 cost4–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)
“Cloudflare DO SQLite is 1GB today, ~10GB at GA”wrong: GA happened April 2025; 10GB/object is the current paid-plan limit (1GB is the free plan). The ephemeral-container-disk part was accurate.
“LiteFS is deprecated, everyone steered to Turso/D1”overstated: only LiteFS Cloud was sunset (Oct 2024); LiteFS is maintained and Fly still recommends it for multi-node. Litestream vs LiteFS is a topology choice.
“Terraform explicitly called overkill for small Docker setups”misattribution: the cited article calls Kubernetes overkill and actually recommends Terraform+Compose. The practical takeaway (PaaS file suffices at small scale) stands on other sources.
“Under $500/mo → OpenRouter; over $2k/mo → direct”real thresholds, wrong lens: calibrated for single-company aggregated spend, not BYOK end users; the caching/batch rationale wasn't in the cited sources.
“GPT-5.5 cached input $1.25/1M (75% off)”wrong: $0.50/1M, a 90% discount (confirmed 3×, official pricing page).
Primary sources deep-read during verification