curl --request GET \
--url 'http://localhost:3000/api/v1/ollama/check-connection' \
--header 'Authorization: Bearer <token>'
curl --request GET \
--url 'http://localhost:3000/api/v1/ollama/check-connection?baseUrl=http://192.168.1.100:11434' \
--header 'Authorization: Bearer <token>'
const response = await fetch(
'http://localhost:3000/api/v1/ollama/check-connection',
{
method: 'GET',
headers: {
'Authorization': 'Bearer <token>'
}
}
);
const data = await response.json();
import requests
url = "http://localhost:3000/api/v1/ollama/check-connection"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
data = response.json()
{
"success": true,
"connected": true,
"version": "0.1.22"
}
{
"success": true,
"connected": false
}
{
"success": false,
"connected": false,
"error": "Unauthorized"
}
{
"success": false,
"connected": false,
"error": "Connection failed: ECONNREFUSED"
}
Ollama
Check Connection
Verifies connectivity to the Ollama server and checks if it’s running
GET
/
api
/
v1
/
ollama
/
check-connection
curl --request GET \
--url 'http://localhost:3000/api/v1/ollama/check-connection' \
--header 'Authorization: Bearer <token>'
curl --request GET \
--url 'http://localhost:3000/api/v1/ollama/check-connection?baseUrl=http://192.168.1.100:11434' \
--header 'Authorization: Bearer <token>'
const response = await fetch(
'http://localhost:3000/api/v1/ollama/check-connection',
{
method: 'GET',
headers: {
'Authorization': 'Bearer <token>'
}
}
);
const data = await response.json();
import requests
url = "http://localhost:3000/api/v1/ollama/check-connection"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
data = response.json()
{
"success": true,
"connected": true,
"version": "0.1.22"
}
{
"success": true,
"connected": false
}
{
"success": false,
"connected": false,
"error": "Unauthorized"
}
{
"success": false,
"connected": false,
"error": "Connection failed: ECONNREFUSED"
}
Query Parameters
string
Optional Ollama server URL to check (defaults to http://localhost:11434)
string
Optional API key for authentication (if Ollama server requires it)
Response
boolean
Indicates if the connection check was successful
boolean
Whether connection to Ollama was successful
string
Ollama version if connected
curl --request GET \
--url 'http://localhost:3000/api/v1/ollama/check-connection' \
--header 'Authorization: Bearer <token>'
curl --request GET \
--url 'http://localhost:3000/api/v1/ollama/check-connection?baseUrl=http://192.168.1.100:11434' \
--header 'Authorization: Bearer <token>'
const response = await fetch(
'http://localhost:3000/api/v1/ollama/check-connection',
{
method: 'GET',
headers: {
'Authorization': 'Bearer <token>'
}
}
);
const data = await response.json();
import requests
url = "http://localhost:3000/api/v1/ollama/check-connection"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
data = response.json()
{
"success": true,
"connected": true,
"version": "0.1.22"
}
{
"success": true,
"connected": false
}
{
"success": false,
"connected": false,
"error": "Unauthorized"
}
{
"success": false,
"connected": false,
"error": "Connection failed: ECONNREFUSED"
}
Notes
Use this endpoint to verify Ollama is running before attempting other operations.
- Returns
connected: trueonly if Ollama is running and reachable - The
versionfield 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();
}

