import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; // Local llama.cpp server (llama-server) exposing an OpenAI-compatible API. // Mirrors .opencode/opencode.json -> provider "llama.cpp". // // Start the server with the scripts in ./llama-cpp/ (run_ornith.sh / run_gemma4.sh), // which listen on http://0.0.0.0:8080 and register model aliases "ornith-1.0" and // "gemma-4" respectively. const BASE_URL = "http://localhost:8080/v1"; const MODELS = [ { id: "ornith-1.0", name: "Ornith 1.0 (llama.cpp)", reasoning: true, input: ["text", "image"] as const, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 65536, maxTokens: 8192, }, { id: "gemma-4", name: "Gemma 4 12B (llama.cpp)", reasoning: true, input: ["text", "image"] as const, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 131072, maxTokens: 8192, }, ]; export default function (pi: ExtensionAPI) { pi.registerProvider("llama-cpp", { name: "llama.cpp (local)", baseUrl: BASE_URL, // llama-server accepts any bearer token; send a placeholder so the // Authorization header is present. apiKey: "llama-cpp", authHeader: true, api: "openai-completions", models: MODELS, }); }