From d86710577d343ca38c163c0c73e60714b760d693 Mon Sep 17 00:00:00 2001 From: William Valentin Date: Thu, 5 Feb 2026 13:20:20 -0800 Subject: [PATCH] feat: wire up LlamaCppClient to model router Co-Authored-By: Claude Opus 4.5 --- src/daemon/index.ts | 7 ++++++- src/models/index.ts | 1 + src/models/local/index.ts | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/daemon/index.ts b/src/daemon/index.ts index a8cdffa..a1a41cb 100644 --- a/src/daemon/index.ts +++ b/src/daemon/index.ts @@ -1,7 +1,7 @@ import { Bot } from 'grammy'; import { Lifecycle } from './lifecycle.js'; import type { Config } from '../config/index.js'; -import { AnthropicClient, OpenAIClient, OllamaClient, ModelRouter } from '../models/index.js'; +import { AnthropicClient, OpenAIClient, OllamaClient, LlamaCppClient, ModelRouter } from '../models/index.js'; import { NativeAgent } from '../backends/index.js'; import { createTelegramBot } from '../frontends/telegram/index.js'; import { SessionStore, SessionManager } from '../session/index.js'; @@ -60,6 +60,11 @@ function createModelRouter(config: Config): ModelRouter { model: models.local.model, host: models.local.endpoint, }); + } else if (models.local.provider === 'llamacpp') { + localClient = new LlamaCppClient({ + endpoint: models.local.endpoint ?? 'http://localhost:8080', + authToken: models.local.auth_token, + }); } } diff --git a/src/models/index.ts b/src/models/index.ts index 3ec116f..4bd956c 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -1,5 +1,6 @@ export { AnthropicClient, type AnthropicClientConfig } from './anthropic.js'; export { OpenAIClient, type OpenAIClientConfig } from './openai.js'; export { OllamaClient, type OllamaClientConfig } from './local/index.js'; +export { LlamaCppClient, type LlamaCppClientConfig } from './local/index.js'; export { ModelRouter, type ModelRouterConfig, type ModelTier } from './router.js'; export type { Message, ChatRequest, ChatResponse, ModelClient } from './types.js'; diff --git a/src/models/local/index.ts b/src/models/local/index.ts index a854196..897e345 100644 --- a/src/models/local/index.ts +++ b/src/models/local/index.ts @@ -1 +1,2 @@ export { OllamaClient, type OllamaClientConfig } from './ollama.js'; +export { LlamaCppClient, type LlamaCppClientConfig } from './llamacpp.js';