The Rust babysitter supports universal backends - any service that exposes an OpenAI-compatible API can be managed by the babysitter. Configuration can be specified via TOML config files (recommended) or CLI arguments.
Use a TOML config file for cleaner, more maintainable configuration:
./target/release/infini-babysitter --config-file /path/to/babysitter.tomlSee config/babysitter_example.toml for examples.
For quick testing or simple setups, use CLI arguments:
./target/release/infini-babysitter \
--port 8100 \
--service-type command \
--command "python3 -m vllm.entrypoints.openai.api_server" \
--args "--model /models/llama-2-7b --port 8100" \
--registry-url http://localhost:18000Note: CLI arguments override config file values when both are provided.
The most flexible option - run any command as a backend.
Config File:
name = "vllm-service"
port = 8100
registry_url = "http://localhost:18000"
[backend]
type = "command"
command = "python3"
args = ["-m", "vllm.entrypoints.openai.api_server", "--model", "/models/llama-2-7b", "--port", "8100"]
work_dir = "/path/to/vllm"
env = { CUDA_VISIBLE_DEVICES = "0", VLLM_WORKER_MULTIPROC_METHOD = "spawn" }CLI:
./target/release/infini-babysitter \
--port 8100 \
--service-type command \
--command "python3 -m vllm.entrypoints.openai.api_server" \
--args "--model /models/llama-2-7b --port 8100" \
--registry-url http://localhost:18000Pre-configured support for vLLM.
Config File:
name = "vllm-service"
port = 8100
registry_url = "http://localhost:18000"
[backend]
type = "vllm"
model = "/models/llama-2-7b"
args = ["--tensor-parallel-size", "1", "--gpu-memory-utilization", "0.9"]
env = { CUDA_VISIBLE_DEVICES = "0" }CLI:
./target/release/infini-babysitter \
--port 8100 \
--service-type vLLM \
--path /models/llama-2-7b \
--args "--tensor-parallel-size 1 --gpu-memory-utilization 0.9" \
--registry-url http://localhost:18000For testing and development.
Config File:
name = "mock-service"
port = 8100
registry_url = "http://localhost:18000"
[backend]
type = "mock"
models = ["model-a", "model-b", "model-c"]CLI:
./target/release/infini-babysitter \
--port 8100 \
--service-type mock \
--args "model-a,model-b,model-c" \
--registry-url http://localhost:18000InfiniLM Rust service.
./target/release/infini-babysitter \
--port 8100 \
--service-type InfiniLM-Rust \
--path /path/to/config.toml \
--registry-url http://localhost:18000InfiniLM Python service.
./target/release/infini-babysitter \
--port 8100 \
--service-type InfiniLM \
--path /path/to/model \
--registry-url http://localhost:18000Any backend managed by the babysitter must:
-
Expose OpenAI-Compatible API:
GET /models- List available modelsPOST /v1/chat/completions- Chat completions endpoint- Optional:
GET /health- Health check endpoint
-
Port Configuration:
- Backend should listen on the port specified by
--port - Babysitter will use
port+1for its HTTP server
- Backend should listen on the port specified by
-
Startup Behavior:
- Backend should start and begin listening within reasonable time
- Backend should respond to
/modelsendpoint when ready
name = "vllm-service"
port = 8100
registry_url = "http://localhost:18000"
[babysitter]
max_restarts = 10000
restart_delay = 5
heartbeat_interval = 30
[backend]
type = "command"
command = "python3"
args = ["-m", "vllm.entrypoints.openai.api_server", "--model", "/models/llama-2-7b", "--port", "8100", "--tensor-parallel-size", "2"]
work_dir = "/path/to/vllm"
env = { CUDA_VISIBLE_DEVICES = "0,1" }name = "llama-server"
port = 8100
registry_url = "http://localhost:18000"
[backend]
type = "command"
command = "/path/to/llama-server"
args = ["--model", "/models/llama.gguf", "--port", "8100", "--n-gpu-layers", "35"]name = "custom-backend"
port = 8100
registry_url = "http://localhost:18000"
[backend]
type = "command"
command = "python3"
args = ["/path/to/my_backend.py", "--port", "8100"]
work_dir = "/path/to/backend"
env = { PYTHONPATH = "/path/to/backend" }- Service Port: The port specified by
--portis where the backend service listens - Babysitter Port: The babysitter HTTP server listens on
port+1 - Health Checks: Router checks babysitter health at
http://host:port+1/health
The babysitter automatically:
- Registers itself with the registry (as a babysitter service)
- Detects when the backend is ready
- Fetches models from the backend
- Registers the backend with the registry (as an
openai-apiservice) - Sends periodic heartbeats for both services
The babysitter monitors the backend process and:
- Automatically restarts on crash (up to
--max-restarts) - Detects when backend becomes ready
- Tracks restart count and uptime
- Provides health status via HTTP endpoints