INFRASTRUCTURE · LOCAL AIActive development · v0.8.x

Korgis

One stable local inference boundary for applications, while models, runtimes, routing and lifecycle can evolve underneath.

macOS & LinuxOpenAI-compatibleGGUF + MLXMulti-model runtime
Korgis Chat Studio showing a local inference session

WHY IT EXISTS

Running a model is not the same as owning a reliable runtime.

The infrastructure problem starts after the weights load: applications still need a stable contract, lifecycle ownership, concurrency rules and operational visibility.

Explicit

Model identity, configuration and dynamic routing are explicit and reproducible across environments.

Observable

Server health, resident state, token generation timings and logs remain fully inspectable.

Reusable

Multiple desktop applications can depend on the exact same OpenAI-compatible local reasoning layer.

THE INFRASTRUCTURE GAP

Why running a local model alone is not enough

Executing model weights is straightforward. Turning open-weight models into a stable execution layer for production software requires solving core system engineering problems.

01

Backend coupling

Application logic directly inherits inference engine quirks, quantization formats, and binary execution flags.

02

Lifecycle ownership

Models must be resolved, completeness-checked, loaded into VRAM, drained of active requests, and unloaded safely without memory leaks.

03

Runtime coordination

Running multiple resident models simultaneously requires explicit routing, admission control, and hardware resource concurrency limits.

04

Opaque operation

Product teams need request evaluation timings, streaming health indicators, and log tracing beyond raw stdout console output.

STABLE EXECUTION BOUNDARY

How applications interact with Local LLM Server

Applications integrate once using the standardized OpenAI protocol. Models, backend engines, and quantization choices evolve independently behind the runtime boundary.

01

Desktop application request

Product code issues a standard /v1/chat/completions HTTP request.

02

OpenAI API compatibility layer

Request parameters, prompt templates, and streaming flags are parsed and validated.

03

Model key & routing lookup

The server resolves the model key to a configured GGUF or MLX definition.

04

Resident runtime lease

Acquires a concurrency lease on the active model, preventing unsafe unloads.

05

Backend engine execution

Executes inference via in-process llama_cpp/mlx or managed server processes.

06

Response & SSE stream

Delivers structured JSON output or low-latency Server-Sent Events stream to the client.

TECHNICAL SYSTEM ARCHITECTURE

Decoupled system architecture

FastAPI boundary, ModelRuntimeManager state coordination, and pluggable backend engine adapters.

Local LLM Server system architecture diagram

FastAPI Public Boundary

Handles HTTP CORS, OpenAI API route matching, request validation, and SSE response streaming.

ModelRuntimeManager

Central orchestrator managing built-in and user model registry merges, lease admission, and state.

Process Draining & Bounded Shutdown

Managed child backend server processes are monitored with SIGTERM/SIGKILL bounded timeouts.

Telemetry & Metrics Collection

Tracks prompt evaluation milliseconds, generation speed (tok/s), and active memory footprint.

MODEL & RUNTIME LIFECYCLE

Deterministic model lifecycle management

Downloaded does not mean resident, and resident does not mean default route. Lifecycle state changes are managed deterministically.

Step 1

Artifact Resolution

Discovers models from built-in definitions, user configs, LM Studio caches, or Hugging Face hubs.

Step 2

Completeness Check

Validates file existence, SHA-256 integrity checksums, and quantization compatibility before loading.

Step 3

Engine Initialization

Allocates Metal/VRAM buffers, context windows, and threads for the target backend.

Step 4

Resident Lease

Maintains active client leases to guard against premature model unloads during active inference.

Step 5

Graceful Drain & Unload

Drains inflight HTTP requests before releasing memory back to the host system.

ENGINE FLEXIBILITY

Multi-backend engine matrix

Switch between optimized execution backends based on hardware architecture and model capabilities.

Backend EngineFormatExecution ModelCurrent Role & Target Workloads
llama_cppGGUFIn-process (C++ bindings)Text generation, structured reasoning & quantized GGUF models
mlxMLXIn-process (Apple Metal)Ultra-fast Apple Silicon text inference with Metal memory unified architecture
llama_serverGGUF + ProjectorManaged processMultimodal and audio-capable GGUF models requiring separate server process
mlx_vlm_serverMLX VLMManaged processApple Silicon vision-language model inference via python MLX-VLM package
DEVELOPER BOUNDARY

Standard OpenAI Python SDK integration

Point any OpenAI-compatible client library to the local server port.

python_client_example.py
OpenAI Python SDK
from openai import OpenAI

# Connect to Local LLM Server running on localhost
client = OpenAI(
    base_url="http://127.0.0.1:1235/v1",
    api_key="local", # Any non-empty string
)

# Execute streaming chat completion
response = client.chat.completions.create(
    model="nemotron-nano-4b-q8",
    messages=[
        {"role": "user", "content": "Extract decisions and action items in JSON."}
    ],
    stream=True,
)

for chunk in response:
    content = chunk.choices[0].delta.content or ""
    print(content, end="", flush=True)
OPERATIONAL EVIDENCE

Korgis: Inspectable runtime console

Korgis is the bundled operational web console that makes the runtime server visible, testable, and easier to integrate.

Chat Studio interface preview

Chat Studio

Test prompts, stream responses, configure inference parameters, and inspect structured outputs.

Models & Configuration interface preview

Models & Configuration

Inspect resident model leases, discover local GGUF/MLX registries, and adjust backend context sizes.

Telemetry & Server Diagnostics interface preview

Telemetry & Server Diagnostics

Follow prompt evaluation latency, generation tok/s throughput, and detailed runtime process logs.

Integration Examples & OpenAPI Contract interface preview

Integration Examples & OpenAPI Contract

Move from inspection to application code with copy-ready OpenAI client SDK code and live Swagger specs.

Loopback Binding Notice: Local LLM Server binds to 127.0.0.1 by default. Administrative API endpoints are opt-in.

EVIDENCE

Show implemented capability and operational limits side by side.

A strong infrastructure claim includes the boundary of the claim. Local LLM Server documents what is integrated today without turning active development into an implied production guarantee.

EVIDENCE BOUNDARY

The local runtime boundary is implemented; open-network production readiness is not claimed.

The current server supports local model discovery, multi-model routing, OpenAI-compatible streaming, explicit lifecycle handling and an inspectable Studio surface. Its default trust boundary remains loopback-first, and untrusted remote deployment requires controls the project does not currently provide.

Supported today

  • Loopback (127.0.0.1) network interface binding by default
  • CORS headers disabled by default to prevent web browser drive-by requests
  • Administrative runtime management endpoints disabled unless explicitly flagged
  • Multi-model resident routing & dynamic model switching
  • OpenAI-compatible streaming (/v1/chat/completions) & non-streaming endpoints
  • SHA-256 artifact validation & model completeness verification
  • Safe runtime lease, request draining, and memory unload behavior
  • Bundled Korgis Web UI and programmatic Python lifecycle management

Not claimed here

  • No built-in authentication layer for open or untrusted network deployments
  • Primary development and validation on macOS (Apple Silicon) and Linux
  • MLX backends strictly require Apple Silicon hardware with unified memory
  • Hardware-specific context length tuning required for heavy models
  • Project status is Active Development (v0.8.x), not production-ready infrastructure

STATUS & NEXT DECISION

Keep the boundary local where the evidence is strongest.

The next step is to deepen representative hardware validation and operational hardening without pretending that a loopback-first developer runtime is already trusted remote infrastructure.

CURRENT DECISION

Use the OpenAI-compatible boundary locally; do not imply trusted remote infrastructure.

Local LLM Server binds to 127.0.0.1 by default and already supports multi-model routing, streaming, lifecycle management and operational visibility. It does not include a built-in authentication layer for open or untrusted network deployments, and hardware-specific tuning remains part of responsible use.

  • Loopback-first trust boundary by default
  • No built-in authentication for untrusted network deployment
  • Hardware-specific context tuning remains necessary

CONNECTED SYSTEM

Where this project fits

LOCAL LLM SERVER

Give your product a reliable local reasoning layer.

Explore the runtime codebase, benchmark against your desktop hardware, and adopt an OpenAI-compatible boundary for your local AI applications.