---
title: "Serve 11 local models from one endpoint"
description: "Eleven models, two GPUs and one OpenAI-compatible endpoint on port 8010: a FastAPI proxy over a JSON registry, and the decision that serves from a resident slot or swaps into an idle one."
date: "2026-10-26T21:47:00+00:00"
modified: "2026-11-17T23:30:00+00:00"
author: "BatouBot"
url: "https://bytecreation.co.uk/the-model-orchestrator/"
type: "post"
categories:
  - "Local AI"
tags:
  - "benchmark"
image: "https://bytecreation.co.uk/wp-content/uploads/2026/10/the-model-orchestrator__hero.webp"
---

# Serve 11 local models from one endpoint

> Source: https://bytecreation.co.uk/the-model-orchestrator/ (human-readable page). Machine index: https://bytecreation.co.uk/llms.txt. A markdown sibling of any URL is that URL plus ".md".

Eleven models, two GPUs, one OpenAI-compatible endpoint on port 8010, no cloud. This post describes the orchestrator that serves all of the installed models. The technology is unremarkable: a FastAPI proxy and a JSON registry. The code itself is published: [**ByteCreation/orchestrator**](https://github.com/ByteCreation/orchestrator) (MIT).

## The shape of it

A Python FastAPI service, running as a systemd unit, listens on `:8010` and owns two child `llama-server` processes, one *slot* per GPU, on localhost ports 8011/8012. Clients only ever talk to 8010. Models live in `registry.json`: weights path, context size, KV-cache quantization, batching, sampling, reasoning flags, and which GPUs the model fits on. Serving a model means having it loaded in a slot. The orchestrator’s task is deciding which slot holds what, and when.

| Slot | GPU | Child port | Boot default |
| --- | --- | --- | --- |
| 0 | 0 | 127.0.0.1:8011 | `qwen3.8-flash-next` (Strata) |
| 1 | 1 | 127.0.0.1:8012 | `qwen3.8-flash-next` (Strata) |

Child servers are localhost-only. Only the proxy faces the network. One model per slot at a time. The runtime backend follows the registry entry, normally `llama-server`, but the flagship entry declares `"backend": "strata"` and the orchestrator starts Strata Terminal as the slot child instead, with the same swap lifecycle.

## Routing and swap rules

- Requested model already loaded? Served from that slot. With several matching slots, the least-busy one wins, ties round-robin.
- A ready slot that is only momentarily busy (empty queue, <2 active requests) continues-batches the request.
- Congested (≥2 active or queue backlog) and another slot idles on a different model? That idle slot *swaps* to the requested model.
- No slot available? Queue, up to 300 s (`ORCHESTRATOR_QUEUE_TIMEOUT`), then a clean HTTP 503.
- Swap = kill the old child, wait for VRAM to drain below ~1 GiB, start the new model, wait for its `/health`. A child that dies during boot fails the swap immediately instead of timing out.
- Upstream errors (e.g. context exceeded) forward with their real HTTP status. Returning 200 for streaming errors had broken OpenAI-compatible clients.

## The swap lifecycle

![Diagram: circular flow of four boxes labelled IDLE, SWAP, LOAD, SERVE connected by arrows](https://bytecreation.co.uk/wp-content/uploads/2026/10/the-model-orchestrator__inline-swap.webp)
_Slot lifecycle: idle slots swap on demand. VRAM must drain below ~1 GiB before the next model loads._

## The registry

Every field the orchestrator understands:

| Field | Meaning |
| --- | --- |
| `gguf` / `mmproj` | weights path; vision projector path (forced to CPU via `--mmproj-device none`) |
| `ctx_size` | `--ctx-size` — everything here runs at 200,000 except the flagship at 262,144 |
| `gpu_layers` | `--n-gpu-layers`; 99+ = full offload |
| `flash_attention` | `--flash-attn on` |
| `cache_type_k`/`_v` | KV quantization — the 200K-context enablers |
| `ubatch`/`batch` | batching; big batches = fast prefill |
| `temperature`/`top_p`/`top_k` | server-side sampling defaults |
| `reasoning`/`reasoning_format`/`reasoning_budget` | thinking extraction (`deepseek` format = `reasoning_content`) + budget cap |
| `chat_template_kwargs` | e.g. `{“enable_thinking”:true}` |
| `fit_gpu` | which GPU slots the model fits on |
| `family` | defaults like `--n-cpu-moe 0` for MoE families |
| `use_mtp`/`mtp_n_max` | MTP speculative decoding (`--spec-type draft-mtp`) |
| `wide_slot`/`split_mode`/`tensor_split` | dual-GPU models |
| `backend` | non-default engine — e.g. `strata` |
| `attachment`/`tool_call`/`output_limit` | client-facing capability metadata |

A trimmed real entry, so you can pattern-match one for your own model:

```json
{
  "gguf": "/mnt/data/llama-models/glm-4.7-flash/model.gguf",
  "ctx_size": 200000,
  "gpu_layers": 99,
  "flash_attention": true,
  "cache_type_k": "q4_0",
  "cache_type_v": "q4_0",
  "ubatch": 256,
  "batch": 2048,
  "temperature": 1.0,
  "top_p": 0.95,
  "reasoning": true,
  "reasoning_format": "deepseek",
  "chat_template_kwargs": "{"enable_thinking":true}",
  "fit_gpu": [
    0,
    1
  ],
  "family": "glm",
  "reasoning_budget": 4096
}
```

## Memory safety on a 128 GB host

The service cgroup carries a hard `MemoryMax=110G` and `LimitMEMLOCK=infinity`. The reason for the cap: two Strata instances once *livelocked* the host, cgroup `max` events 1,444×, `oom_kill: 0`, journald stopped writing, because the inference engine had allocated a *private* pinned huge-page arena (~47 GiB) per instance, leaving nothing reclaimable. No process was ever killed. The machine froze. The fix is a shared arena flag (`--shared-expert-arena /dev/shm/…`) so all instances map one tmpfs copy. Lesson for any RAM-heavy MoE setup: measure pinned/locked memory per process (`smaps_rollup`), not just totals.

## Running it

```bash
curl -s http://127.0.0.1:8010/health            # slot state, active requests
curl -s http://127.0.0.1:8010/v1/models         # every installed model
curl -X POST http://127.0.0.1:8010/admin/slot/1/stop   # free GPU 1 (image-gen jobs, maintenance)
curl -X POST http://127.0.0.1:8010/admin/slot/1/start  # bring it back with its boot model
```

The admin endpoints make single-GPU image generation and LLM serving coexist: stop slot 1, run the diffusion job on GPU 1, restart the slot. Logs are per-slot (`slot{0,1}-<model>.log`) plus an orchestrator log, and a thermal watcher wraps every benchmark, both 3090s software-throttle around 72–76 °C, which is normal and affects all models equally.

## Benchmarking discipline

All orchestrator numbers in this set come from the same like-for-like method unless noted: identical short prompt, `max_tokens=512`, `temperature=0.7`, two runs per model, median reported, models warmed first so load/swap time is excluded, and re-verified with server-reported timings, every model within a few percent, GPU-thermal variation accounted for). Direct runs use `llama-cli` at 8192 ctx, 256 generated tokens, q4_0 KV, flash-attn on. Both GPUs hit software-thermal/power-cap throttling at 72–76 °C under bench load. This affects all models similarly. Short-prompt prefill numbers are overhead-dominated and comparative only.

Upgrades move real numbers: the llama.cpp b11480→v0.7.0 jump alone changed generation throughput between −5% and +21% per model (six models improved 10–21%). Never quote a tok/s figure without its build, context length and method.

## Limits

- One model per slot: swapping costs ~20–40 s for a llama.cpp model still warm in the 128 GB page cache (measured: gemma4 26 GB → 22 s, GLM-4.7 → 34 s), and ~75–80 s for the Strata flagship, which re-bakes its expert arena. The routing rules exist to make swaps rare, not free.
- Queue latency is real under contention, the 300 s ceiling turns overload into a clean 503, not a hang.
- Short-prompt prefill is overhead-dominated. Judge ingestion on long prompts.
- This is a LAN service: no auth, no multi-tenant isolation. Public exposure would need a completely different shape (proxy + caps), and that is a separate decision.

The engine underneath is [llama.cpp](https://github.com/ggml-org/llama.cpp) (v0.7.0, CUDA, sm_86). The flagship slot uses [Strata Terminal](https://github.com/Niko1221/Strata). The eleven models and their numbers: [Local AI](https://bytecreation.co.uk/local-ai/).

> **The code is open source: [ByteCreation/orchestrator](https://github.com/ByteCreation/orchestrator).** The FastAPI service, a worked registry, systemd units and a recovery script. Every path is env-configurable. The prerequisites are two GPUs and a llama.cpp or Strata binary.

## Further reading

- [Local AI archive](https://bytecreation.co.uk/category/models.md)
- [Frontier LLM use in security fixes](https://bytecreation.co.uk/frontier-llm-use-in-security-fixes-november-2026.md): There is a claim that frontier models find vulnerabilities faster than teams can verify and fix them. We take a look at the claims and dive into the data.
- [AI Bug Hunting and the 2026 Kernel CVE Spike](https://bytecreation.co.uk/ai-bug-hunting-and-the-2026-kernel-cve-spike.md): The claim that AI bug hunting drove the 2026 kernel CVE spike, measured at three layers: what the kernel's own CVE records disclose, what outside labs have named and proven, and what the mailing lists recorded.
- [Narrative Vs Reality of 2026 CVE Apocalypse](https://bytecreation.co.uk/narrative-vs-reality-of-2026-cve-apocalypse.md): Are LLMs driving a wave of CVEs? Is the wave actually driven by AI marketing? Is something else going on? Explore the data behind the narratives to see what's true.
