Files
imladris/configs/opencode.nix
T
kyle c5fed8c604 straylight: raise OpenCode and llama-server timeouts to 2h
Local prefill and reasoning/coding turns often sit idle past OpenCode's
5–10 minute defaults. Align llama-server --timeout with that window.
2026-09-17 05:49:52 -07:00

75 lines
2.9 KiB
Nix

# OpenCode pointed at straylight's llama.cpp OpenAI-compatible API.
# Managed config lives in /etc/opencode/ (highest OpenCode precedence on Linux).
# llama-server is on straylight:11434; MagicDNS resolves that to loopback here.
{ pkgs, lib, ... }:
let
llamaBase = "http://straylight:11434/v1";
limit = { context = 131072; output = 32768; };
text = name: {
inherit name limit;
modalities = { input = [ "text" ]; output = [ "text" ]; };
};
vision = name: {
inherit name limit;
modalities = { input = [ "text" "image" ]; output = [ "text" ]; };
};
cfg = {
"$schema" = "https://opencode.ai/config.json";
enabled_providers = [ "llama.cpp" ];
model = "llama.cpp/laguna-s-2.1";
small_model = "llama.cpp/ornith-1.5-9b-uncensored";
provider = {
"llama.cpp" = {
npm = "@ai-sdk/openai-compatible";
name = "llama.cpp (straylight)";
options = {
baseURL = llamaBase;
apiKey = "none";
# Local prefill + Ornith <think> / Laguna coding turns routinely sit
# quiet for >10 minutes. OpenCode defaults are 300000ms (request,
# headers, and inter-chunk). Milliseconds; false disables.
timeout = 7200000;
headerTimeout = 7200000;
chunkTimeout = 7200000;
};
models = {
"laguna-s-2.1" = text "Laguna S 2.1";
"qwen3.6-35b-a3b-abliterated" = text "Qwen3.6 35B A3B";
"gemma4-26b-a4b-abliterated" = text "Gemma 4 26B A4B";
"ornith-1.0-35b" = text "Ornith 1.0 35B";
"ornith-1.5-9b-uncensored" = vision "Ornith 1.5 9B";
"ornith-1.5-35b-a3b" = text "Ornith 1.5 35B MoE";
"qwen3.8-27b-uncensored" = text "Qwen3.8 27B";
"qwen3.8-flash-next-uncensored" = vision "Qwen3.8 Flash Next";
"qwen3-vl-8b-abliterated" = vision "Qwen3-VL 8B";
};
};
};
agent = {
vision = {
description = "Look at images, screenshots, diagrams, UI captures, and other visual artifacts. Use whenever the task needs to see a picture rather than guess from a filename or OCR text.";
mode = "subagent";
model = "llama.cpp/qwen3-vl-8b-abliterated";
color = "accent";
permission = {
edit = "deny";
};
prompt = ''
You are a vision specialist running on Qwen3-VL-8B (abliterated) via llama.cpp.
You receive image paths and/or attached images. Describe what is actually in the image.
Transcribe visible text. Answer the caller's question about the image. Do not invent UI
that is not there. If the image cannot be read, say so and what you would need instead.
You may read files (including images) and run read-only shell commands. Do not edit the
workspace; report findings back to the parent agent.
'';
};
};
};
in
{
environment.etc."opencode/opencode.json".text = builtins.toJSON cfg;
}