opencode-auto-llm
auto-llm
Routing automatico del prompt verso il modello LLM migliore.
Skill per OpenCode / GitHub Copilot CLI
che analizza ogni prompt e seleziona il modello più adatto,
ottimizzando costo e qualità delle risposte.
Logica di routing
Installazione
# 1. Crea la directory delle skill mkdir -p ~/.agents/skills/auto-llm # 2. Copia i 3 file della skill cp auto_llm.js ~/.agents/skills/auto-llm/ cp skills.json ~/.agents/skills/auto-llm/ cp SKILL.md ~/.agents/skills/auto-llm/ # 3. Verifica che OpenCode la riconosca opencode agent list
Su Windows (PowerShell)
mkdir $env:USERPROFILE\.agents\skills\auto-llm -Force Copy-Item auto_llm.js, skills.json, SKILL.md -Destination $env:USERPROFILE\.agents\skills\auto-llm\ opencode agent list
Attivazione automatica (consigliata)
Aggiungi a ~/.config/opencode/opencode.json:
{
"default_agent": "auto-llm",
"agent": {
"auto-llm": {
"prompt": "Sei un router automatico di modelli LLM... [regole di routing]",
"options": {},
"permission": {}
}
}
}Utilizzo
# Sessione normale (usa automaticamente auto-llm se configurato come default) opencode # Oppure specificando l'agente opencode --agent auto-llm # Con modello specifico opencode run --model deepseek-v4-flash-free "refactoring del modulo auth"
Struttura del progetto
├── auto_llm.js ← Router programmatico (esporta handler)
├── skills.json ← Manifesto per runtime esterni
├── SKILL.md ← Skill per caricamento automatico OpenCode
├── AGENTS.md ← Istruzioni per agent OpenCode
├── AUTO_LLM_SKILL.md ← Documentazione dettagliata
└── README.md ← Questo file
Modelli disponibili
Test
node --input-type=module -e " import {handler} from 'file:///$HOME/.agents/skills/auto-llm/auto_llm.js'; const test = async (p, e) => { let s; await handler({prompt:p, run:({model})=>{s=model;return Promise.resolve()}}); console.log(s===e?'PASS':'FAIL', \`\"\${p}\" → \${s}\`); }; await test('generate a function','deepseek-v4-flash-free'); await test('debug this code','nemotron-3-ultra-free'); await test('analyze this image','mimo-v2.5-free'); await test('hi','north-mini-code-free'); "
Licenza
MIT
Per il codice sorgente e gli altri progetti visita il profilo GitHub di rsodvd79 .