@opennodes/registry 0.1.37 → 0.1.39
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.
- package/package.json +2 -2
- package/src/importers.js +7 -1
- package/src/search.js +31 -2
- package/src/server.js +3 -2
- package/src/web/index.html +151 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opennodes/registry",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"description": "OpenNodes (ONP) reference registry: node registration with proof-of-resource qualification (Stage A/B/C), transparent ranking, enforceable estimates, catalog importers (OpenRouter, Hugging Face, models.dev, Ollama), MCP surface, and the web app (catalog, chat, advisor, Node Builder)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@opennodes/core": "0.1.
|
|
46
|
+
"@opennodes/core": "0.1.17",
|
|
47
47
|
"pg": "^8.13.1"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/importers.js
CHANGED
|
@@ -247,6 +247,11 @@ export async function importHuggingFace(store, router, hub = []) {
|
|
|
247
247
|
|
|
248
248
|
export const OLLAMA_LIBRARY_URL = 'https://ollama.com/library';
|
|
249
249
|
|
|
250
|
+
/** Text of an HTML fragment: the library page escapes apostrophes and ampersands (' &). */
|
|
251
|
+
const decodeEntities = (t) => t.replace(/&(#(\d+)|#x([0-9a-f]+)|amp|lt|gt|quot|apos);/gi, (m, _, dec, hex) =>
|
|
252
|
+
dec ? String.fromCodePoint(Number(dec)) : hex ? String.fromCodePoint(parseInt(hex, 16))
|
|
253
|
+
: { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'" }[m.slice(1, -1).toLowerCase()]);
|
|
254
|
+
|
|
250
255
|
/** Parse ollama.com/library HTML into entries. Resilient to styling churn:
|
|
251
256
|
* anchors on /library/{name}, spans classified by content (sizes look like "27b"/"270m"). */
|
|
252
257
|
export function parseOllamaLibrary(html) {
|
|
@@ -256,7 +261,8 @@ export function parseOllamaLibrary(html) {
|
|
|
256
261
|
const name = block.match(/^([a-z0-9._-]+)"/)?.[1];
|
|
257
262
|
if (!name) continue;
|
|
258
263
|
const chunk = block.slice(0, 6000);
|
|
259
|
-
const
|
|
264
|
+
const rawDescription = chunk.match(/<p[^>]*class="[^"]*max-w-lg[^"]*"[^>]*>\s*([^<]{1,400}?)\s*<\/p>/)?.[1]?.trim();
|
|
265
|
+
const description = rawDescription ? decodeEntities(rawDescription) : null;
|
|
260
266
|
const spans = [...chunk.matchAll(/<span[^>]*class="[^"]*inline-flex[^"]*"[^>]*>\s*([^<]{1,40}?)\s*<\/span>/g)].map((m) => m[1].trim());
|
|
261
267
|
const sizes = spans.filter((s) => /^\d+(\.\d+)?[mb]$/i.test(s));
|
|
262
268
|
const capabilities = spans.filter((s) => !/^\d+(\.\d+)?[mb]$/i.test(s));
|
package/src/search.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Offering search + transparent ranking (ONP-3 §5–6).
|
|
2
|
-
import { inJurisdiction } from '@opennodes/core';
|
|
2
|
+
import { inJurisdiction, localSizes, pullsOf, specialtyOf, isEmbedder } from '@opennodes/core';
|
|
3
3
|
|
|
4
4
|
export const RANK_COMPONENTS = { price: 0.35, tier: 0.35, probe_success: 0.30 };
|
|
5
5
|
const TIER_SCORE = { unverified: 0, community: 0.4, verified: 0.8, attested: 1.0 };
|
|
@@ -155,6 +155,15 @@ export async function searchOfferingsPaged(store, query) {
|
|
|
155
155
|
items = items.filter((o) => JSON.stringify(o.model).toLowerCase().includes(needle)
|
|
156
156
|
|| o.offering_id.includes(needle) || o.node_id.includes(needle));
|
|
157
157
|
}
|
|
158
|
+
// Local models (the Ollama library) have no server: they run on the visitor's own machine and are
|
|
159
|
+
// listed apart from hosted offerings. `memory_gb` keeps the local models with a size that fits.
|
|
160
|
+
if (q('memory_gb')) {
|
|
161
|
+
const gb = Number(q('memory_gb'));
|
|
162
|
+
items = items.filter((o) => !o.local || !localSizes(o).length || localSizes(o)[0].memory_gb <= gb);
|
|
163
|
+
}
|
|
164
|
+
const counts = { hosted: items.filter((o) => !o.local).length, local: items.filter((o) => o.local).length };
|
|
165
|
+
if (q('local') === 'true') items = items.filter((o) => o.local);
|
|
166
|
+
if (q('local') === 'false') items = items.filter((o) => !o.local);
|
|
158
167
|
|
|
159
168
|
// Rank depends on the filtered set: annotate copies, never the shared cached offerings.
|
|
160
169
|
items = items.map((o) => ({ ...o }));
|
|
@@ -162,7 +171,19 @@ export async function searchOfferingsPaged(store, query) {
|
|
|
162
171
|
// most expensive offering: one outlier made almost everything "cheap" and every import tie.
|
|
163
172
|
const prices = items.map((o) => o.pricing.input_per_mtok).filter((p) => p != null).sort((a, b) => a - b);
|
|
164
173
|
const cheaperThan = (p) => { let lo = 0, hi = prices.length; while (lo < hi) { const m = (lo + hi) >> 1; if (prices[m] < p) lo = m + 1; else hi = m; } return lo; };
|
|
174
|
+
// Local models rank by popularity among the listed local models (log of Ollama pulls): price, trust
|
|
175
|
+
// tier and checks describe a server, and a local model has none.
|
|
176
|
+
const maxPulls = Math.max(1, ...items.filter((o) => o.local).map(pullsOf));
|
|
165
177
|
for (const o of items) {
|
|
178
|
+
if (o.local) {
|
|
179
|
+
const sizes = localSizes(o);
|
|
180
|
+
o.local = { ...o.local, sizes_memory: sizes.map(({ tag, memory_gb }) => ({ tag, memory_gb })) };
|
|
181
|
+
o.specialty = isEmbedder(o) ? 'embedding' : specialtyOf(o);
|
|
182
|
+
const popularity = pullsOf(o) > 1 ? Math.log10(pullsOf(o)) / Math.log10(Math.max(10, maxPulls)) : 0;
|
|
183
|
+
o.rank = round2(popularity);
|
|
184
|
+
o.rank_explanation = { basis: 'local', weights: { popularity: 1 }, components: { popularity: round2(popularity) }, pulls: o.local.pulls ?? null };
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
166
187
|
const p = o.pricing.input_per_mtok;
|
|
167
188
|
const components = {
|
|
168
189
|
price: p == null ? 0 : prices.length > 1 ? 1 - cheaperThan(p) / (prices.length - 1) : 1,
|
|
@@ -178,7 +199,15 @@ export async function searchOfferingsPaged(store, query) {
|
|
|
178
199
|
const ttftOf = (o) => o.observed.ttft_ms?.p50 ?? o.serving?.expected_ttft_ms?.p50 ?? Infinity;
|
|
179
200
|
const tpsOf = (o) => (o.observed.tps > 0 ? o.observed.tps : null) ?? o.serving?.expected_tps?.p50 ?? -Infinity;
|
|
180
201
|
const sort = q('sort') ?? 'rank';
|
|
202
|
+
const minMemory = (o) => o.local?.sizes_memory?.[0]?.memory_gb ?? Infinity;
|
|
181
203
|
items.sort((a, b) => {
|
|
204
|
+
// hosted before local in a mixed list: their scores measure different things
|
|
205
|
+
if (Boolean(a.local) !== Boolean(b.local)) return Number(Boolean(a.local)) - Number(Boolean(b.local));
|
|
206
|
+
if (a.local) {
|
|
207
|
+
if (sort === 'size') return minMemory(a) - minMemory(b) || b.rank - a.rank || a.offering_id.localeCompare(b.offering_id);
|
|
208
|
+
if (sort === 'name') return a.offering_id.localeCompare(b.offering_id);
|
|
209
|
+
return b.rank - a.rank || pullsOf(b) - pullsOf(a) || a.offering_id.localeCompare(b.offering_id);
|
|
210
|
+
}
|
|
182
211
|
if (sort === 'price') return (a.pricing.input_per_mtok ?? Infinity) - (b.pricing.input_per_mtok ?? Infinity);
|
|
183
212
|
if (sort === 'ttft') return ttftOf(a) - ttftOf(b);
|
|
184
213
|
if (sort === 'tps') return tpsOf(b) - tpsOf(a);
|
|
@@ -192,7 +221,7 @@ export async function searchOfferingsPaged(store, query) {
|
|
|
192
221
|
|
|
193
222
|
const limit = Math.min(Number(q('limit') ?? 50), 200);
|
|
194
223
|
const offset = Math.max(0, Math.floor(Number(q('offset') ?? 0)) || 0);
|
|
195
|
-
return { offerings: items.slice(offset, offset + limit), total: items.length, offset };
|
|
224
|
+
return { offerings: items.slice(offset, offset + limit), total: items.length, offset, counts };
|
|
196
225
|
}
|
|
197
226
|
|
|
198
227
|
export async function searchOfferings(store, query) {
|
package/src/server.js
CHANGED
|
@@ -350,8 +350,9 @@ export async function startRegistry({
|
|
|
350
350
|
}],
|
|
351
351
|
|
|
352
352
|
['GET', '/v0/offerings', async (req, res, { query }) => {
|
|
353
|
-
const { offerings, total, offset } = await searchOfferingsPaged(store, query);
|
|
354
|
-
|
|
353
|
+
const { offerings, total, offset, counts } = await searchOfferingsPaged(store, query);
|
|
354
|
+
// total = matches before `offset`/`limit`; counts = hosted/local matches before the `local` filter
|
|
355
|
+
sendJson(res, 200, { offerings, total, offset, counts });
|
|
355
356
|
}],
|
|
356
357
|
|
|
357
358
|
['GET', '/v0/offerings/:nodeId/:offeringId', async (req, res, { params }) => {
|
package/src/web/index.html
CHANGED
|
@@ -138,6 +138,14 @@
|
|
|
138
138
|
background: var(--panel); color: var(--muted); cursor: pointer; font-family: inherit; }
|
|
139
139
|
.toggle.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
|
|
140
140
|
.switchrow { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; user-select: none; }
|
|
141
|
+
.kindtabs { display: flex; gap: 1.4rem; border-bottom: 1px solid var(--line); margin: 0.6rem 0 0.7rem; }
|
|
142
|
+
.kindtabs button { font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--muted); background: none; border: none;
|
|
143
|
+
border-bottom: 2px solid transparent; padding: 0.35rem 0 0.5rem; margin-bottom: -1px; cursor: pointer; }
|
|
144
|
+
.kindtabs button:hover { color: var(--ink); }
|
|
145
|
+
.kindtabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
|
|
146
|
+
.kindtabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
147
|
+
.kindtabs .counts { font-weight: 400; margin-left: 0.25rem; }
|
|
148
|
+
.runrow code { font-size: 0.78rem; }
|
|
141
149
|
.switch { width: 30px; height: 17px; border-radius: 999px; background: var(--line); position: relative; transition: background 0.15s; flex: none; }
|
|
142
150
|
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--panel); transition: left 0.15s; }
|
|
143
151
|
.switchrow.on .switch { background: var(--accent); } .switchrow.on .switch::after { left: 15px; }
|
|
@@ -247,20 +255,29 @@
|
|
|
247
255
|
<h1>Models</h1>
|
|
248
256
|
<span class="counts" id="m-counts"></span>
|
|
249
257
|
</div>
|
|
250
|
-
<
|
|
258
|
+
<div class="kindtabs" id="m-kind" role="tablist" aria-label="Kind of listing">
|
|
259
|
+
<button role="tab" data-kind="hosted" aria-selected="true">Hosted <span class="counts" id="m-n-hosted"></span></button>
|
|
260
|
+
<button role="tab" data-kind="local" aria-selected="false">Runs on your machine <span class="counts" id="m-n-local"></span></button>
|
|
261
|
+
</div>
|
|
262
|
+
<p class="sub hostedonly">Search across registered AI nodes and imported catalogs — pick a model on the left, its full card is on the right. Claimed values are never blended with measured ones.</p>
|
|
263
|
+
<p class="sub localonly" hidden>Models you download and run yourself with Ollama: no server, no account, and your data stays on your machine. There is nothing to verify remotely, so they are ranked by popularity (Ollama pulls); memory needs are 4-bit estimates.</p>
|
|
251
264
|
<div class="toolbar">
|
|
252
265
|
<input type="text" id="f-q" placeholder="Search models, families, nodes…">
|
|
253
|
-
<span class="switchrow" id="f-verified" title="identity-fingerprinted · context-verified · continuously probed"><span class="switch"></span><b style="font-size:0.78rem">Verified only</b></span>
|
|
254
|
-
<span class="switchrow" id="f-eea" title="operators in the EU, Iceland, Liechtenstein or Norway — declared by registered nodes, inferred for imported listings of known European providers"><span class="switch"></span><b style="font-size:0.78rem">EU/EEA</b></span>
|
|
266
|
+
<span class="switchrow hostedonly" id="f-verified" title="identity-fingerprinted · context-verified · continuously probed"><span class="switch"></span><b style="font-size:0.78rem">Verified only</b></span>
|
|
267
|
+
<span class="switchrow hostedonly" id="f-eea" title="operators in the EU, Iceland, Liechtenstein or Norway — declared by registered nodes, inferred for imported listings of known European providers"><span class="switch"></span><b style="font-size:0.78rem">EU/EEA</b></span>
|
|
255
268
|
<select id="f-modality">
|
|
256
269
|
<option value="">any modality</option>
|
|
257
270
|
<option>text</option><option>multimodal</option><option>image</option>
|
|
258
271
|
<option>audio</option><option>video</option><option>embedding</option>
|
|
259
272
|
</select>
|
|
260
|
-
<button class="toggle" data-sup="tool_calls">tools</button>
|
|
261
|
-
<button class="toggle" data-sup="vision">vision</button>
|
|
262
|
-
<button class="toggle" data-sup="json_mode">json</button>
|
|
263
|
-
<input type="number" id="f-price" placeholder="max $/MTok in" min="0" step="0.05">
|
|
273
|
+
<button class="toggle hostedonly" data-sup="tool_calls">tools</button>
|
|
274
|
+
<button class="toggle hostedonly" data-sup="vision">vision</button>
|
|
275
|
+
<button class="toggle hostedonly" data-sup="json_mode">json</button>
|
|
276
|
+
<input type="number" class="hostedonly" id="f-price" placeholder="max $/MTok in" min="0" step="0.05">
|
|
277
|
+
<select id="f-mem" class="localonly" hidden title="RAM (or GPU VRAM) you can give the model — keeps the models with a size that fits">
|
|
278
|
+
<option value="">fits: any memory</option><option value="4">fits in 4 GB</option><option value="8">fits in 8 GB</option>
|
|
279
|
+
<option value="16">fits in 16 GB</option><option value="24">fits in 24 GB</option><option value="32">fits in 32 GB</option><option value="64">fits in 64 GB</option>
|
|
280
|
+
</select>
|
|
264
281
|
<select id="f-sort"><option value="rank">sort: rank</option><option value="price">sort: price</option><option value="ttft">sort: fastest first token</option><option value="tps">sort: throughput</option></select>
|
|
265
282
|
</div>
|
|
266
283
|
<details class="panel pad" id="advisor" style="margin:0.2rem 0 0.8rem">
|
|
@@ -295,7 +312,7 @@
|
|
|
295
312
|
<div class="statstrip" id="md-stats"></div>
|
|
296
313
|
<div id="md-score"></div>
|
|
297
314
|
<div class="secnav" id="md-nav"></div>
|
|
298
|
-
<h2 id="sec-offerings">Offerings <span class="counts" id="md-count"></span></h2>
|
|
315
|
+
<h2 id="sec-offerings"><span id="md-offtitle">Offerings</span> <span class="counts" id="md-count"></span></h2>
|
|
299
316
|
<div class="panel tablewrap" id="md-offerings"></div>
|
|
300
317
|
<h2 id="sec-play">Playground <span class="counts">runs in your browser — your prompt goes straight to the node, never through this registry</span></h2>
|
|
301
318
|
<div class="panel pad" style="max-width:56rem">
|
|
@@ -542,6 +559,9 @@
|
|
|
542
559
|
|
|
543
560
|
<script>
|
|
544
561
|
const $ = (s) => document.querySelector(s);
|
|
562
|
+
// The model card moves between the list's detail pane and its own page; held here so that clearing
|
|
563
|
+
// the pane ("No offerings match") cannot destroy it.
|
|
564
|
+
const MODEL_CARD = document.getElementById('model-card');
|
|
545
565
|
const api = (p, opts) => fetch(p, opts).then(async (r) => { const b = await r.json().catch(() => ({})); if (!r.ok) throw new Error(b.detail || r.status); return b; });
|
|
546
566
|
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
|
547
567
|
const fmt = (n) => n == null ? '—' : (typeof n === 'number' ? (Math.round(n * 1000) / 1000) : n);
|
|
@@ -581,7 +601,7 @@ function route() {
|
|
|
581
601
|
document.querySelectorAll('nav a.tab').forEach((a) => a.classList.toggle('active', a.dataset.view === view || (view === 'model' && a.dataset.view === 'models') || (view === 'node' && a.dataset.view === 'nodes')));
|
|
582
602
|
window.scrollTo(0, 0);
|
|
583
603
|
if (view === 'models') search();
|
|
584
|
-
if (view === 'model' && arg) { $('#view-model').appendChild(
|
|
604
|
+
if (view === 'model' && arg) { $('#view-model').appendChild(MODEL_CARD); loadModel(arg); }
|
|
585
605
|
if (view === 'chat') loadChatTargets();
|
|
586
606
|
if (view === 'rankings') loadRankings();
|
|
587
607
|
if (view === 'nodes') loadNodes();
|
|
@@ -591,6 +611,29 @@ function route() {
|
|
|
591
611
|
window.addEventListener('hashchange', route);
|
|
592
612
|
|
|
593
613
|
/* ---------- catalog ---------- */
|
|
614
|
+
// Hosted offerings and local models (no server: they run on the visitor's machine) are listed apart.
|
|
615
|
+
let listKind = 'hosted';
|
|
616
|
+
try { if (localStorage.getItem('onp-list-kind') === 'local') listKind = 'local'; } catch { /* storage blocked */ }
|
|
617
|
+
const SORTS = {
|
|
618
|
+
hosted: [['rank', 'sort: rank'], ['price', 'sort: price'], ['ttft', 'sort: fastest first token'], ['tps', 'sort: throughput']],
|
|
619
|
+
local: [['rank', 'sort: most pulled'], ['size', 'sort: smallest first'], ['name', 'sort: name']],
|
|
620
|
+
};
|
|
621
|
+
function applyKind() {
|
|
622
|
+
document.querySelectorAll('#m-kind [data-kind]').forEach((b) => b.setAttribute('aria-selected', String(b.dataset.kind === listKind)));
|
|
623
|
+
document.querySelectorAll('#view-models .hostedonly').forEach((el) => { el.hidden = listKind !== 'hosted'; });
|
|
624
|
+
document.querySelectorAll('#view-models .localonly').forEach((el) => { el.hidden = listKind !== 'local'; });
|
|
625
|
+
const sel = $('#f-sort'), cur = sel.value;
|
|
626
|
+
sel.innerHTML = SORTS[listKind].map(([v, l]) => `<option value="${v}">${l}</option>`).join('');
|
|
627
|
+
if (SORTS[listKind].some(([v]) => v === cur)) sel.value = cur;
|
|
628
|
+
}
|
|
629
|
+
applyKind();
|
|
630
|
+
document.querySelectorAll('#m-kind [data-kind]').forEach((b) => b.addEventListener('click', () => {
|
|
631
|
+
if (b.dataset.kind === listKind) return;
|
|
632
|
+
listKind = b.dataset.kind;
|
|
633
|
+
try { localStorage.setItem('onp-list-kind', listKind); } catch { /* storage blocked */ }
|
|
634
|
+
applyKind();
|
|
635
|
+
search();
|
|
636
|
+
}));
|
|
594
637
|
const sup = new Set();
|
|
595
638
|
document.querySelectorAll('.toggle').forEach((b) => b.addEventListener('click', () => {
|
|
596
639
|
b.classList.toggle('on'); b.classList.contains('on') ? sup.add(b.dataset.sup) : sup.delete(b.dataset.sup); search();
|
|
@@ -599,7 +642,7 @@ $('#f-verified').addEventListener('click', () => { $('#f-verified').classList.to
|
|
|
599
642
|
$('#f-eea').addEventListener('click', () => { $('#f-eea').classList.toggle('on'); search(); });
|
|
600
643
|
let debounce;
|
|
601
644
|
for (const id of ['f-q', 'f-price']) $('#' + id).addEventListener('input', () => { clearTimeout(debounce); debounce = setTimeout(search, 250); });
|
|
602
|
-
for (const id of ['f-modality', 'f-sort']) $('#' + id).addEventListener('change', search);
|
|
645
|
+
for (const id of ['f-modality', 'f-sort', 'f-mem']) $('#' + id).addEventListener('change', search);
|
|
603
646
|
|
|
604
647
|
function measuredBits(o) {
|
|
605
648
|
const obs = o.observed || {};
|
|
@@ -660,7 +703,7 @@ let listQuery = '', listTotal = 0, listPage = 0;
|
|
|
660
703
|
function updatePager() {
|
|
661
704
|
const pages = Math.max(1, Math.ceil(listTotal / PAGE));
|
|
662
705
|
const from = listTotal ? listPage * PAGE + 1 : 0, to = Math.min(listTotal, (listPage + 1) * PAGE);
|
|
663
|
-
$('#m-counts').textContent = fmtInt(listTotal) + ' offerings' + (pages > 1 ? ` · ${fmtInt(from)}–${fmtInt(to)}` : '');
|
|
706
|
+
$('#m-counts').textContent = fmtInt(listTotal) + (listKind === 'local' ? ' local models' : ' offerings') + (pages > 1 ? ` · ${fmtInt(from)}–${fmtInt(to)}` : '');
|
|
664
707
|
const pager = $('#m-pager');
|
|
665
708
|
if (pages <= 1) { pager.innerHTML = ''; return; }
|
|
666
709
|
const btn = (label, page, title) => `<button class="pgbtn" data-page="${page}" title="${title}"${page < 0 || page >= pages || page === listPage ? ' disabled' : ''}>${label}</button>`;
|
|
@@ -693,7 +736,7 @@ function renderList(offerings) {
|
|
|
693
736
|
$('#m-list').innerHTML = offerings.map(renderItem).join('')
|
|
694
737
|
|| '<p class="sub">No offerings match. A fresh registry fills up via catalog imports and node registrations.</p>';
|
|
695
738
|
document.querySelectorAll('.mitem').forEach((el) => el.addEventListener('click', () => selectModel(el)));
|
|
696
|
-
const current =
|
|
739
|
+
const current = MODEL_CARD.dataset.artifact;
|
|
697
740
|
document.querySelectorAll('.mitem').forEach((el) => el.classList.toggle('sel', el.dataset.artifact === current));
|
|
698
741
|
}
|
|
699
742
|
|
|
@@ -701,22 +744,26 @@ async function search() {
|
|
|
701
744
|
const p = new URLSearchParams({ limit: PAGE });
|
|
702
745
|
if ($('#f-q').value) p.set('q', $('#f-q').value);
|
|
703
746
|
if ($('#f-modality').value) p.set('modality', $('#f-modality').value);
|
|
704
|
-
|
|
705
|
-
if (
|
|
706
|
-
|
|
707
|
-
|
|
747
|
+
p.set('local', String(listKind === 'local'));
|
|
748
|
+
if (listKind === 'hosted') { // trust, location, price and capabilities describe a server
|
|
749
|
+
if ($('#f-verified').classList.contains('on')) p.set('tier', 'verified');
|
|
750
|
+
if ($('#f-eea').classList.contains('on')) p.set('jurisdiction', 'eea');
|
|
751
|
+
if ($('#f-price').value) p.set('max_input_price', $('#f-price').value);
|
|
752
|
+
if (sup.size) p.set('supports', [...sup].join(','));
|
|
753
|
+
} else if ($('#f-mem').value) p.set('memory_gb', $('#f-mem').value);
|
|
708
754
|
p.set('sort', $('#f-sort').value);
|
|
709
755
|
listQuery = p.toString();
|
|
710
756
|
try {
|
|
711
|
-
const { offerings, total } = await api('/v0/offerings?' + p);
|
|
757
|
+
const { offerings, total, counts } = await api('/v0/offerings?' + p);
|
|
712
758
|
if (listQuery !== p.toString()) return; // a newer search is under way
|
|
759
|
+
if (counts) { $('#m-n-hosted').textContent = fmtInt(counts.hosted); $('#m-n-local').textContent = fmtInt(counts.local); }
|
|
713
760
|
lastResults = offerings;
|
|
714
761
|
listTotal = total ?? offerings.length;
|
|
715
762
|
listPage = 0;
|
|
716
763
|
renderList(offerings);
|
|
717
764
|
updatePager();
|
|
718
765
|
// keep the current selection when still listed, else select the first result
|
|
719
|
-
const current =
|
|
766
|
+
const current = MODEL_CARD.dataset.artifact;
|
|
720
767
|
const keep = current && [...document.querySelectorAll('.mitem')].find((el) => el.dataset.artifact === current);
|
|
721
768
|
const target = keep ?? document.querySelector('.mitem');
|
|
722
769
|
if (target) selectModel(target);
|
|
@@ -772,12 +819,32 @@ function selectModel(el) {
|
|
|
772
819
|
document.querySelectorAll('.mitem').forEach((x) => x.classList.toggle('sel', x === el));
|
|
773
820
|
listedOffering = lastResults.find((o) => `${o.node_id}/${o.offering_id}` === el.dataset.key) ?? null;
|
|
774
821
|
const host = $('#m-detail');
|
|
775
|
-
if (!host.contains(
|
|
822
|
+
if (!host.contains(MODEL_CARD)) { host.innerHTML = ''; host.appendChild(MODEL_CARD); }
|
|
776
823
|
loadModel(el.dataset.artifact);
|
|
777
824
|
}
|
|
778
825
|
|
|
779
826
|
let lastResults = [];
|
|
827
|
+
/** "1b–27b · from ~1.6 GB" for a local model's sizes (4-bit memory estimates from the registry). */
|
|
828
|
+
function sizesBit(o) {
|
|
829
|
+
const sz = o.local?.sizes_memory ?? [];
|
|
830
|
+
if (!sz.length) return '';
|
|
831
|
+
return (sz.length > 1 ? `${sz[0].tag}–${sz.at(-1).tag}` : sz[0].tag) + ` · from ~${sz[0].memory_gb} GB`;
|
|
832
|
+
}
|
|
833
|
+
function renderLocalItem(o) {
|
|
834
|
+
return `<div class="mitem" data-artifact="${esc(o.model.artifact)}" data-key="${esc(o.node_id + '/' + o.offering_id)}">
|
|
835
|
+
<div class="t">
|
|
836
|
+
<span class="nm">${esc(o.model.name)}</span>
|
|
837
|
+
${o.specialty ? `<span class="chip">${esc(o.specialty)}</span>` : ''}
|
|
838
|
+
<span class="chip loc">LOCAL</span>
|
|
839
|
+
</div>
|
|
840
|
+
<div class="b">
|
|
841
|
+
${sizesBit(o) ? `<span>${esc(sizesBit(o))}</span>` : ''}
|
|
842
|
+
${o.local.pulls ? `<span>${esc(o.local.pulls)} pulls</span>` : ''}
|
|
843
|
+
</div>
|
|
844
|
+
</div>`;
|
|
845
|
+
}
|
|
780
846
|
function renderItem(o) {
|
|
847
|
+
if (o.local) return renderLocalItem(o);
|
|
781
848
|
const obs = o.observed || {};
|
|
782
849
|
return `<div class="mitem" data-artifact="${esc(o.model.artifact)}" data-key="${esc(o.node_id + '/' + o.offering_id)}">
|
|
783
850
|
<div class="t">
|
|
@@ -887,6 +954,15 @@ function renderScore(artifact) {
|
|
|
887
954
|
const host = $('#md-score');
|
|
888
955
|
const o = listedOffering;
|
|
889
956
|
if (!o?.rank_explanation || o.model.artifact !== artifact) { host.innerHTML = ''; return; }
|
|
957
|
+
if (o.rank_explanation.basis === 'local') {
|
|
958
|
+
host.innerHTML = `<details class="scorebox" open>
|
|
959
|
+
<summary>Popularity <b class="mono">${fmt(o.rank)}</b> <span class="sub">among the local models in the current list</span></summary>
|
|
960
|
+
<table><tr><td>Ollama pulls</td><td class="num mono">${esc(o.rank_explanation.pulls ?? '—')}</td><td class="num mono"><b>${fmt(o.rank)}</b></td>
|
|
961
|
+
<td class="sub">log scale against the most-pulled local model listed (1.00)</td></tr></table>
|
|
962
|
+
<p class="sub" style="margin:0.5rem 0 0; font-size:0.78rem">Local models are not scored on price, trust tier or checks: there is no server behind them, and they cost nothing per token. How well one runs depends on your machine.</p>
|
|
963
|
+
</details>`;
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
890
966
|
const { weights, components } = o.rank_explanation;
|
|
891
967
|
const obs = o.observed || {};
|
|
892
968
|
const why = {
|
|
@@ -912,7 +988,7 @@ function renderScore(artifact) {
|
|
|
912
988
|
}
|
|
913
989
|
|
|
914
990
|
async function loadModel(artifact) {
|
|
915
|
-
|
|
991
|
+
MODEL_CARD.dataset.artifact = artifact;
|
|
916
992
|
$('#md-crumb').innerHTML = '<a href="#/">Models</a> / ' + esc(artifact);
|
|
917
993
|
$('#md-title').textContent = '…';
|
|
918
994
|
$('#md-offerings').innerHTML = '';
|
|
@@ -928,6 +1004,7 @@ async function loadModel(artifact) {
|
|
|
928
1004
|
const tierOrder = { verified: 3, community: 2, unverified: 1 };
|
|
929
1005
|
list.sort((a, b) => (tierOrder[b.tier] ?? 0) - (tierOrder[a.tier] ?? 0) || (a.pricing.input_per_mtok ?? Infinity) - (b.pricing.input_per_mtok ?? Infinity));
|
|
930
1006
|
const first = list[0];
|
|
1007
|
+
const isLocal = list.every((o) => o.local); // an Ollama library model: no server, runs on the visitor's machine
|
|
931
1008
|
$('#md-title').textContent = first.model.name;
|
|
932
1009
|
// the artifact chip links to its authoritative home: Hugging Face for hf: artifacts
|
|
933
1010
|
$('#md-artifact').innerHTML = artifact.startsWith('hf:')
|
|
@@ -944,9 +1021,12 @@ async function loadModel(artifact) {
|
|
|
944
1021
|
first.model.params_b ? `<span class="chip">${first.model.params_b}B</span>` : '',
|
|
945
1022
|
`<span class="chip">${esc(first.modality)}</span>`,
|
|
946
1023
|
first.model.family ? `<span class="chip">${esc(first.model.family)}</span>` : '',
|
|
1024
|
+
isLocal && first.specialty && first.specialty !== first.modality ? `<span class="chip">${esc(first.specialty)}</span>` : '',
|
|
1025
|
+
isLocal ? '<span class="chip loc">LOCAL</span>' : '',
|
|
947
1026
|
...extLinks,
|
|
948
1027
|
].join('');
|
|
949
|
-
$('#md-
|
|
1028
|
+
$('#md-offtitle').textContent = isLocal ? 'Run it' : 'Offerings';
|
|
1029
|
+
$('#md-count').textContent = isLocal ? 'with Ollama, on your own machine' : list.length + ' node' + (list.length === 1 ? '' : 's');
|
|
950
1030
|
|
|
951
1031
|
// description (imported catalogs carry one; absent otherwise)
|
|
952
1032
|
const desc = list.map((o) => o.model.description).find(Boolean);
|
|
@@ -960,7 +1040,14 @@ async function loadModel(artifact) {
|
|
|
960
1040
|
const verified = list.filter((o) => o.tier === 'verified').length;
|
|
961
1041
|
const released = list.map((o) => o.model.released).find(Boolean);
|
|
962
1042
|
const stat = (v, l) => `<span class="stat"><span class="sv">${v}</span><span class="sl">${l}</span></span>`;
|
|
963
|
-
|
|
1043
|
+
const sizes = first.local?.sizes_memory ?? [];
|
|
1044
|
+
if (isLocal) $('#md-stats').innerHTML = [
|
|
1045
|
+
stat('free', 'RUNS ON YOUR MACHINE'),
|
|
1046
|
+
sizes.length ? stat(esc(sizes.map((x) => x.tag).join(' · ')), sizes.length === 1 ? 'SIZE' : 'SIZES') : '',
|
|
1047
|
+
sizes.length ? stat(`~${sizes[0].memory_gb} GB`, 'SMALLEST NEEDS (4-BIT EST.)') : '',
|
|
1048
|
+
first.local.pulls ? stat(esc(first.local.pulls), 'OLLAMA PULLS') : '',
|
|
1049
|
+
].filter(Boolean).join('');
|
|
1050
|
+
else $('#md-stats').innerHTML = [
|
|
964
1051
|
stat(!prices.length ? priceStr(first.pricing, first.node_id) : minP === 0 && maxP === 0 ? 'free' : (minP === maxP ? '$' + fmt(minP) : '$' + fmt(minP) + '–' + fmt(maxP)), '$/MTOK IN ACROSS NODES'),
|
|
965
1052
|
ctxMax ? stat(fmtInt(ctxMax), 'MAX CONTEXT') : '',
|
|
966
1053
|
stat(`${verified}/${list.length}`, 'VERIFIED NODES'),
|
|
@@ -971,7 +1058,7 @@ async function loadModel(artifact) {
|
|
|
971
1058
|
renderScore(artifact);
|
|
972
1059
|
|
|
973
1060
|
// section nav (anchors appear only for sections that render)
|
|
974
|
-
const navBits = [['#sec-offerings', 'OFFERINGS'], ['#sec-play', 'PLAYGROUND']];
|
|
1061
|
+
const navBits = [['#sec-offerings', isLocal ? 'RUN IT' : 'OFFERINGS'], ['#sec-play', 'PLAYGROUND']];
|
|
975
1062
|
|
|
976
1063
|
// playground targets: hosted offerings first, then the ones that run on the visitor's own computer,
|
|
977
1064
|
// then a custom endpoint
|
|
@@ -984,7 +1071,14 @@ async function loadModel(artifact) {
|
|
|
984
1071
|
pgUpdateNote();
|
|
985
1072
|
$('#pg-hosted').innerHTML = '';
|
|
986
1073
|
if (pgOfferings.length && pgOfferings.every(runsLocally)) showHostedAlternatives(first, artifact);
|
|
987
|
-
|
|
1074
|
+
const runName = first.binding?.model_id ?? first.model.name;
|
|
1075
|
+
const verb = first.modality === 'embedding' ? 'pull' : 'run'; // embedding models answer the API, not a chat prompt
|
|
1076
|
+
if (isLocal) $('#md-offerings').innerHTML = `<table class="grid num"><thead><tr><th>SIZE</th><th>MEMORY NEEDED</th><th>COMMAND</th></tr></thead><tbody>`
|
|
1077
|
+
+ (sizes.length ? sizes.map((x) => `<tr class="runrow"><td><b>${esc(x.tag)}</b></td><td>~${x.memory_gb} GB <span class="micro m-claimed">4-BIT EST.</span></td>
|
|
1078
|
+
<td><code class="mono">ollama ${verb} ${esc(runName)}:${esc(x.tag)}</code></td></tr>`).join('')
|
|
1079
|
+
: `<tr class="runrow"><td>—</td><td>—</td><td><code class="mono">ollama ${verb} ${esc(runName)}</code></td></tr>`)
|
|
1080
|
+
+ `</tbody></table><p class="sub" style="margin:0.6rem 0.8rem; font-size:0.8rem">Install Ollama from <a href="https://ollama.com/download" target="_blank" rel="noopener">ollama.com</a>, then run one command. Pick the largest size that fits the RAM (or GPU VRAM) you can spare; real use grows with the context length.</p>`;
|
|
1081
|
+
else $('#md-offerings').innerHTML = `<table class="grid num"><thead><tr>
|
|
988
1082
|
<th>NODE</th><th>PRICE IN/OUT</th><th>HARDWARE</th><th>CONTEXT</th><th>TTFT</th><th>TOK/S</th><th>UP</th><th>CAPABILITIES</th><th>REVISION</th>
|
|
989
1083
|
</tr></thead><tbody>` + list.map((o) => {
|
|
990
1084
|
const obs = o.observed || {};
|
|
@@ -1052,7 +1146,12 @@ async function loadModel(artifact) {
|
|
|
1052
1146
|
// FAQ — generated strictly from the data on this page
|
|
1053
1147
|
const supports = [...new Set(list.flatMap((o) => o.serving?.supports || []))].filter((s) => s !== 'streaming');
|
|
1054
1148
|
const capped = list.filter((o) => o.serving?.context_capped_from);
|
|
1055
|
-
const faqs = [
|
|
1149
|
+
const faqs = isLocal ? [
|
|
1150
|
+
['What is ' + first.model.name + '?', desc || `A ${first.modality} model from the Ollama library${first.model.family ? ` in the ${first.model.family} family` : ''}.`],
|
|
1151
|
+
['What does it cost?', 'Nothing per token: it runs on your own hardware with Ollama. The cost is your memory, compute and electricity.'],
|
|
1152
|
+
['How do I run it?', `Install Ollama, then run ${sizes.length ? `"ollama ${verb} ${runName}:${sizes.at(-1).tag}"${sizes.length > 1 ? ` (or a smaller size: ${sizes.map((x) => x.tag).join(', ')})` : ''}` : `"ollama ${verb} ${runName}"`}.${sizes.length ? ` The smallest size needs about ${sizes[0].memory_gb} GB at 4-bit.` : ''}${verb === 'pull' ? ' Embedding models are called through the API (as the playground below does), not chatted with.' : ''}`],
|
|
1153
|
+
['Is it verified?', 'There is no server to verify: the model runs on your machine, so how fast and how well depends on your hardware. The listing comes from the Ollama library. The playground on this page sends to your own Ollama and shows whether it answers.'],
|
|
1154
|
+
] : [
|
|
1056
1155
|
['What is ' + first.model.name + '?', desc
|
|
1057
1156
|
? desc
|
|
1058
1157
|
: `A ${first.modality} model${first.model.params_b ? ` (${first.model.params_b}B parameters)` : ''}${first.model.family ? ` in the ${first.model.family} family` : ''}, served by ${list.length} node${list.length === 1 ? '' : 's'} listed in this registry. Artifact: ${artifact}.`],
|
|
@@ -1079,11 +1178,16 @@ function pgLabel(o) {
|
|
|
1079
1178
|
if (!runsLocally(o)) return `${esc(o.node_id)} — ${priceStr(o.pricing, o.node_id)} [${esc(o.tier)}]`;
|
|
1080
1179
|
return `your computer — ${esc(o.local?.runtime === 'ollama' ? 'Ollama' : 'local app')} at ${esc(localHost(o))} (no hosted server for this listing)`;
|
|
1081
1180
|
}
|
|
1181
|
+
/** Embedding models answer /embeddings with a vector, not /chat/completions with text. */
|
|
1182
|
+
const isEmbedOffering = (o) => Boolean(o) && (o.modality === 'embedding' || /embeddings/.test(o.binding?.profile ?? ''));
|
|
1082
1183
|
/** Says plainly where Send goes when the target is the visitor's own machine. */
|
|
1083
1184
|
function pgUpdateNote() {
|
|
1084
1185
|
const note = $('#pg-note');
|
|
1085
1186
|
const v = $('#pg-target').value;
|
|
1086
1187
|
const o = v === 'custom' ? null : pgOfferings[Number(v)];
|
|
1188
|
+
const embed = isEmbedOffering(o);
|
|
1189
|
+
$('#pg-prompt').placeholder = embed ? 'Text to embed — the answer is a vector of numbers…' : 'Try the model…';
|
|
1190
|
+
$('#pg-send').textContent = embed ? 'Embed' : 'Send';
|
|
1087
1191
|
note.hidden = !o || !runsLocally(o);
|
|
1088
1192
|
if (note.hidden) return;
|
|
1089
1193
|
const app = o.local?.runtime === 'ollama' ? 'Ollama' : 'the local app';
|
|
@@ -1108,7 +1212,7 @@ async function showHostedAlternatives(first, artifact) {
|
|
|
1108
1212
|
found.set(o.node_id + '/' + o.offering_id, o);
|
|
1109
1213
|
}
|
|
1110
1214
|
}
|
|
1111
|
-
if (
|
|
1215
|
+
if (MODEL_CARD.dataset.artifact !== artifact) return; // the visitor moved on
|
|
1112
1216
|
const tierOrder = { attested: 4, verified: 3, community: 2, unverified: 1 };
|
|
1113
1217
|
const picks = [...found.values()].sort((a, b) =>
|
|
1114
1218
|
(tierOrder[b.tier] ?? 0) - (tierOrder[a.tier] ?? 0)
|
|
@@ -1143,6 +1247,27 @@ $('#pg-send').addEventListener('click', async () => {
|
|
|
1143
1247
|
out.textContent = '…';
|
|
1144
1248
|
meta.textContent = '';
|
|
1145
1249
|
const t0 = performance.now();
|
|
1250
|
+
if (isEmbedOffering(offering)) {
|
|
1251
|
+
try {
|
|
1252
|
+
const res = await fetch(base + '/embeddings', {
|
|
1253
|
+
method: 'POST',
|
|
1254
|
+
headers: { 'content-type': 'application/json', ...(useKey ? { authorization: 'Bearer ' + useKey } : {}) },
|
|
1255
|
+
body: JSON.stringify({ model, input: prompt }),
|
|
1256
|
+
});
|
|
1257
|
+
const body = await res.json();
|
|
1258
|
+
if (!res.ok) throw new Error(body?.detail ?? body?.error?.message ?? ('status ' + res.status));
|
|
1259
|
+
const vec = body.data?.[0]?.embedding;
|
|
1260
|
+
if (!Array.isArray(vec)) throw new Error('no embedding in the answer');
|
|
1261
|
+
out.textContent = `A vector of ${vec.length} numbers: the text's position in the model's meaning space. Similar texts get nearby vectors; that is what document search (RAG) compares.\n\n[${vec.slice(0, 8).map((x) => Number(x).toFixed(4)).join(', ')}, …]`;
|
|
1262
|
+
meta.textContent = [Math.round(performance.now() - t0) + 'ms', body.usage?.prompt_tokens != null ? `${body.usage.prompt_tokens} tokens in` : null, `${vec.length} dimensions`].filter(Boolean).join(' · ');
|
|
1263
|
+
} catch (err) {
|
|
1264
|
+
const notPulled = offering && runsLocally(offering) && /not found/i.test(err.message);
|
|
1265
|
+
out.innerHTML = '<span class="err">' + esc(err.message) + '</span><br><span class="prov">' + (notPulled
|
|
1266
|
+
? `Your Ollama is running but does not have this model yet: <code class="mono">ollama pull ${esc(model)}</code>, then Embed again.`
|
|
1267
|
+
: 'If this is a network/CORS error: for local Ollama set OLLAMA_ORIGINS to include this page's origin.') + '</span>';
|
|
1268
|
+
} finally { $('#pg-send').disabled = false; }
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1146
1271
|
try {
|
|
1147
1272
|
const res = await fetch(base + '/chat/completions', {
|
|
1148
1273
|
method: 'POST',
|