Ollama can run a DeepSeek-R1 model on your machine and expose a chat endpoint. Select a specific variant from the Ollama library before downloading. The library includes multiple model sizes, so match a variant to the memory and compute you have available.
Test the local chat request
Use the model tag you installed in Ollama. With the local service running and Python's Requests package available, send a small request first:
import requests
response = requests.post(
"http://127.0.0.1:11434/api/chat",
json={
"model": "deepseek-r1",
"messages": [{"role": "user", "content": "Explain why 7 is prime."}],
"stream": False,
},
timeout=120,
)
response.raise_for_status()
print(response.json()["message"]["content"])
Setting stream to false makes this example read a single JSON response. Keep the default local address for a workstation experiment. Treat network exposure as a separate service deployment that needs authentication and access controls.
Narrow down a failed test
If the connection is refused, first check that Ollama is running on the machine addressed by the request. If the service responds with a model error, compare the requested tag with your installed model list. A response timeout can happen on a slow first load. Start with a small prompt and check the server status before repeatedly sending the same request.
Once this single-message example works, keep prior messages in the messages array only when your task needs conversational context. Track their size so later tests remain comparable.
Continue with Oakgen Agent
Open in Oakgen Agent
The prompt is filled in for you. Review it before sending.


