Generate Completions in Ollama
From the Ollama cheat sheet · REST API · verified Jul 2026
Generate Completions
Generate text completions using the /api/generate endpoint.
bash
# Generate a completion
curl http://localhost:11434/api/generate -d '{
"model": "llama3.2",
"prompt": "Why is the sky blue?",
"stream": false
}'💡 Set "stream": false to get the complete response in a single JSON object
⚡ The "context" field from a response can be passed back to maintain conversation state
📌 Use "options" to override model parameters like temperature and num_ctx per request
🟢 Default streaming returns newline-delimited JSON objects as tokens are generated
apigeneraterest