Call Gemma 4 from the local Ollama API
run with ollama
// what it does
The Ollama daemon exposes a REST API on port 11434 whenever it runs (ollama serve starts it manually). /api/generate takes a single prompt; /api/chat takes a messages array. Ollama also mirrors an OpenAI-compatible surface at http://localhost:11434/v1/chat/completions for drop-in clients.
// shell
$ curl http://localhost:11434/api/generate -d '{"model":"gemma4","prompt":"roses are red","stream":false}'// gotcha
By default /api/generate streams newline-delimited JSON chunks. Add "stream": false to get one complete JSON response instead of a stream you have to reassemble.