A comprehensive reference and side-by-side configuration guide for deploying the qwen3.8:27b-mlx model across both Pi Agent (~/.pi/agent/models.json) and OpenCode (~/.config/opencode/opencode.jsonc) agent harnesses.
| { | |
| "$schema": "https://opencode.ai/config.json", | |
| "model": "ollama/qwen2.5-coder:7b", | |
| "provider": { |
| { | |
| "providers": { | |
| "ollama": { | |
| "name": "Local Ollama", | |
| "baseUrl": "http://localhost:11434/v1", | |
| "apiKey": "ollama", | |
| "api": "openai-completions", | |
| "authHeader": false, | |
| "headers": {}, | |
| "models": [ |
A complete, production-grade guide for configuring a dedicated headless Apple Silicon Mac (M3, M4, and M5 generations) using Ollama. This setup is 100% agent-agnostic, serving a high-speed OpenAI-compatible API (/v1) for any client, coding assistant, or agent framework.
A comprehensive, hardware-agnostic reference guide for configuring Large Language Model (LLM) context windows, output limits, Key-Value (KV) cache memory footprints, compaction strategies, and agent token budgets across Pi Agent, OpenCode, Ollama, and llama.cpp/vLLM.
Every LLM request operates inside a finite token budget:
This guide details how to maximize Unified Memory (vRAM) allocation for local LLM inference on Apple Silicon Macs (M-series) running macOS, specifically tailored for Ollama and high-demand workloads like Qwen models (qwen3.6:27b-mxfp8 and qwen3.6:35b-a3b-mxfp8).
By default, macOS allocates roughly 75%–80% of total unified memory to the GPU/vRAM, reserving the remainder for the system and desktop applications. When running large models with extended context windows (KV cache), manual overrides grant additional headroom to prevent out-of-memory errors or swapping.
A unified, production-grade guide for configuring local and private LLM providers across both Pi Agent (~/.pi/agent/models.json) and OpenCode (~/.config/opencode/opencode.jsonc), structured across hardware RAM tiers (16 GB to 256 GB).
Both Pi Agent and OpenCode support running local models (via Ollama, MLX, llama.cpp, vLLM, or LM Studio) with OpenAI-compatible endpoints.
| #!/usr/bin/env python3 | |
| """ | |
| Ollama & LLM Safe Context Length Calculator | |
| Calculates recommended context length (num_ctx / max_ctx) based on VRAM, | |
| model architecture (GQA, layers, heads), weight size, and KV cache footprint. | |
| Includes dynamic Adaptive Safety Margin calculation based on model scale and live OS memory pressure. | |
| """ | |
| import argparse | |
| import json |