FFFF GitHub - kjaanson/inkling-server: OpenAI-compatible server for Inkling 2 Mini on Apple Silicon, built on the erisinky Rust + Metal engine (M1-M4 fixes, NVFP4, prompt cache, vision, LoRA) · GitHub
[go: up one dir, main page]

Skip to content

About

OpenAI-compatible server for Inkling 2 Mini on Apple Silicon, built on the erisinky Rust + Metal engine (M1-M4 fixes, NVFP4, prompt cache, vision, LoRA)

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

Repository files navigation

inkling-server

Running Thinking Machines' Inkling 2 Mini locally on an Apple M1 Pro (32 GB) with erisinky (inkling), a hand-written Rust + Metal engine, plus an OpenAI-compatible server for chat UIs, agent harnesses (pi) and SDKs. The engine is a git submodule: our fork kjaanson/erisinky, branch local2-pr3 (upstream + M1-M4 fixes, NVFP4, state save/restore, vision, LoRA; see Engine branches).

LM Studio (llama.cpp) inkling (this setup)
prompt processing (2.4K tokens) 88 tok/s 270 tok/s
generation 15-16 tok/s 25-27 tok/s
largest context that fits – ~245K tokens (NVFP4 model)

Getting the code

git clone --recursive https://github.com/kjaanson/inkling-server.git
cd inkling-server                       # direnv allow (nix dev shell), or any Rust toolchain + Xcode command line tools
(cd erisinky && cargo build --release) && (cd server && cargo build --release)

Models are not in the repo: LM Studio's Inkling-2-Mini-Q4_K_M.gguf works as is (-m PATH); the smaller NVFP4 hybrid the launcher defaults to is built with tools/build_hybrid.py into models/. Images need LM Studio's mmproj-Inkling-2-Mini-BF16.gguf. llama.cpp/ (the reference for the correctness checks) is cloned separately.

Quick start

Everything runs inside the project folder: direnv loads the nix dev shell (Rust toolchain) and puts bin/ on PATH.

cd inkling-server                        # direnv: nix shell + bin/ on PATH

inkling serve                            # OpenAI-compatible API on http://127.0.0.1:8080/v1 (124K context)
inkling stop                             # stop the server
inkling chat                             # interactive chat in the terminal
inkling run -p "Explain RAID 5 briefly."   # one prompt, streamed
inkling run -p "What is in this picture?" --image photo.jpg   # images (also /image FILE in chat)

bin/inkling uses models/Inkling-2-Mini-NVFP4-hybrid.gguf unless you pass -m, -c 124000 for serve unless you pass -c, and for serve / chat / run the vision projector LM Studio ships (mmproj-Inkling-2-Mini-BF16.gguf) unless you pass --mmproj. Anything else goes straight through, for example:

inkling serve --port 8081 -c 32768 --effort low
inkling chat --effort none --hide-thinking
inkling chat -m ~/.cache/lm-studio/models/lmstudio-community/Inkling-2-Mini-GGUF/Inkling-2-Mini-Q4_K_M.gguf

Stop a running server with inkling stop. The server only listens on localhost; for other machines on the network: INKLING_API_KEY=some-secret inkling serve --host 0.0.0.0 (clients then send that key as their API key). Only one server can use port 8080 at a time.

Build (after changing code or pulling)

(cd erisinky && cargo build --release)       # engine CLI   -> erisinky/target/release/inkling
(cd server && cargo build --release)     # server       -> server/target/release/inkling-server

Using the server

  • OpenAI SDK / curl: base URL http://127.0.0.1:8080/v1, any API key (unless the server has one), model inkling-2-mini. Chat completions (streaming too), reasoning_content, tool calls, reasoning_effort (none … xhigh).
  • Images and documents: image_url parts with data: URLs (user and tool messages), and file parts with base64 file_data: PDF (text layer; scanned pages are read as images), Word, RTF, HTML, ODT, text. Details: server/README.md.
  • pi: ~/.pi/agent/models.json has an inkling provider (124K context). Run pi --model inkling/inkling-2-mini or pick it with /model; :low etc. sets the thinking level.
  • Anthropic-style API and others: put a LiteLLM proxy in front, using the hosted_vllm provider. The config is in server/README.md.
  • Prompt cache: follow-up turns, new sessions with the same system prompt, and "regenerate" only process new tokens. States are cached in RAM and in ~/.cache/inkling-server (survives restarts; rm -rf it to clear).
  • One generation at a time; other requests queue.

Full option list, API details and tests: server/README.md.

Layout

path what in this git repo
bin/inkling launcher for the engine CLI and inkling serve yes
server/ inkling-server, the OpenAI-compatible API; uses the engine as a library (erisinky/src/lib.rs) yes
refs/vision/ llama.cpp image references (erisinky/tools/ref_vision.cpp) tokens/meta only
tools/build_hybrid.py builds the NVFP4-expert model file from LM Studio's Q4_K_M + Unsloth's Q8_K_XL yes
NOTES.md detailed notes: what was changed and measured, ruled-out ideas, upstream plan yes
flake.nix, .envrc nix + direnv dev shell yes
patches/ backup diffs (engine changes, upstream PR #2) yes
refs/ llama.cpp reference token dumps for correctness checks (logits not tracked) tokens only
erisinky/ the engine: submodule, fork kjaanson/erisinky branch local2-pr3 (= upstream + all our changes) submodule
llama.cpp/, tools-bin/ llama.cpp master, used as the correctness oracle no
models/ the 15.35 GB NVFP4 hybrid model no

Engine branches (erisinky/)

Checked out: local2-pr3 = upstream main (2026-11-27) + our topic branches + upstream PR #3 (tensor-op prefill on pre-M5 GPUs) + NVFP4 support for it. local2 is the same without PR #3. The old local (on the 2026-11-22 upstream) is kept; the server no longer builds against it (it needs upstream's lib.rs). Topic branches: m1-fixes, nvfp4, state-api, pr2, vision, pr3 (as fetched). local2-pr3 and the upstream PR branches (pr/*, drafts in patches/upstream-prs.md) are on the fork. After git pull, run git submodule update to move erisinky/ to the recorded commit. Details: NOTES.md.

Checks

cd erisinky && ./target/release/inkling check --ref ../refs/short -m <Q4_K_M path>     # vs llama.cpp: 60/60
cd server && ./target/release/inkling-server cachetest -m ../models/Inkling-2-Mini-NVFP4-hybrid.gguf
cd server && tests/render/check.sh                                                    # prompt format vs llama.cpp

License

GPL-3.0-or-later (LICENSE), like the erisinky engine this builds on. patches/upstream-pr2.diff is upstream erisinky PR #2 by its author; tools/ref_logits_lora.cpp is erisinky's tools/ref_logits.cpp with LoRA loading added.

About

OpenAI-compatible server for Inkling 2 Mini on Apple Silicon, built on the erisinky Rust + Metal engine (M1-M4 fixes, NVFP4, prompt cache, vision, LoRA)

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0