grix-connector
Version:
Connect local AI coding agents (Claude, Codex, Gemini, Qwen, DeepSeek, Cursor, OpenCode, Pi, OpenHuman, Reasonix) to the Grix scheduling platform. Also serves as an OpenClaw plugin for Grix channel transport.
3 lines (2 loc) • 757 B
JavaScript
import{readStdinJSON as p}from"./lib/read-stdin.js";async function u(){const c=process.env.GRIX_CLAUDE_INTERNAL_API_URL,i=process.env.GRIX_CLAUDE_INTERNAL_API_TOKEN;(!c||!i)&&process.exit(0);const o=await p(2e3);try{const t=new AbortController,d=setTimeout(()=>t.abort(),2e3);await fetch(`${c}/api/status-line?token=${i}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o),signal:t.signal}),clearTimeout(d)}catch{}const r=o.context_window,a=o.cost,l=o.model,n=r?.used_percentage,s=a?.total_cost_usd,e=l?.id;if(n!=null||s!=null||e){const t=[];n!=null&&t.push(`ctx: ${n}%`),s!=null&&t.push(`$${Number(s).toFixed(2)}`),e&&t.push(String(e)),process.stdout.write(t.join(" | "))}}u().catch(()=>process.exit(0));