# model-for-opencode: a small local model on an OpenAI-compatible endpoint, # for an opencode (or any client) running outside the capsule. # # What this example adds to hello-world: # - a GPU: [hardware] says what it needs, [runtime] gpu = true; # - [[artifacts]]: the weights, downloaded and hashed by m64, mounted read-only. # Weights never go in the folder (5 MB per file, 10 MB in total); # - a ready-made engine image (llama.cpp's server), pinned by digest. # It needs no network at run time and no secret: everything is local. schema = "m64/capsule@1" description = "A small local model for opencode: Qwen3 4B (Q4_K_M GGUF) on llama.cpp's server, an OpenAI-compatible chat endpoint with tool calls, for opencode running on your own machine. About 6 GB of VRAM, 32k context. Needs no network." kinds = ["chat"] authors = ["motif42"] license = "mit" [hardware] platform = "linux-x86_64" # Matched as a substring of the GPU's name, so any NVIDIA card passes; a # mismatch only warns. The image below also has an arm64 build: on a GB10, # set platform = "linux-aarch64" and gpu = "NVIDIA GB10". gpu = "NVIDIA" gpu_count = 1 # 2.5 GB of weights + 2.4 GB of 8-bit KV cache at 32k tokens + CUDA's overhead. vram_gb = 6 # The image is CUDA 12.8. driver = ">=570" disk_gb = 6 [runtime] sandbox = "container" # ghcr.io/ggml-org/llama.cpp:server-cuda, build b12030 (llama.cpp commit # a91eab67d8389d979d29fdf6633b2edd0718eb4b), multi-arch index digest. Tags move; # a digest is exactly one image. image = "ghcr.io/ggml-org/llama.cpp@sha256:75037a842f2ec1d1b5317ce64078bbb4a2a134238e91a755c10ce31d8f90550a" gpu = true internal_port = 9000 # llama-server answers 503 while it loads the model, 200 once it is ready. health = "/health" expected_load_seconds = 60 # The front rewrites every request's "model" to this; start.sh gives # llama-server the same alias. It is also the name to use in opencode. model_name = "qwen3-4b" user = "65534:65534" # The model: Qwen's own GGUF build, at a fixed commit. m64 downloads only the # files in `include`, checks them, and mounts them read-only at `mount`. Pickle # formats (.bin .pt .pth .ckpt .pkl) are refused: GGUF and safetensors only. [[artifacts]] type = "hf" repo = "Qwen/Qwen3-4B-GGUF" revision = "bc640142c66e1fdd12af0bd68f40445458f3869b" include = ["LICENSE", "Qwen3-4B-Q4_K_M.gguf"] mount = "/weights/qwen3-4b"