
Ollama Has a Free API — Heres How to Run LLMs Locally Without OpenAI
Ollama lets you run LLMs locally — Llama 3, Mistral, Gemma, Phi, CodeLlama — with a single command. OpenAI-compatible API, zero cloud costs, complete privacy. Why Ollama? One command : ollama run llama3 and you're chatting OpenAI-compatible : Same API format Private : Data never leaves your machine Free : No API keys, no costs GPU + CPU : Works on both 100+ models : Llama 3, Mistral, Gemma, Phi, CodeLlama Install curl -fsSL https://ollama.com/install.sh | sh Run a Model # Download and chat ollama run llama3.1 # Specific size ollama run llama3.1:70b # Code model ollama run codellama:34b REST API: Chat curl http://localhost:11434/api/chat -d '{ "model": "llama3.1", "messages": [{"role": "user", "content": "Explain Docker in 3 sentences"}], "stream": false }' REST API: Generate curl http://localhost:11434/api/generate -d '{ "model": "llama3.1", "prompt": "Write a Python function to sort a list", "stream": false }' OpenAI-Compatible Endpoint import OpenAI from ' openai ' ; const client = n
Continue reading on Dev.to Tutorial
Opens in a new tab
