freellm 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,7 +50,7 @@ Error generating stack: `+o.message+`
50
50
  0%, 60%, 100% { opacity: 0; }
51
51
  30% { opacity: 1; }
52
52
  }
53
- `}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"calc(100vh - 100px)",gap:12},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsx("h1",{children:"Playground"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[u&&a.jsxs("span",{className:"text-muted",style:{fontSize:12},children:["via ",u]}),a.jsxs("select",{value:l,onChange:S=>o(S.target.value),style:{width:"auto"},children:[a.jsx("option",{value:"auto",children:"auto (smart routing)"}),g.map(S=>a.jsx("option",{value:S.id,children:S.display_name},S.id))]}),P&&a.jsx("span",{className:"badge badge-gray",style:{fontSize:11},children:pc(P.platform)}),a.jsx("button",{className:"btn-ghost",style:{fontSize:13},onClick:()=>y(S=>!S),children:C?"Hide API code":"View API code"}),a.jsx("button",{className:"btn-ghost",style:{fontSize:13},onClick:()=>{t([]),d("")},children:"Clear"})]})]}),a.jsxs("div",{style:{display:"flex",gap:12,flex:1,minHeight:0},children:[a.jsxs("div",{style:{flex:1,overflow:"auto",display:"flex",flexDirection:"column",gap:12,minWidth:0},children:[e.length===0&&a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--muted)",textAlign:"center"},children:a.jsxs("div",{children:[a.jsx("p",{style:{fontSize:18},children:"FreeLLM Playground"}),a.jsx("p",{style:{marginTop:8,fontSize:13},children:"Send a message to test your LLM configuration"})]})}),e.map((S,_)=>a.jsx("div",{style:{display:"flex",justifyContent:S.role==="user"?"flex-end":"flex-start"},children:a.jsx("div",{style:{maxWidth:"70%",background:S.role==="user"?"var(--accent)":"var(--surface)",border:S.role==="user"?"none":"1px solid var(--border)",borderRadius:12,padding:"10px 14px",fontSize:14,lineHeight:1.5,whiteSpace:"pre-wrap"},children:S.content||(i&&_===e.length-1?a.jsxs("span",{className:"loading-dots",children:[a.jsx("span",{children:"."}),a.jsx("span",{children:"."}),a.jsx("span",{children:"."})]}):"")})},_)),a.jsx("div",{ref:D})]}),C&&a.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",gap:8,width:360,flexShrink:0,overflow:"auto"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsx("h2",{style:{fontSize:14},children:"Sample API request"}),a.jsxs("div",{style:{display:"flex",gap:4},children:[a.jsx("button",{className:"btn-ghost",style:{padding:"4px 12px",fontSize:12},onClick:()=>{navigator.clipboard.writeText(E),w(!0),setTimeout(()=>w(!1),2e3)},children:h?"Copied!":"Copy"}),a.jsx("button",{className:"btn-ghost",style:{padding:"4px 12px",fontSize:12},onClick:()=>y(!1),children:"Close"})]})]}),a.jsx("pre",{style:{background:"#111",border:"1px solid var(--border)",borderRadius:6,padding:12,fontSize:12,overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:E})]})]}),a.jsxs("div",{style:{display:"flex",gap:8},children:[a.jsx("textarea",{ref:p,value:n,onChange:S=>r(S.target.value),onKeyDown:S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),c())},placeholder:"Type a message… (Enter to send, Shift+Enter for newline)",rows:3,style:{resize:"none",flex:1},disabled:i}),a.jsx("button",{className:"btn-primary",onClick:c,disabled:i||!n.trim(),style:{alignSelf:"flex-end",padding:"8px 20px"},children:i?"…":"Send"})]})]})]})}const lp=[{label:"24h",hours:24},{label:"7d",hours:168},{label:"30d",hours:720}];function Ht(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":String(e)}function op(){const[e,t]=z.useState(null),[n,r]=z.useState(24);if(z.useEffect(()=>{H.getAnalytics(n).then(t).catch(console.error)},[n]),!e)return a.jsx("div",{className:"text-muted",children:"Loading…"});const l=e.total>0?Math.round(e.success/e.total*100):0,o=e.totalPromptTokens+e.totalCompleteTokens;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsx("h1",{children:"Analytics"}),a.jsx("div",{style:{display:"flex",gap:4},children:lp.map(i=>a.jsx("button",{onClick:()=>r(i.hours),style:{background:n===i.hours?"var(--accent)":"transparent",color:n===i.hours?"white":"var(--muted)",padding:"4px 12px",borderRadius:6,fontSize:13,border:"1px solid var(--border)"},children:i.label},i.hours))})]}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:12},children:[{label:"Total requests",value:Ht(e.total)},{label:"Success rate",value:`${l}%`},{label:"Total tokens",value:Ht(o)},{label:"Avg latency",value:`${e.avgLatencyMs}ms`}].map(i=>a.jsxs("div",{className:"card",style:{textAlign:"center"},children:[a.jsx("div",{style:{fontSize:24,fontWeight:700},children:i.value}),a.jsx("div",{className:"text-muted",style:{marginTop:4},children:i.label})]},i.label))}),a.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",gap:8},children:[a.jsx("h2",{children:"Token usage"}),a.jsxs("div",{style:{display:"flex",gap:24},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:18,fontWeight:600},children:Ht(e.totalPromptTokens)}),a.jsx("div",{className:"text-muted",style:{fontSize:12},children:"Prompt tokens"})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:18,fontWeight:600},children:Ht(e.totalCompleteTokens)}),a.jsx("div",{className:"text-muted",style:{fontSize:12},children:"Completion tokens"})]})]})]}),Object.keys(e.byPlatform).length>0&&a.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",gap:8},children:[a.jsx("h2",{children:"By provider"}),Object.entries(e.byPlatform).sort((i,s)=>s[1].requests-i[1].requests).map(([i,s])=>a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"6px 0",borderBottom:"1px solid var(--border)"},children:[a.jsx("span",{style:{width:120,fontSize:14,fontWeight:500},children:i}),a.jsxs("span",{style:{flex:1,fontSize:13},children:[Ht(s.requests)," requests · ",Ht(s.tokens)," tokens"]}),a.jsx("div",{style:{width:100,height:4,background:"var(--border)",borderRadius:2},children:a.jsx("div",{style:{height:"100%",borderRadius:2,background:"var(--accent)",width:`${Math.min(100,s.requests/(e.total||1)*100)}%`}})})]},i))]}),e.total===0&&a.jsxs("p",{className:"text-muted",children:["No requests yet. Use the Playground or point an OpenAI client at ",a.jsx("span",{className:"code",children:"http://localhost:PORT/v1"}),"."]})]})}const ql=`
53
+ `}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"calc(100vh - 100px)",gap:12},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsx("h1",{children:"Playground"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[u&&a.jsxs("span",{className:"text-muted",style:{fontSize:12},children:["via ",u]}),a.jsxs("select",{value:l,onChange:S=>o(S.target.value),style:{width:"auto"},children:[a.jsx("option",{value:"auto",children:"auto (smart routing)"}),g.map(S=>a.jsx("option",{value:S.id,children:S.display_name},S.id))]}),P&&a.jsx("span",{className:"badge",style:{fontSize:11,background:"#312e81",color:"#c7d2fe"},children:pc(P.platform)}),a.jsx("button",{className:"btn-ghost",style:{fontSize:13},onClick:()=>y(S=>!S),children:C?"Hide API code":"View API code"}),a.jsx("button",{className:"btn-ghost",style:{fontSize:13},onClick:()=>{t([]),d("")},children:"Clear"})]})]}),a.jsxs("div",{style:{display:"flex",gap:12,flex:1,minHeight:0},children:[a.jsxs("div",{style:{flex:1,overflow:"auto",display:"flex",flexDirection:"column",gap:12,minWidth:0},children:[e.length===0&&a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--muted)",textAlign:"center"},children:a.jsxs("div",{children:[a.jsx("p",{style:{fontSize:18},children:"FreeLLM Playground"}),a.jsx("p",{style:{marginTop:8,fontSize:13},children:"Send a message to test your LLM configuration"})]})}),e.map((S,_)=>a.jsx("div",{style:{display:"flex",justifyContent:S.role==="user"?"flex-end":"flex-start"},children:a.jsx("div",{style:{maxWidth:"70%",background:S.role==="user"?"var(--accent)":"var(--surface)",border:S.role==="user"?"none":"1px solid var(--border)",borderRadius:12,padding:"10px 14px",fontSize:14,lineHeight:1.5,whiteSpace:"pre-wrap"},children:S.content||(i&&_===e.length-1?a.jsxs("span",{className:"loading-dots",children:[a.jsx("span",{children:"."}),a.jsx("span",{children:"."}),a.jsx("span",{children:"."})]}):"")})},_)),a.jsx("div",{ref:D})]}),C&&a.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",gap:8,width:360,flexShrink:0,overflow:"auto"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsx("h2",{style:{fontSize:14},children:"Sample API request"}),a.jsxs("div",{style:{display:"flex",gap:4},children:[a.jsx("button",{className:"btn-ghost",style:{padding:"4px 12px",fontSize:12},onClick:()=>{navigator.clipboard.writeText(E),w(!0),setTimeout(()=>w(!1),2e3)},children:h?"Copied!":"Copy"}),a.jsx("button",{className:"btn-ghost",style:{padding:"4px 12px",fontSize:12},onClick:()=>y(!1),children:"Close"})]})]}),a.jsx("pre",{style:{background:"#111",border:"1px solid var(--border)",borderRadius:6,padding:12,fontSize:12,overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:E})]})]}),a.jsxs("div",{style:{display:"flex",gap:8},children:[a.jsx("textarea",{ref:p,value:n,onChange:S=>r(S.target.value),onKeyDown:S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),c())},placeholder:"Type a message… (Enter to send, Shift+Enter for newline)",rows:3,style:{resize:"none",flex:1},disabled:i}),a.jsx("button",{className:"btn-primary",onClick:c,disabled:i||!n.trim(),style:{alignSelf:"flex-end",padding:"8px 20px"},children:i?"…":"Send"})]})]})]})}const lp=[{label:"24h",hours:24},{label:"7d",hours:168},{label:"30d",hours:720}];function Ht(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":String(e)}function op(){const[e,t]=z.useState(null),[n,r]=z.useState(24);if(z.useEffect(()=>{H.getAnalytics(n).then(t).catch(console.error)},[n]),!e)return a.jsx("div",{className:"text-muted",children:"Loading…"});const l=e.total>0?Math.round(e.success/e.total*100):0,o=e.totalPromptTokens+e.totalCompleteTokens;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsx("h1",{children:"Analytics"}),a.jsx("div",{style:{display:"flex",gap:4},children:lp.map(i=>a.jsx("button",{onClick:()=>r(i.hours),style:{background:n===i.hours?"var(--accent)":"transparent",color:n===i.hours?"white":"var(--muted)",padding:"4px 12px",borderRadius:6,fontSize:13,border:"1px solid var(--border)"},children:i.label},i.hours))})]}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:12},children:[{label:"Total requests",value:Ht(e.total)},{label:"Success rate",value:`${l}%`},{label:"Total tokens",value:Ht(o)},{label:"Avg latency",value:`${e.avgLatencyMs}ms`}].map(i=>a.jsxs("div",{className:"card",style:{textAlign:"center"},children:[a.jsx("div",{style:{fontSize:24,fontWeight:700},children:i.value}),a.jsx("div",{className:"text-muted",style:{marginTop:4},children:i.label})]},i.label))}),a.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",gap:8},children:[a.jsx("h2",{children:"Token usage"}),a.jsxs("div",{style:{display:"flex",gap:24},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:18,fontWeight:600},children:Ht(e.totalPromptTokens)}),a.jsx("div",{className:"text-muted",style:{fontSize:12},children:"Prompt tokens"})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:18,fontWeight:600},children:Ht(e.totalCompleteTokens)}),a.jsx("div",{className:"text-muted",style:{fontSize:12},children:"Completion tokens"})]})]})]}),Object.keys(e.byPlatform).length>0&&a.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",gap:8},children:[a.jsx("h2",{children:"By provider"}),Object.entries(e.byPlatform).sort((i,s)=>s[1].requests-i[1].requests).map(([i,s])=>a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"6px 0",borderBottom:"1px solid var(--border)"},children:[a.jsx("span",{style:{width:120,fontSize:14,fontWeight:500},children:i}),a.jsxs("span",{style:{flex:1,fontSize:13},children:[Ht(s.requests)," requests · ",Ht(s.tokens)," tokens"]}),a.jsx("div",{style:{width:100,height:4,background:"var(--border)",borderRadius:2},children:a.jsx("div",{style:{height:"100%",borderRadius:2,background:"var(--accent)",width:`${Math.min(100,s.requests/(e.total||1)*100)}%`}})})]},i))]}),e.total===0&&a.jsxs("p",{className:"text-muted",children:["No requests yet. Use the Playground or point an OpenAI client at ",a.jsx("span",{className:"code",children:"http://localhost:PORT/v1"}),"."]})]})}const ql=`
54
54
  :root {
55
55
  --bg: #0f0f0f;
56
56
  --surface: #1a1a1a;
@@ -8,7 +8,7 @@
8
8
  * { box-sizing: border-box; margin: 0; padding: 0; }
9
9
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f0f0f; color: #e1e1e1; }
10
10
  </style>
11
- <script type="module" crossorigin src="/assets/index-DIh-PK3v.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-cDIZ2w-M.js"></script>
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freellm",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "One OpenAI-compatible endpoint for 15+ free LLM providers. Smart routing, failover, encrypted keys. Run with npx freellm.",
5
5
  "keywords": ["llm", "openai", "proxy", "groq", "gemini", "mistral", "free", "api-gateway"],
6
6
  "author": "",