@@ -209,6 +209,33 @@ function Set-ClaudeLocalEnv {
209209 $env: ENABLE_TOOL_SEARCH = " false"
210210}
211211
212+ function Set-LocalBackendTelemetryEnv {
213+ [CmdletBinding ()]
214+ param (
215+ [Parameter (Mandatory = $true )][int ]$ProcessId ,
216+ [Parameter (Mandatory = $true )][int ]$Port ,
217+ [Parameter (Mandatory = $true )][string ]$OutLogPath ,
218+ [Parameter (Mandatory = $true )][string ]$ErrLogPath ,
219+ [Parameter (Mandatory = $true )][string ]$GgufPath ,
220+ [Parameter (Mandatory = $true )][string ]$Model ,
221+ [Parameter (Mandatory = $true )][string ]$ContextKey ,
222+ [int ]$ContextTokens = 0
223+ )
224+
225+ $env: LOCALBOX_BACKEND = " llama.cpp"
226+ $env: LOCALBOX_LLAMA_SERVER_PID = [string ]$ProcessId
227+ $env: LOCALBOX_LLAMA_SERVER_PORT = [string ]$Port
228+ $env: LOCALBOX_LLAMA_SERVER_OUT_LOG = $OutLogPath
229+ $env: LOCALBOX_LLAMA_SERVER_ERR_LOG = $ErrLogPath
230+ $env: LOCALBOX_LLAMA_SERVER_GGUF = $GgufPath
231+ $env: LOCALBOX_LLAMA_SERVER_MODEL = $Model
232+ $env: LOCALBOX_CONTEXT_KEY = $ContextKey
233+ if ($ContextTokens -gt 0 ) {
234+ $env: LOCALBOX_CONTEXT_TOKENS = [string ]$ContextTokens
235+ }
236+ $env: LOCALBOX_LOW_TPS_WARNING = " 2"
237+ }
238+
212239function Start-NoThinkProxy {
213240 # Puts the no-think proxy in front of llama-server at -TargetPort. The
214241 # proxy strips Anthropic thinking-config from requests and <think>...
@@ -1591,6 +1618,7 @@ function Start-ClaudeWithLlamaCppModel {
15911618 }
15921619
15931620 Set-ClaudeLocalEnv - BaseUrl $effectiveBaseUrl - Model $def.Root - KeepThinking:($thinkingPolicy -eq ' keep' ) - ContextTokens $contextTokens
1621+ Set-LocalBackendTelemetryEnv - ProcessId $proc.Id - Port $port - OutLogPath $logPaths.Out - ErrLogPath $logPaths.Err - GgufPath $ggufPath - Model $def.Root - ContextKey $ContextKey - ContextTokens $contextTokens
15941622
15951623 $backendLabel = if ($Unshackled ) { " unshackled" } else { " claude" }
15961624 $toolsLabel = if ($LimitTools ) { " limited" } else { " all" }
0 commit comments