Calling a remote Ollama instance from Python or curl
Both clients hit the same path. Only the host changes.
A remote Ollama is the same HTTP API as a local one. Replace 127.0.0.1 with the hostname. Keep port 11434 unless the operator published a different one. Chat, generate, and tags are the three calls.
curl is the faster check. Python is the call you will keep. Both send the same JSON. Set stream to false on this host so the response is one object. The generate route uses prompt instead of messages, and the text comes back in response.
If the call hangs, the failure is the address or the firewall, not the JSON. A refused connection and a timeout are different, and only the second one is worth retrying.
On this host
The remote instance is this machine. No API key. The curl is the check, and the Python in the previous note is the client.
curl http://datattention.com:11434/api/generate \
-H 'Content-Type: application/json' \
-d '{"model":"llama3.2","prompt":"Hello","stream":false}'
The full list of ports and paths is on the endpoints page.