Skip to main content
The llmfit serve command starts an HTTP API that exposes node-local model fit analysis. This is designed for cluster schedulers, aggregators, and remote clients that need to query hardware compatibility across multiple nodes.

Starting the Server

string
default:"0.0.0.0"
Host interface to bind. Use 0.0.0.0 to accept connections from any interface, or 127.0.0.1 for localhost-only.
integer
default:"8787"
Port to listen on.
Global flags (--memory, --max-context) apply to all API responses, overriding hardware detection and memory estimation.

Base URL

Default local base URL:
For remote access, replace 127.0.0.1 with the server’s IP or hostname.

Endpoints

GET /health

Liveness probe. Returns a simple status object indicating the server is running. Response:
Status codes:
  • 200 OK - Server is healthy
Example:

GET /api/v1/system

Node identity and hardware specs. Returns detected CPU, RAM, GPU, and backend info. Response:
Fields:
string
Node hostname
string
Operating system (linux, macos, windows)
number
Total system RAM in gigabytes
number
Available system RAM in gigabytes
integer
Total CPU core count
string
CPU model name
boolean
Whether at least one GPU is detected
number | null
Total GPU VRAM across all detected GPUs (null if no GPU)
string | null
Primary GPU model name (null if no GPU)
integer
Number of detected GPUs
boolean
Whether the system uses unified memory (Apple Silicon)
string
Acceleration backend: CUDA, Metal, ROCm, SYCL, CPU (x86), CPU (ARM), Ascend
array
Array of detected GPU objects with per-GPU details
Status codes:
  • 200 OK - System info returned
Example:

GET /api/v1/models

Filtered and sorted model fit list. Returns an array of models with fit analysis, scoring, and runtime info. Supports extensive query parameters for filtering. Query Parameters:
integer
Maximum number of models to return. Alias: n
boolean
When true, only return models with perfect fit level (overrides min_fit)
enum
Minimum fit level to include.Values: perfect, good, marginal, too_tightDefault: marginal (includes all but too_tight)
enum
Filter by inference runtime.Values: any, mlx, llamacppDefault: any
enum
Filter by use case category.Values: general, coding, reasoning, chat, multimodal, embedding
string
Provider substring filter (e.g., Meta, Qwen, Mistral)
Free-text filter across name, provider, parameter count, use case, and category. All space-separated terms must match (AND logic).
enum
Sort column.Values: score, tps, params, mem, ctx, date, use_caseDefault: score
boolean
Include unrunnable models (fit_level = too_tight).Default: true for /models, false for /models/top
integer
Per-request context cap for memory estimation. Overrides server startup --max-context flag.
Response:
Model Fields:
string
Full HuggingFace model name
string
Model provider (Meta, Qwen, Mistral, etc.)
string
Human-readable parameter count (e.g., “7B”, “70B”)
number
Numeric parameter count in billions
integer
Maximum context window in tokens
string
Model-declared use case string
string
Inferred category: General, Coding, Reasoning, Chat, Multimodal, Embedding
string | null
ISO 8601 date string (YYYY-MM-DD) or null
boolean
Whether the model uses Mixture-of-Experts architecture
enum
Fit level: perfect, good, marginal, too_tight
string
Human-readable fit label
enum
Execution mode: gpu, moe, cpu_offload, cpu_only
string
Human-readable run mode label
number
Composite score (0-100) combining Quality, Speed, Fit, Context dimensions
object
Breakdown of the four scoring dimensions (each 0-100)
number
Estimated tokens per second based on hardware and quantization
enum
Inference runtime: mlx, llamacpp
string
Human-readable runtime label
string
Best quantization that fits this hardware (e.g., Q5_K_M, Q4_K_M)
number
Memory required to run the model in GB
number
Available memory on this node in GB (VRAM or RAM depending on run mode)
number
Memory utilization percentage (memory_required / memory_available * 100)
array
Array of human-readable notes (e.g., MoE offloading, CPU-only warnings)
array
Array of known GGUF download sources with provider and HuggingFace repo
Status codes:
  • 200 OK - Models returned
  • 400 Bad Request - Invalid filter values
  • 500 Internal Server Error - Server error
Examples:

GET /api/v1/models/top

Key scheduling endpoint. Returns top runnable models for this node, with conservative defaults suitable for production placement decisions. Query Parameters: Same as /api/v1/models, with different defaults:
  • limit: Defaults to 5 (vs. no limit on /models)
  • include_too_tight: Defaults to false (vs. true on /models)
All other parameters work identically. Response: Same schema as /api/v1/models, but returns only top N runnable models by default. Status codes:
  • 200 OK - Top models returned
  • 400 Bad Request - Invalid filter values
  • 500 Internal Server Error - Server error
Examples:

GET /api/v1/models/{name}

Path-constrained search. Equivalent to /api/v1/models?search={name}. Returns models matching the path parameter. Path Parameters:
string
required
Model name or search term (URL-encoded)
Query Parameters: All parameters from /api/v1/models are supported. Response: Same schema as /api/v1/models. Status codes:
  • 200 OK - Matching models returned
  • 400 Bad Request - Invalid filter values
  • 500 Internal Server Error - Server error
Examples:

Error Handling

Invalid filter values return HTTP 400 with an error message:
Server errors return HTTP 500:

Client Integration Patterns

1. Polling Pattern for Schedulers

For each node agent:
  1. Call GET /health to verify liveness
  2. Call GET /api/v1/system to get node identity and hardware
  3. Call GET /api/v1/models/top?limit=K&min_fit=good to get top runnable models
  4. Attach node metadata and forward to your central scheduler
Example aggregator:

2. Conservative Placement Defaults

For production placement, prefer:
This ensures only models that fit with headroom are considered.

3. Per-Workload Targeting

Coding workloads:
Embedding workloads:
Runtime-constrained fleet (llama.cpp only):

4. Stable Parsing

Treat unknown fields as forward-compatible additions:
  • Parse required fields you depend on
  • Ignore unknown fields
  • Validate enums against known values, fall back gracefully
This ensures your client works with future API versions.

Curl Examples

Testing

Validate API behavior with the included test script:
The script validates:
  • Endpoint availability and response schemas
  • Filter behavior (min_fit, runtime, use_case)
  • Sort column correctness
  • Error handling

Versioning

Current API prefix: /api/v1/ If you build long-lived clients, pin to /api/v1/... and validate behavior with scripts/test_api.py.
For cluster scheduling, use /api/v1/models/top with min_fit=good to ensure only models with headroom are considered for placement.
The API returns the same scoring and fit analysis used by TUI and CLI modes. Results are computed on each request based on current system state.