Query Parameters
Optional API key for authentication (if Ollama server requires it)
Response
Indicates if the connection check was successful
Whether connection to Ollama was successful
Ollama version if connected
curl --request GET \
--url 'http://localhost:3000/api/v1/ollama/check-connection' \
--header 'Authorization: Bearer <token>'
{
"success": true,
"connected": true,
"version": "0.1.22"
}
Notes
Use this endpoint to verify Ollama is running before attempting other operations.
- Returns
connected: true only if Ollama is running and reachable
- The
version field shows the Ollama server version
- Useful for health checks and setup validation
- Default Ollama URL is
http://localhost:11434
Usage Example
// Check connection before pulling a model
async function safePullModel(modelName) {
const checkResponse = await fetch(
'http://localhost:3000/api/v1/ollama/check-connection',
{ headers: { 'Authorization': 'Bearer <token>' } }
);
const checkData = await checkResponse.json();
if (!checkData.connected) {
console.error('Ollama is not running. Please start Ollama first.');
return;
}
// Proceed with model pull
const pullResponse = await fetch(
'http://localhost:3000/api/v1/ollama/pull-model',
{
method: 'POST',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({ modelName })
}
);
return await pullResponse.json();
}