Make Codex and Claude Code subscriptions go further: a local model router that gives routine agent work to economical models and keeps your strongest model for the hard parts.
Rust ai-agentsai-gatewayclaude-codecodexcoding-agentcost-optimizationdeepseekllm-gatewayllm-routerlocal-firstmodel-routingrusttask-routingtauri
import { useEffect, useState } from 'react';
import { observationRead } from '../observation-client';
import type { TrustReport } from './types';
export function useTrustEvidence(planId: string | undefined, active: boolean, refreshVersion: number) {
const [data, setData] = useState<TrustReport | null>(null);
const [error, setError] = useState(false);
useEffect(() => {
if (!planId || !active) return;
let current = true;
setData(null); setError(false);
observationRead<TrustReport>('plan_trust', { plan_id: planId, revision: 'active' })
.then(value => { if (current) setData(value); })
.catch(() => { if (current) setError(true); });
return () => { current = false; };
}, [planId, active, refreshVersion]);
return { data, error };
}