diff --git a/inference-coop/README.md b/inference-coop/README.md index de52e1a..893a337 100644 --- a/inference-coop/README.md +++ b/inference-coop/README.md @@ -37,22 +37,60 @@ The backend that loads and serves open models via an OpenAI-compatible API. ### Recommendation -**Start with Ollama, migrate to vLLM at scale.** Ollama is available as a Cloudron app (one-click install), handles model management, and exposes an OpenAI-compatible API. For <10 concurrent users, Ollama is sufficient. When usage grows, swap the backend to vLLM behind the same Open WebUI frontend — the API contract is identical. +**Two paths to consider — and Tinfoil changes the calculus:** -**The Ollama → vLLM migration is straightforward:** -1. Both expose the same OpenAI-compatible `/v1/chat/completions` endpoint -2. Open WebUI just needs the base URL changed from the Ollama endpoint to the vLLM endpoint -3. No data migration needed — models are stateless, conversation history lives in Open WebUI's database -4. The only real work is deploying vLLM (Docker container with GPU config) and updating one config value in Open WebUI +**Path A: Self-hosted Ollama → vLLM (original plan)** +- Start with Ollama (Cloudron app), migrate to vLLM at scale +- Full control over model selection, no per-token costs for self-hosted models +- But: no TEE privacy at MVP, and vLLM migration required at scale -**Why not start with vLLM directly?** vLLM is not in the Cloudron app store, so it would need to be run as a standalone Docker container outside Cloudron's management — losing SSO integration, automatic updates, and the security sandboxing that Cloudron provides. For the MVP with 5-10 user-testers, Ollama's throughput is sufficient and the Cloudron integration is worth more than multi-tenant performance you won't use yet. +**Path B: Tinfoil Inference API from day one (new option)** +- OpenAI-compatible API — drop-in for Open WebUI and LobeChat +- TEE-protected inference from the start — verifiable privacy, no pinky promises +- No GPU hosting, no model management, no Cloudron GPU app needed +- Pay-as-you-go per token (see pricing below) +- Open-source, SOC 2 compliant, audited by Trail of Bits +- Used by Duck.ai, UC Berkeley, Stanford, Red Hat -**When to migrate:** When concurrent users exceed ~10-15 or when you need to serve larger models (70B+) where Ollama's throughput becomes a bottleneck. At that point, deploy vLLM as a Docker container (either on the same server or a dedicated GPU instance) and point Open WebUI at it. +**Tinfoil model lineup and pricing (as of Aug 2026):** -- vLLM: [https://vllm.ai/](https://vllm.ai/) — "The High-Throughput and Memory-Efficient inference and serving engine for LLMs" -- Ollama: [https://ollama.com/](https://ollama.com/) -- vLLM production deployment guide: [Spheron (2026)](https://www.spheron.network/blog/vllm-production-deployment-2026/) -- vLLM vs Ollama comparison: [Codersera (2026)](https://codersera.com/blog/vllm-vs-ollama-vs-lm-studio-production-2026/) +| Model | Context | Parameters | Input $/M tok | Output $/M tok | +|-------|---------|-----------|--------------|---------------| +| DeepSeek V4 Flash | 1M | 304B (MoE) | $0.30 | $0.70 | +| GPT-OSS 120B | 131k | 117B (5.1B active) | $0.15 | $0.60 | +| Gemma 4 31B | 256k | 31B | $0.40 | $1.00 | +| Llama 3.3 70B | 128k | 70B | $1.75 | $2.75 | +| GLM-5.2 | 384k | 754B (40B active) | $1.50 | $5.25 | +| Kimi K3 | 256k | 2.8T (MoE) | $4.00 | $20.00 | +| Nomic Embed Text | 8k | 137M | $0.05 | $0 | +| Whisper Large V3 Turbo | 30s audio | 809M | $0.01/request | | + +Source: [Tinfoil models page](https://tinfoil.sh/models) + +**Cost comparison for 10 members, ~20 queries/day:** +- Path A (self-hosted): €36-66/month fixed (VPS + Cloudron + OpenRouter for frontier) +- Path B (Tinfoil): ~$15-30/month variable (at GPT-OSS 120B rates, ~500K tokens/day for 10 users) + €15/month Cloudron for chat frontend/governance/SSO. No GPU server needed. + +**The hybrid approach (recommended):** + +Use **both** — Tinfoil as the default inference backend, with self-hosted Ollama for lightweight models when cost or latency matters: + +1. **Tinfoil API** for all models — gives TEE privacy from day one, no GPU management +2. **Ollama (Cloudron)** as an optional backend for small models (7B range) when members want zero per-token cost and are OK without TEE +3. **OpenRouter** as fallback for models Tinfoil doesn't offer yet (e.g. Claude, GPT) + +Open WebUI and LobeChat both support multiple OpenAI-compatible endpoints — members can choose which backend serves their request. The cooperative's middleware routes and meters usage across all three. + +This means the MVP launches with **verifiable privacy (TEE) from day one** without any GPU hosting or TEE configuration — Tinfoil handles the hard part. The cooperative's infrastructure is just Cloudron (for chat, governance, SSO) + a thin middleware for billing/access control + Tinfoil's API. + +**When to add self-hosted inference:** When per-token costs exceed the cost of renting GPU hardware (probably at 50+ active members), add self-hosted vLLM on H100 GPUs with Confidential Computing enabled for the most-used models. Use Tinfoil's open-source framework ([GitHub](https://github.com/tinfoilsh)) as reference for TEE deployment. + +- Tinfoil: [https://tinfoil.sh/](https://tinfoil.sh/) +- Tinfoil models: [https://tinfoil.sh/models](https://tinfoil.sh/models) +- Tinfoil GitHub: [https://github.com/tinfoilsh](https://github.com/tinfoilsh) +- Tinfoil docs: [https://docs.tinfoil.sh/](https://docs.tinfoil.sh/) +- Tinfoil JS SDK: [https://github.com/tinfoilsh/tinfoil-js](https://github.com/tinfoilsh/tinfoil-js) — OpenAI-compatible, encrypts requests with HPKE +- Duck.ai uses Tinfoil: [DuckDuckGo help](https://duckduckgo.com/duckduckgo-help-pages/duckai) ### Model selection @@ -453,16 +491,21 @@ The cooperative's structural advantage is that it *can* deploy TEEs and offer ve ## Cost estimate (MVP, 5-10 user-testers) +**Hybrid approach (Tinfoil + Cloudron + optional Ollama):** + | Component | Monthly cost | Notes | |-----------|-------------|-------| -| VPS (Scaleway or Hetzner) | €15-30 | 4-8 vCPU, 8-16GB RAM, modest GPU or CPU-only | -| Cloudron license | €15 | If using Cloudron (free if YunoHost) | -| OpenRouter API (frontier) | €5-20 | Pay-as-you-go, depends on usage | +| VPS (Cloudron host) | €15-20 | 2-4 vCPU, 4-8GB RAM — no GPU needed | +| Cloudron license | €15 | SSO, app management, security sandboxing | +| Tinfoil Inference API | $5-20 | Pay-as-you-go, GPT-OSS 120B at $0.15/$0.60 per M tok | +| OpenRouter (fallback) | $2-5 | For models Tinfoil doesn't offer | | Domain | ~€1 | inference.coop or similar | | Open Collective | 0-5% | Platform fee depends on fiscal host | -| **Total** | **€36-66/month** | | +| **Total** | **~€40-60/month** | No GPU server needed | -At 10 members paying €10/month = €100/month revenue → **surplus of €34-64/month** for reinvestment. +At 10 members paying €10/month = €100/month → **surplus of €40-60/month** for reinvestment. + +*Note: If Tinfoil per-token costs grow with usage, the cooperative can add self-hosted Ollama (free) for lightweight models or rent GPU hardware for vLLM at the break-even point (~50 members).* ---