Overview
CheckThat AI provides health check endpoints to monitor service status, verify API availability, and retrieve system information.
Root Endpoint
GET /
Returns basic API information and version.
curl https://api.checkthat-ai.com/
Response
Status Code: 200 OK
{
"message" : "This is the CheckThat AI backend root API endpoint. Visit https://github.com/nikhil-kadapala/checkthat-ai for the public API documentation." ,
"version" : "1.0.0"
}
Response Fields
Welcome message with link to documentation
Current API version (e.g., “1.0.0”)
Health Check Endpoint
GET /health
Returns detailed health status of the API service.
curl https://api.checkthat-ai.com/health
Response
Status Code: 200 OK
{
"status" : "healthy" ,
"version" : "1.0.0"
}
Response Fields
Health status of the service. Values:
healthy - Service is operational
degraded - Service is running but with issues
unhealthy - Service is not operational
Example Usage
Python
import requests
def check_api_health ():
try :
response = requests.get(
"https://api.checkthat-ai.com/health" ,
timeout = 5
)
if response.status_code == 200 :
data = response.json()
print ( f "Status: { data[ 'status' ] } " )
print ( f "Version: { data[ 'version' ] } " )
return data[ 'status' ] == 'healthy'
else :
print ( f "Health check failed: { response.status_code } " )
return False
except requests.exceptions.RequestException as e:
print ( f "Failed to connect to API: { e } " )
return False
# Usage
if check_api_health():
print ( "API is healthy and ready to use" )
else :
print ( "API is not available" )
JavaScript/TypeScript
async function checkAPIHealth () {
try {
const response = await fetch ( 'https://api.checkthat-ai.com/health' );
if ( response . ok ) {
const data = await response . json ();
console . log ( `Status: ${ data . status } ` );
console . log ( `Version: ${ data . version } ` );
return data . status === 'healthy' ;
} else {
console . error ( `Health check failed: ${ response . status } ` );
return false ;
}
} catch ( error ) {
console . error ( `Failed to connect to API: ${ error } ` );
return false ;
}
}
// Usage
if ( await checkAPIHealth ()) {
console . log ( 'API is healthy and ready to use' );
} else {
console . log ( 'API is not available' );
}
cURL with Retry Logic
#!/bin/bash
# Health check with retry
MAX_RETRIES = 3
RETRY_DELAY = 5
for i in $( seq 1 $MAX_RETRIES ); do
echo "Attempt $i of $MAX_RETRIES ..."
RESPONSE = $( curl -s -o /dev/null -w "%{http_code}" https://api.checkthat-ai.com/health )
if [ " $RESPONSE " -eq 200 ]; then
echo "API is healthy"
exit 0
else
echo "Health check failed with status $RESPONSE "
if [ $i -lt $MAX_RETRIES ]; then
echo "Retrying in ${ RETRY_DELAY }s..."
sleep $RETRY_DELAY
fi
fi
done
echo "API is not available after $MAX_RETRIES attempts"
exit 1
Monitoring Integration
Prometheus Monitoring
Create a Prometheus exporter for CheckThat AI health:
from prometheus_client import start_http_server, Gauge
import requests
import time
# Create metrics
api_health = Gauge( 'checkthat_api_health' , 'CheckThat AI API health status (1=healthy, 0=unhealthy)' )
api_response_time = Gauge( 'checkthat_api_response_time_seconds' , 'CheckThat AI API response time' )
def check_health ():
try :
start_time = time.time()
response = requests.get( 'https://api.checkthat-ai.com/health' , timeout = 10 )
response_time = time.time() - start_time
api_response_time.set(response_time)
if response.status_code == 200 :
data = response.json()
api_health.set( 1 if data[ 'status' ] == 'healthy' else 0 )
else :
api_health.set( 0 )
except Exception as e:
print ( f "Health check failed: { e } " )
api_health.set( 0 )
if __name__ == '__main__' :
start_http_server( 8000 )
while True :
check_health()
time.sleep( 30 ) # Check every 30 seconds
Uptime Monitoring
Integrate with uptime monitoring services:
import requests
import os
from datetime import datetime
def notify_status_change ( status , previous_status ):
"""Notify when API status changes."""
if status != previous_status:
# Send notification (email, Slack, PagerDuty, etc.)
webhook_url = os.getenv( 'WEBHOOK_URL' )
if webhook_url:
requests.post(webhook_url, json = {
'text' : f 'CheckThat AI status changed: { previous_status } -> { status } ' ,
'timestamp' : datetime.now().isoformat()
})
previous_status = None
while True :
try :
response = requests.get( 'https://api.checkthat-ai.com/health' )
current_status = response.json().get( 'status' , 'unknown' )
if previous_status and current_status != previous_status:
notify_status_change(current_status, previous_status)
previous_status = current_status
except Exception as e:
if previous_status != 'unreachable' :
notify_status_change( 'unreachable' , previous_status)
previous_status = 'unreachable'
time.sleep( 60 )
Available Models Check
While not a traditional health check, you can verify available models:
GET /v1/models
curl https://api.checkthat-ai.com/v1/models
Response
{
"models_list" : [
{
"provider" : "OpenAI" ,
"available_models" : [
{ "name" : "GPT-5" , "model_id" : "gpt-5-2025-08-07" },
{ "name" : "GPT-5 nano" , "model_id" : "gpt-5-nano-2025-08-07" },
{ "name" : "o3" , "model_id" : "o3-2025-04-16" },
{ "name" : "o4-mini" , "model_id" : "o4-mini-2025-04-16" }
]
},
{
"provider" : "Anthropic" ,
"available_models" : [
{ "name" : "Claude Sonnet 4" , "model_id" : "claude-sonnet-4-20250514" },
{ "name" : "Claude Opus 4.1" , "model_id" : "claude-opus-4-1-20250805" }
]
},
{
"provider" : "Gemini" ,
"available_models" : [
{ "name" : "Gemini 2.5 Pro" , "model_id" : "gemini-2.5-pro" },
{ "name" : "Gemini 2.5 Flash" , "model_id" : "gemini-2.5-flash" }
]
},
{
"provider" : "xAI" ,
"available_models" : [
{ "name" : "Grok 3" , "model_id" : "grok-3" },
{ "name" : "Grok 4" , "model_id" : "grok-4-0709" },
{ "name" : "Grok 3 Mini" , "model_id" : "grok-3-mini" }
]
},
{
"provider" : "Together AI" ,
"available_models" : [
{ "name" : "Llama 3.3 70B" , "model_id" : "meta-llama/Llama-3.3-70B-Instruct-Turbo-Free" },
{ "name" : "DeepSeek R1 Distill Llama 70B" , "model_id" : "deepseek-ai/DeepSeek-R1-Distill-Llama-70B-free" }
]
}
]
}
Comprehensive Health Check
Implement a comprehensive health check that verifies multiple aspects:
import requests
from typing import Dict, List
class HealthChecker :
def __init__ ( self , base_url : str = "https://api.checkthat-ai.com" ):
self .base_url = base_url
def check_endpoint_health ( self ) -> Dict[ str , any ]:
"""Check /health endpoint."""
try :
response = requests.get( f " { self .base_url } /health" , timeout = 5 )
return {
"endpoint" : "/health" ,
"status" : "ok" if response.status_code == 200 else "error" ,
"response_time" : response.elapsed.total_seconds(),
"data" : response.json() if response.status_code == 200 else None
}
except Exception as e:
return {
"endpoint" : "/health" ,
"status" : "error" ,
"error" : str (e)
}
def check_models_endpoint ( self ) -> Dict[ str , any ]:
"""Check /v1/models endpoint."""
try :
response = requests.get( f " { self .base_url } /v1/models" , timeout = 5 )
data = response.json() if response.status_code == 200 else None
return {
"endpoint" : "/v1/models" ,
"status" : "ok" if response.status_code == 200 else "error" ,
"response_time" : response.elapsed.total_seconds(),
"models_count" : len (data.get( 'models_list' , [])) if data else 0
}
except Exception as e:
return {
"endpoint" : "/v1/models" ,
"status" : "error" ,
"error" : str (e)
}
def run_comprehensive_check ( self ) -> Dict[ str , any ]:
"""Run all health checks."""
results = {
"timestamp" : datetime.now().isoformat(),
"checks" : [
self .check_endpoint_health(),
self .check_models_endpoint()
]
}
# Overall status
all_ok = all (check[ 'status' ] == 'ok' for check in results[ 'checks' ])
results[ 'overall_status' ] = 'healthy' if all_ok else 'degraded'
return results
# Usage
checker = HealthChecker()
results = checker.run_comprehensive_check()
print ( f "Overall Status: { results[ 'overall_status' ] } " )
for check in results[ 'checks' ]:
print ( f " { check[ 'endpoint' ] } : { check[ 'status' ] } " )
Docker Health Check
If running CheckThat AI in Docker, add a health check to your docker-compose.yml:
services :
checkthat-api :
image : checkthat-ai:latest
healthcheck :
test : [ "CMD" , "curl" , "-f" , "http://localhost:8000/health" ]
interval : 30s
timeout : 10s
retries : 3
start_period : 40s
Kubernetes Health Probes
Configure Kubernetes liveness and readiness probes:
apiVersion : v1
kind : Pod
metadata :
name : checkthat-api
spec :
containers :
- name : api
image : checkthat-ai:latest
livenessProbe :
httpGet :
path : /health
port : 8000
initialDelaySeconds : 15
periodSeconds : 20
timeoutSeconds : 5
failureThreshold : 3
readinessProbe :
httpGet :
path : /health
port : 8000
initialDelaySeconds : 5
periodSeconds : 10
timeoutSeconds : 3
successThreshold : 1
failureThreshold : 3
Best Practices
Check API health at regular intervals (every 30-60 seconds) to detect issues early.
Use reasonable timeouts (5-10 seconds) for health checks to avoid false negatives.
Retry health checks before marking the service as unhealthy to account for transient issues.
Track health check response times to identify performance degradation.
Configure alerts to notify your team when health checks fail consistently.
Troubleshooting
Service Unavailable
If health checks return errors:
Check Network Connectivity - Verify you can reach the API endpoint
Verify DNS Resolution - Ensure the domain resolves correctly
Check API Status Page - Visit the status page for known issues
Review Rate Limits - Ensure you haven’t exceeded rate limits
Check Service Logs - Review server logs for error messages
Slow Response Times
If health checks are slow:
Check Server Load - High traffic may slow responses
Verify Network Latency - Test from different locations
Review Configuration - Ensure proper resource allocation
Check Dependencies - Verify all backend services are healthy
API Overview Learn about all available endpoints
Models Endpoint List all available LLM models