Files
alzeo/oc-point-default.py
T
Hasan BasbunarandClaude Opus 5.5 b73eac92df v1.59: the Inkling 2 Mini lane (inkling), on SGLang's own image for it, in every lane list
install-inkling.sh serves Thinking Machines' Inkling 2 Mini (thinkingmachines/Inkling-2-Mini at its pinned
revision, Apache-2.0: a looped mixture of experts, 26.4B parameters with 3.4B active, text and images in) with
the DSpark draft head its checkpoint carries, on the text port behind the proxy, as model inkling-2-mini. The
engine is SGLang from the image its cookbook gives the model (lmsysorg/sglang:inkling-2-mini, by the digest of
its arm64 build), with the cookbook's DGX Spark recipe and its DSpark arm word for word, as the reference box
measured it on 2026-11-22: a static share of 0.45, FA4, bfloat16, pages of 128, 8 draft tokens verified per
step, MAX_JOBS=4 and the four SGLANG_OPT_* variables, xgrammar, images on, the inkling reasoning and inkling2
tool-call parsers; the model's window of 1,048,576 tokens and the 48 requests SGLang set itself, said so that
no later default moves them; and what every SGLang lane of this box passes besides (the key by --config, the
scheduler parked when idle, the metrics, the cache report). Its fetch pins refs/main, through which SGLang
reads the draft head by the model's name. Its caches keep the kernels its engine compiles at its first start.

The lane in every list: the registry, boxmem (refused on a 64 GB box: measured on a 128 GB one only), every
engine unit's Conflicts= and After=, the proxy's hold units and its pair's lane names, install.sh
(--with-inkling, --no-inkling, on demand by default, its boot kept by an update, its proof, its summary line),
switch-model.sh (target inkling), prepare-lane.sh, uninstall.sh (its image is its own: the uninstall takes its
tag and a prune reclaims it), check-pins.sh, the cockpit's sudoers lines, the CI's lists and gates, and
lane-templates-check.py (its template as published, rendered for every client shape as SGLang hands them).

The cockpit follows it as an SGLang text lane (the canary, the pool guard and the autoheal are its own), with
its card, its names, its note with the reference box's measures, its engine, its boot default (222 s
measured), its journal and its container; its mark is a plain badge of Thinking Machines' initials, no icon
set having one.

Its clients: opencode's provider inkling (oc-inkling.py), images in, five variants each a level its template
reads by name, a pair of 374,000 and 32,000 that fits the pool measured at its window, and oc-fit-limits.py
keeping that output as its ceiling whatever its window (ANSWER_CAPPED), as its card recommends limits on
output tokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 07:20:13 +01:00

175 lines
8.8 KiB
Python
Executable File

#!/usr/bin/env python3
"""Point an opencode.json at the served lane: default model + picker name.
Usage: oc-point-default.py <config.json> <lane: 27b|flash|kolibri|nemotron|nemotron-super|flash-local|ornith-122b|flash-unsloth|lfm25|lfm3|inkling> <choice> <window>
<window> is the served context window in tokens (1010000 or 262144, empty if
unknown): it sets the "(local, 1M|262K)" suffix on the served entry's name.
The per-target picker names live here and ONLY here: install.sh (generated
artifact and the config opencode actually reads) and switch-model.sh (both
configs) all call this, so a new target cannot update one spelling and
forget the other two. A config without the lane's provider is left untouched
with a NOTE (it predates the target: re-run ./install.sh to regenerate it).
The file is edited the way oc-merge-limits.py edits it, whose reader and writer
this uses: only "model", "small_model" and the served entry's "name" change, by a
targeted edit, after a backup, in one step. And "model" and "small_model" follow the
lane only when they are unset or already name one of this box's providers: a default
the user pointed elsewhere (another provider, a hosted model) is theirs, and is kept.
The whole file used to be rewritten by json.dump at every install and switch, with no
backup and in place: every non-ASCII character came back as an escape, every comment
made the file unreadable to it (exit 3, and the default no longer followed the lane),
and any other default model was replaced (found in review, 2026-09-24).
Usage: oc-point-default.py --label <choice> <window> prints the served entry's name,
for install.sh's generator to write the same one.
Usage: oc-point-default.py --name-only <config.json> <lane> <choice> <window> sets the
served entry's name alone, "model" and "small_model" left as they are: switch-model.sh
--clients, for a lane that serves while the boot names another (v1.48.1).
Exit 0 on success and on a missing provider (nothing to point at); exit 1 when the edit
could not be written; exit 2 on usage errors, exit 3 when the file is not usable JSON(C).
"""
import copy
import importlib.util
import json
import os
import sys
_spec = importlib.util.spec_from_file_location(
"oc_merge_limits", os.path.join(os.path.dirname(os.path.abspath(__file__)), "oc-merge-limits.py"))
ocm = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(ocm)
# The served-model-names are shared per lane (three 27B targets serve
# qwen3.8-27b, three flash targets serve qwen3.8-flash-next), so opencode
# shows one entry whatever is loaded behind it. Its label has to say WHICH
# checkpoint, otherwise the picker still reads "NVFP4" while the box serves
# FP8 (field case 2026-08-31).
LABEL = {"stock": "Qwen3.8-27B NVFP4 + DFlash2",
"uncensored": "Qwen3.8-27B NVFP4 abliterated + DFlash2",
"fp8": "Qwen3.8-27B FP8 official + DFlash2",
"uncensored-fp8": "Qwen3.8-27B FP8 abliterated + DFlash2",
# Nous Research's fine-tune of the 27B, served by the same unit under the same name.
"arete": "Arete-27B NVFP4 + DFlash2",
# RadixArk's RL-only fine-tune of the 27B, served by the same unit under the same name.
"daisyrose": "DaisyRose-27B NVFP4 + DFlash2",
"flash": "Qwen3.8-Flash-Next NVFP4 + MTP",
# The three flash targets share one served-model-name too, so the same
# rule applies: without an entry here the picker keeps saying NVFP4
# while the box serves the abliterated build.
"flash-uncensored": "Qwen3.8-Flash-Next NVFP4 abliterated + MTP",
"flash-nvda": "Qwen3.8-Flash-Next NVFP4 NVIDIA export + MTP",
# The Kolibri lane's two checkpoints share its one served-model-name, kolibri-1.
"kolibri": "Kolibri-1 FP8 official",
"kolibri-nvfp4": "Kolibri-1 NVFP4 experts",
# The Nemotron lanes, one checkpoint each, served as nemotron-3.5-bolt and nemotron-3.5-super-vl.
"nemotron": "Nemotron 3.5 Bolt",
"nemotron-super": "Nemotron 3.5 Super VL",
# NVIDIA's own FP4-Local build of the flash model, a lane of its own on vLLM.
"flash-local": "Qwen3.8-Flash-Next FP4-Local NVIDIA + MTP",
# Ornith AI's Ornith 1.5 122B, a lane of its own on vLLM.
"ornith-122b": "Ornith 1.5 122B NVFP4 + MTP",
# Unsloth's GGUF of the flash model, a lane of its own on llama.cpp, with ggml-org's DFlash2 draft: its two
# quantizations share its one served-model-name, qwen3.8-flash-next-unsloth.
"flash-unsloth": "Qwen3.8-Flash-Next Unsloth UD-Q4_K_XL + DFlash2",
"flash-unsloth-iq3": "Qwen3.8-Flash-Next Unsloth UD-IQ3_XXS + DFlash2",
# Liquid AI's official FP8 of LFM2.5 24B-A2B, a lane of its own on SGLang, with its official DSpark draft.
"lfm25": "Liquid AI LFM2.5 24B-A2B FP8 + DSpark",
# Liquid AI's official NVFP4 of LFM3 1.7B, a lane of its own on vLLM.
"lfm3": "Liquid AI LFM3 1.7B NVFP4",
# Thinking Machines' Inkling 2 Mini (mixed NVFP4 and MXFP8), a lane of its own on SGLang, with the DSpark draft
# head of its checkpoint.
"inkling": "Inkling 2 Mini + DSpark"}
def label_for(choice: str, window: str) -> str | None:
base = LABEL.get(choice)
if not base:
return None
try:
ctx = int(window or 0)
except ValueError:
ctx = 0
if ctx >= 1_000_000:
suffix = " (local, 1M)"
elif ctx:
suffix = f" (local, {ctx // 1000}K)"
else:
suffix = " (local)"
return base + suffix
def main() -> None:
if len(sys.argv) == 4 and sys.argv[1] == "--label":
print(label_for(sys.argv[2], sys.argv[3]) or "")
return
name_only = len(sys.argv) == 6 and sys.argv[1] == "--name-only"
if len(sys.argv) != 5 and not name_only:
print(__doc__.strip(), file=sys.stderr)
sys.exit(2)
path, lane, choice, window = sys.argv[2:6] if name_only else sys.argv[1:5]
want = {"flash": "flashnext/qwen3.8-flash-next", "kolibri": "kolibri/kolibri-1",
"nemotron": "nemotron/nemotron-3.5-bolt",
"nemotron-super": "nemotron-super/nemotron-3.5-super-vl",
"flash-local": "flash-local/qwen3.8-flash-next-fp4",
"ornith-122b": "ornith-122b/ornith-1.5-122b",
"flash-unsloth": "flash-unsloth/qwen3.8-flash-next-unsloth",
"lfm25": "lfm25/lfm2.5-24b-a2b",
"lfm3": "lfm3/lfm3-1.7b",
"inkling": "inkling/inkling-2-mini"}.get(lane, "qwen38/qwen3.8-27b")
prov, mid = want.split("/")
try:
text = ocm.read(path)
cfg = ocm.load(text)
if not isinstance(cfg, dict):
raise ValueError("the document is not an object")
except (OSError, ValueError) as e:
print(f"could not read {path}: {e}")
sys.exit(3)
if not isinstance(cfg.get("provider"), dict) or prov not in cfg["provider"]:
print(f"NOTE: provider '{prov}' is not in {path} (config predates this target);")
print(" re-run ./install.sh once to regenerate it, keeping your choices.")
return
new = copy.deepcopy(cfg)
new_text = text
kept = []
for key in () if name_only else ("model", "small_model"):
cur = cfg.get(key)
if cur == want:
continue
if isinstance(cur, str) and cur.split("/", 1)[0] not in ocm.OURS:
kept.append((key, cur))
continue
if cur is None and key == "small_model" and new.get("model") != want:
continue # unset under a default kept elsewhere: opencode derives it from that one
new[key] = want
new_text = ocm.set_member(new_text, [], key, json.dumps(want))
shown = ""
name = label_for(choice, window)
m = ocm._dig(cfg, "provider", prov, "models", mid)
if name and isinstance(m, dict):
shown = f", shown as {name!r}"
if m.get("name") != name:
new["provider"][prov]["models"][mid]["name"] = name
new_text = ocm.set_member(new_text, ["provider", prov, "models", mid], "name", json.dumps(name))
moved = cfg.get("model") != new.get("model") or cfg.get("small_model") != new.get("small_model")
if new_text == text:
print(f"opencode entry {want} ({path}){shown}: unchanged" if name_only else
f"opencode default model {'left as it is' if kept else 'already ' + want} ({path}){shown}: unchanged")
else:
saved, bad = ocm.commit(path, new_text, new)
if bad:
print(f"could not update {path}: {bad}")
sys.exit(1)
what = f"opencode default model -> {want}" if moved else f"opencode entry {want}"
print(f"{what} ({path}){shown} (backup {saved})")
for key, cur in kept:
print(f"NOTE: {key} in {path} is {cur}, not this box's: left as it is. This box serves")
print(f" {want}; pick it in opencode, or set \"{key}\" to it yourself.")
if __name__ == "__main__":
main()