Skip to main content
GET
/
api
/
v1
/
ollama
/
check-connection
curl --request GET \
  --url 'http://localhost:3000/api/v1/ollama/check-connection' \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "connected": true,
  "version": "0.1.22"
}

Query Parameters

baseUrl
string
Optional Ollama server URL to check (defaults to http://localhost:11434)
apiKey
string
Optional API key for authentication (if Ollama server requires it)

Response

success
boolean
Indicates if the connection check was successful
connected
boolean
Whether connection to Ollama was successful
version
string
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();
}