How to Host AI Agents 24/7: VPS + API Setup Guide 2026
Running AI agents 24/7 requires a server and a cost-effective API backend. This guide covers the best VPS picks, API tier comparison, and deployment steps using Ollama and LangChain.
Why Host AI Agents on a VPS?
Cloud AI APIs (OpenAI, Anthropic) charge per token. For high-volume agents that run hundreds of calls per minute, the costs add up fast. Self-hosting on a VPS + open-source models cuts costs by 90% while keeping agents running around the clock.
The trade-off: you manage the infrastructure. But with modern tools like Ollama, that complexity is minimal — a few commands to get a production-grade LLM running.
Best VPS for AI Agents (2026)
| Provider | Price | Specs | Best For |
|---|---|---|---|
| RackNerd | $1.99/mo | 1 vCPU / 1GB / 10GB SSD | Dev, testing, lightweight agents |
| RackNerd | $5.99/mo | 2 vCPU / 4GB / 50GB SSD | Best value for 7B models via Ollama |
| Vultr | $6/mo | 1 vCPU / 2GB / 55GB SSD | Production-grade reliability |
| Vultr | $24/mo | 4 vCPU / 8GB / 160GB SSD | 70B models, high-throughput agents |
vpstier.com has full reviews of these VPS providers with performance benchmarks and real-world test results.
AI API Tiers for Agent Backends
| API | Input | Output | Strength | China |
|---|---|---|---|---|
| DeepSeek R1 | ¥1/1M tokens | ¥2/1M tokens | Best cost-performance, strong reasoning | ✅ Direct |
| OpenAI o1 | $15/1M tokens | $60/1M tokens | Function calling, multi-step reasoning | ❌ Proxy |
| OpenRouter | Model + 5.5% | Model + 5.5% | 400+ models, unified access | ✅ Direct |
| Claude 3.7 | $3/1M tokens | $15/1M tokens | 200K context, writing quality | ❌ Proxy |
| FreeModel | Free credits | Model-dependent | DeepSeek official, direct in China | ✅ Direct |
Compare all AI API providers on APIRank — pricing, features, and China availability in one place.
Recommended Combinations
🟢 Budget Combo: RackNerd + Ollama + DeepSeek
VPS: RackNerd $5.99/mo (2 vCPU / 4GB RAM)
Model: Ollama + DeepSeek-R1-Distill (quantized)
API: DeepSeek API ¥1/1M tokens — nearly free at scale
Total: ~$6/mo for a self-hosted agent capable of complex reasoning
🔵 Production Combo: Vultr + LangChain + OpenAI/Claude
VPS: Vultr $24/mo (4 vCPU / 8GB RAM)
Agent Framework: LangChain or CrewAI
API: OpenAI o1 or Claude 3.7 for reasoning tasks
Total: ~$24/mo + API costs — handles 1000+ agent calls/day
🟣 China-Optimized: Vultr + FreeModel
VPS: Vultr $6/mo or RackNerd $5.99/mo
API: FreeModel.dev — official DeepSeek partner, direct from China
Total: ~$6/mo, no proxy needed, DeepSeek V3 and R1 available
Deploy Ollama on VPS in 5 Steps
Spin up a VPS (Ubuntu 22.04)
Choose RackNerd $5.99 or Vultr $6. Deploy via their dashboard. Note the public IP.
SSH in and install Ollama
Works on Ubuntu, Debian, CentOS. 2GB RAM minimum.
Pull a model
7B model needs ~4GB disk. For 70B, get a Vultr $24/mo instance with 8GB RAM.
Start the API server
Ollama runs on port 11434. Expose it behind a simple nginx reverse proxy with API key auth for security.
Connect your agent framework
Use LangChain's Ollama integration or CrewAI. Your agent now routes through your self-hosted LLM.
Self-Hosted vs Cloud API: When to Use Which
| Scenario | Recommendation |
|---|---|
| High-volume, cost-sensitive agents | Ollama + open-source model on VPS |
| Complex reasoning / function calling | OpenAI o1 or Claude 3.7 via API |
| China-based, no proxy needed | DeepSeek API or FreeModel (direct) |
| Multi-model evaluation / benchmarking | OpenRouter (400+ models, one key) |
| Prototyping / dev environment | Free tier of any cloud API |
FAQ
Can I run AI agents on a cheap VPS?
Yes. A VPS with 2 vCPU + 4GB RAM (e.g., RackNerd at $1.99/mo) can run quantized open-source models via Ollama. For production agents requiring GPT-4o or Claude, use a cloud API instead.
What's the cheapest API for AI agents?
DeepSeek-R1 is the most cost-effective at ¥1/1M input tokens — 60x cheaper than GPT-4o. For open-source model hosting, Ollama on a $5/mo VPS beats cloud API costs at scale.
How do I keep AI agents running 24/7?
Use systemd to run your agent as a service (not a background process). Set up auto-restart on crash, and monitor with a simple health check endpoint. For critical production agents, use PM2 or Docker.
Ollama vs cloud API — which is better for AI agents?
Ollama + self-hosted: lower cost per call at scale, full data privacy, no rate limits. Cloud APIs (DeepSeek, OpenAI): better model quality, zero maintenance, easier setup. Use Ollama for dev/small scale; cloud APIs for production.
What VPS do AI agents need?
For self-hosted models: 2 vCPU + 4GB minimum for 7B models, 4 vCPU + 16GB for 70B models. For API-only agents: even a $2/mo VPS is enough to run the agent logic. RackNerd and Vultr are the best value choices.
Start Building
Compare AI API pricing and features on APIRank. Find the right provider for your agent workload. Then pick a VPS from vpstier.com to host your agent 24/7.