🤖AI RepoIndex
AI Architecture Decision Guide

Choose the right AI architecture for your use case

Self-hosted vs public LLM? RAG or agents? We break down every decision so you can build with confidence — not guesswork.

The Decision Framework

Every AI architecture decision can be broken down into four key questions. Answer these and the right stack becomes obvious.

1️⃣

What's your data sensitivity?

High (PHI, PII, trade secrets) → Self-hosted required

Medium (business data) → Hybrid or cloud with BAA

Low (public data) → Any option works

2️⃣

What's your monthly volume?

Low (<1M tokens) → Public API (pay as you go)

Medium (1M-100M tokens) → Hybrid routing

High (>100M tokens) → Self-hosted (amortize GPU)

3️⃣

What's your use case?

Chat / RAG → Local LLMs work great

Agents / Coding → Cloud API (quality matters)

Media Generation → Self-hosted (GPU required anyway)

4️⃣

What's your team size?

Solo / Small (<5) → Simpler = better (cloud or Ollama)

Medium (5-20) → Invest in hybrid setup

Large (20+) → Dedicated ML platform team

Use Cases & Recommended Stacks

Match your use case to proven architecture patterns. Each recommendation is based on real-world deployments.

💬

AI Chat & Conversational

Build chatbots, customer support agents, or internal knowledge assistants.

Recommended Tools

  • Ollama + Open WebUI (self-hosted)
  • OpenAI API (public)
  • Lobe Chat (multi-provider)

Architecture Patterns

Simple Chat
Open WebUI + Ollama
$0 (hardware only)
Multi-Provider Chat
Lobe Chat + API keys
$0.01-0.03/query
Enterprise Chatbot
Dify + GPT-4
$50-500/month
📚

RAG & Document Q&A

Chat with your documents, internal wikis, knowledge bases, or research papers.

Recommended Tools

  • AnythingLLM
  • LlamaIndex
  • Haystack

Architecture Patterns

Personal RAG
AnythingLLM + Ollama
$0 (hardware only)
Team Knowledge Base
Dify + ChromaDB + GPT-4
$100-500/month
Enterprise Search
Haystack + Elasticsearch + Claude
$500+/month
🤖

AI Agents & Automation

Build autonomous agents that can reason, use tools, and complete multi-step tasks.

Recommended Tools

  • CrewAI
  • LangGraph
  • LangChain

Architecture Patterns

Simple Agent
LangChain + OpenAI API
$0.01-0.05/task
Multi-Agent System
CrewAI + GPT-4
$50-200/month
Complex Workflows
LangGraph + Claude
$100-500/month
💻

AI Coding Assistants

AI pair programming, code generation, debugging, and IDE integrations.

Recommended Tools

  • Aider
  • Continue (VS Code)
  • Claude / GPT-4 (API)

Architecture Patterns

Terminal AI
Aider + Claude/GPT-4
$0.01-0.05/query
IDE Assistant
Continue + Ollama (local)
$0 (hardware only)
Full AI Dev
Cursor / Windsurf + Claude
$20/month (Pro)
🎨

Image & Media Generation

Generate images, video, audio, and creative content with AI.

Recommended Tools

  • ComfyUI
  • Stable Diffusion WebUI Forge
  • Fooocus

Architecture Patterns

Local Images
Ollama + Stable Diffusion
$0 (hardware only, needs GPU)
Professional UI
ComfyUI + Flux/SDXL
$0 (hardware + GPU)
Quick & Simple
Fooocus + SDXL
$0 (hardware + GPU)
🎙️

Audio & Transcription

Speech-to-text, text-to-speech, translation, and voice cloning.

Recommended Tools

  • Whisper (OpenAI)
  • VoiceAI
  • F5-TTS

Architecture Patterns

Local Transcription
Whisper (local) + Ollama
$0 (hardware only)
Cloud Transcription
OpenAI Whisper API
$0.006/minute
Full Audio Suite
VoiceAI + F5-TTS
$0 (hardware only)

LLM Comparison: Cloud vs Self-Hosted

The fundamental trade-off: cloud APIs offer best quality and zero setup; self-hosted offers privacy, zero per-token cost, and full control.

OpenAI (GPT-4/4o)

Public API
Cost
$0.01-0.06/1K tokens

Pros

  • + Best reasoning quality
  • + Massive context (128K)
  • + Vision + function calling
  • + Fastest growing ecosystem

Cons

  • - Data leaves your servers
  • - API costs add up
  • - No fine-tuning on latest model
  • - Rate limits
Best For
General-purpose apps, RAG, agents where quality matters most

Anthropic (Claude)

Public API
Cost
$0.003-0.075/1K tokens

Pros

  • + Excellent reasoning
  • + 200K context window
  • + Constitutional AI (safer)
  • + Great at coding

Cons

  • - Data leaves your servers
  • - No multimodal (images limited)
  • - Fewer integrations than OpenAI
  • - Vendor lock-in
Best For
Coding assistants, long-document analysis, safety-critical apps

Llama 3 (Meta)

Self-hosted
Cost
$0 (hardware only)

Pros

  • + Free forever
  • + Full data privacy
  • + Fine-tunable
  • + Hardware flexible
  • + Open license

Cons

  • - Needs GPU (16GB+ VRAM for 70B)
  • - Lower quality than GPT-4
  • - Setup complexity
  • - No vision (yet)
Best For
Privacy-first apps, high-volume workloads, custom fine-tuning

Mistral / Mixtral

Self-hosted
Cost
$0 (hardware only)

Pros

  • + Excellent quality per parameter
  • + Small VRAM requirements
  • + Apache 2.0 license
  • + Fast inference

Cons

  • - Needs GPU for best performance
  • - Smaller ecosystem than Llama
  • - Limited tool use
  • - Less documentation
Best For
Developers who want great quality with modest hardware

DeepSeek / Qwen

Self-hosted
Cost
$0 (hardware only)

Pros

  • + Cutting-edge reasoning
  • + Competitive with GPT-4
  • + Open weights
  • + Multi-lingual

Cons

  • - Larger models need more VRAM
  • - Newer (less battle-tested)
  • - Fewer integrations
  • - Limited ecosystem
Best For
Research, experimentation, cutting-edge applications

Architecture Patterns

Four proven patterns for production AI systems. Each has different trade-offs in cost, complexity, and capability.

Pure Cloud (Public API)

Everything runs via OpenAI/Anthropic API. Fastest to build, data leaves your servers.

[Your App] → [OpenAI API] → [GPT-4 Response]
When to use:

Speed to market, data sensitivity is low, budget available

Recommended tools:
OpenAI SDKAnthropic SDKLangChainVercel AI SDK

Pure Self-Hosted

Run everything locally. Maximum privacy, zero API costs, needs GPU.

[Your App] → [Ollama/LM Studio] → [Local LLM] → [Response]
When to use:

Data sovereignty required, high volume, privacy regulations (HIPAA, GDPR)

Recommended tools:
OllamaOpen WebUIAnythingLLMChromaDB

Hybrid (Cloud + Local)

Use cloud for complex reasoning, local for simple tasks. Best balance.

[Your App] → [Router] → [Local LLM (simple)] / [Cloud API (complex)]
When to use:

Cost optimization, mixed workloads, need both quality and privacy

Recommended tools:
Ollama + OpenAI APILiteLLMLangChain RouterOpen WebUI

Multi-Model Ensemble

Multiple specialized LLMs for different tasks. Most powerful, most complex.

[Your App] → [Task Router] → [GPT-4 (reasoning)] / [Llama (chat)] / [Whisper (audio)]
When to use:

Production systems with diverse needs, cost-sensitive at scale

Recommended tools:
CrewAILangGraphLiteLLMMultiple model backends

Cost Comparison: Cloud vs Self-Hosted

The break-even point depends on your volume. Below ~1M tokens/month, cloud is cheaper. Above it, self-hosted wins.

ScenarioCloud API CostSelf-Hosted CostVerdict
Individual Developer$20-50/month$0 (hardware already owned)Self-hosted wins
Startup (5-10 users)$200-1,000/month$100-300/month (GPU server)Self-hosted at scale
Enterprise (100+ users)$2,000-10,000/month$500-2,000/month (GPU cluster)Self-hosted saves 50-80%
High-Privacy (HIPAA/GDPR)$5,000+/month (enterprise agreements)$1,000-3,000/monthSelf-hosted required

"But what about GPU costs?"

A single NVIDIA RTX 4090 ($1,600) can run 7B-13B models at 30-50 tokens/sec. For 70B models, you'll need an A100 ($10K+) or cloud GPU rental ($1-3/hr). The break-even vs OpenAI occurs at approximately 50M-100M tokens/month.

RTX 4090: 30-50 tok/s (7B-13B)
A100 80GB: 100+ tok/s (70B)
Cloud GPU: $1.50-3.00/hr

Found your architecture?

Browse our full directory of AI tools, compare alternatives, and read honest reviews from practitioners.