@opennodes/registry 0.1.56 → 0.1.58

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/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
  The OpenNodes Protocol (ONP) reference registry — an open, federatable discovery service for AI inference nodes.
4
4
 
5
5
  ```bash
6
- npx @opennodes/registry@0.1.56 # web app + API on http://127.0.0.1:4300
7
- ONP_DB=./registry.db npx @opennodes/registry@0.1.56 # persistent SQLite + persistent signing key
8
- ONP_DB=postgres://user:pass@host/db npx @opennodes/registry@0.1.56
6
+ npx @opennodes/registry@0.1.58 # web app + API on http://127.0.0.1:4300
7
+ ONP_DB=./registry.db npx @opennodes/registry@0.1.58 # persistent SQLite + persistent signing key
8
+ ONP_DB=postgres://user:pass@host/db npx @opennodes/registry@0.1.58
9
9
  ```
10
10
 
11
11
  What it does:
@@ -29,14 +29,24 @@ What it does:
29
29
  - **Errors:** a misspelt `trust`, `lineage`, `retention` or `no_training` value gets `400 bad-query`, never a wider result.
30
30
  - **Request counts** (ONP-3 §6.6): how often search, recommend and the MCP tools returned each node, per ISO week, in node detail (`request_counts`, 12 weeks) and at `GET /v0/stats/requests?weeks=4&node_id=…`. Only node ids and counts are stored, never the query, task or client.
31
31
  - **Search and transparent ranking** (`/v0/offerings`, `sort=rank|price|ttft|tps`) with per-result `rank_explanation`; **enforceable estimates** (`POST /v0/estimate`) pinned to card revisions; the **advisor** (`POST /v0/recommend`).
32
- - **Catalog importers** — OpenRouter, Hugging Face Inference Providers, models.dev, the Ollama library — so search is useful on day one, with imported listings labeled and claimable by their operators.
32
+ - **Catalog importers** — OpenRouter, Hugging Face Inference Providers, models.dev, the Ollama library, the AI Horde — so search is useful on day one, with imported listings labeled and claimable by their operators.
33
33
  - **Where models run** (`/v0/locations`, `?format=csv` or `?format=geojson`): serving sites by country with their evidence (`claimed`, `documented`, `measured`, `attested`), a map point, and the models each serves (ONP-2 §3a, ONP-3 §5c). `near=lat,lon&within_km=` finds what runs close to a point. The GeoJSON opens directly in QGIS, ArcGIS, kepler.gl or any web map; the web app draws it on an interactive map. Built from card locations, the per-provider OpenRouter import (the headquarters, datacentres and region tags providers declare there) and curated seeds in [`src/data/`](src/data/) (Canada, Europe, and every registry provider worldwide). Search takes `region=`, `location_basis=` and `exclude_lineage=`.
34
34
  - **Residency commitments** (`/v0/residency`, `?format=csv`): what each provider officially promises about where prompts, outputs and stored data stay (`processing`, `storage`, `none` or `unstated`; scope; `default`, `opt_in` or `enterprise`), with source and date (ONP-2 §3b, ONP-3 §5d). Each site in `/v0/locations` carries the commitments that cover it, and `residency=processing|storage` filters by them.
35
35
  - **MCP surface** at `/mcp` (including `find_locations` and `find_residency`) and a signed **export feed** for federation.
36
36
  - **Web app** at `/`: OpenRouter-style catalog with model and node pages, hardware and measured performance, playground, multi-model chat (compare / jury / pipeline / iterative), the advisor, the Node Builder, and the "Where models run" page.
37
37
 
38
- Environment: `PORT`, `ONP_DB`, `ONP_REGISTRY_KEY`, `ONP_ADMIN_TOKEN`, `ONP_TRUSTED_JURISDICTIONS` (trusted pool operators, default `EU,CA`), `ONP_LOCATION=1` (server-location checks; the trusted pool needs them), `ONP_ALLOW_PRIVATE=1` (dev only: permit localhost nodes), `ONP_STAGE_C=0`, `ONP_REIMPORT=1`, `ONP_REIMPORT_SOURCES` (default `openrouter,huggingface`; also `models-dev`, `ollama`, and `openrouter-providers`, which makes one request per OpenRouter model, so give it a long `ONP_REIMPORT_MS`), `ONP_LOCATION_SEEDS=0` (skip the curated location seeds), `ONP_MAP_TILES` (basemap for the locations map: unset = OpenStreetMap, `off` = no map, or an XYZ URL template with `ONP_MAP_ATTRIBUTION`). The map loads Leaflet from cdnjs, pinned with subresource integrity, only on the "Where models run" page. Viewers' browsers then fetch tiles from the tile server. OpenStreetMap's tile policy asks for light use, so a busy registry should point `ONP_MAP_TILES` at its own or a commercial tile service.
38
+ Environment: `PORT`, `ONP_DB`, `ONP_REGISTRY_KEY`, `ONP_ADMIN_TOKEN`, `ONP_TRUSTED_JURISDICTIONS` (trusted pool operators, default `EU,CA`), `ONP_LOCATION=1` (server-location checks; the trusted pool needs them), `ONP_ALLOW_PRIVATE=1` (dev only: permit localhost nodes), `ONP_STAGE_C=0`, `ONP_REIMPORT=1`, `ONP_REIMPORT_SOURCES` (default `openrouter,huggingface`; also `models-dev`, `ollama`, `horde` (refreshed every `ONP_REIMPORT_HORDE_MS`, default one hour), and `openrouter-providers`, which makes one request per OpenRouter model, so give it a long `ONP_REIMPORT_MS`), `ONP_LOCATION_SEEDS=0` (skip the curated location seeds), `ONP_MAP_TILES` (basemap for the locations map: unset = OpenStreetMap, `off` = no map, or an XYZ URL template with `ONP_MAP_ATTRIBUTION`). The map loads Leaflet from cdnjs, pinned with subresource integrity, only on the "Where models run" page. Viewers' browsers then fetch tiles from the tile server. OpenStreetMap's tile policy asks for light use, so a busy registry should point `ONP_MAP_TILES` at its own or a commercial tile service.
39
39
 
40
40
  Location seeds are dated JSON files (`locations-{seed}.json`): providers, their sites with `basis`, `source` and `checked`, and the models each site serves. A provider whose models are listed becomes a listing-only node `import.seed.{seed}.{id}`; one that publishes no model list is shown with a note. An entry with `nodes` describes existing registry nodes instead: its sites are shown under the first of them, with that node's models when `placement` is `all`. With `placement: "all"`, or `serves_from: "{seed}:{id}"` (the node's whole API runs at that entry's sites), search and recommend also use the live sites as the node's serving locations, marked `via: "seed"`, for offerings whose card declares none, except for listings reached through the Hugging Face router or OpenRouter. Providers carry `kind` and `residency`; `residency_of: "{seed}:{id}"` reuses another entry's commitments (the Canadian and European regions of a cloud share the cloud's). Corrections and new countries are welcome by pull request: cite the provider's own page for `documented`, anything else is `claimed`.
41
41
 
42
+ The AI Horde import (`horde`, or `POST /v0/import/horde` with an admin token) lists the [AI Horde](https://aihorde.net)'s text models as one node, `import.aihorde.text`. The Horde is a free network run by the non-profit Haidra: volunteers run the models on their own machines, and the queue is ordered by kudos, a non-monetary credit for contributed compute.
43
+ - **What the registry reads:** only the public model status (`/api/v2/status/models?type=text&chat=true`, sent with the `Client-Agent` header the Horde asks for) and Haidra's [text model reference](https://github.com/Haidra-Org/AI-Horde-text-model-reference). The reference is AGPL-3.0, so only its facts are used: model names and Hugging Face URLs, not its descriptions. The registry never sends a prompt, and imported listings are never probed. A ping on one answers 409 `imported-listing`.
44
+ - **What gets listed:** only models with online chat workers and a Hugging Face record in the reference. Workers declare the names themselves, and a name without a public record is skipped, not given a made-up artefact.
45
+ - **Pricing and data policy:** each offering is `free` with `retention: logged`. Volunteers can read and keep prompts and outputs, so there is no operator country, the listings stay in the open pool, and the trusted view and sensitive requests never include them.
46
+ - **Lineage:** declared only for a developer's own from-scratch release (`HORDE_FROM_SCRATCH` in `src/importers.js`).
47
+ - **Reported figures:** worker count, queue and ETA are what the Horde reports, shown as `observed.upstream` with `basis: "reported"`. With nothing to list, the node is delisted until workers return.
48
+ - **Calling a model:** people call the models at Haidra's OpenAI-compatible front (`https://oai.aihorde.net/v1`) with their own AI Horde key.
49
+
50
+ ONP has no field yet for two things this listing has to say: that the people running the hardware can read prompts (proposed: `data_policy.statement`), and that queue order follows a credit rather than a price, with a free output allowance (proposed: `free_tier.priority` and `free_tier.max_output_tokens`). The node description says both in words.
51
+
42
52
  Part of [OpenNodes](https://opennodes.io) · [specification](https://github.com/opennodes-io/opennodes/tree/main/spec) · Apache-2.0.
package/bin.js CHANGED
@@ -47,6 +47,9 @@ const registry = await startRegistry({
47
47
  reimport: process.env.ONP_REIMPORT === '1' ? {
48
48
  intervalMs: Number(process.env.ONP_REIMPORT_MS ?? 6 * 3600 * 1000),
49
49
  sources: (process.env.ONP_REIMPORT_SOURCES ?? 'openrouter,huggingface').split(','),
50
+ // `horde` (opt-in: add it to ONP_REIMPORT_SOURCES) refreshes hourly by default; workers come and go fast.
51
+ // Anything unset, unreadable or under a minute falls back to the hour: the Horde is never polled in a loop.
52
+ sourceIntervals: { horde: ((ms) => (Number.isFinite(ms) && ms >= 60_000 ? ms : 3600 * 1000))(Number(process.env.ONP_REIMPORT_HORDE_MS || NaN)) },
50
53
  } : null,
51
54
  });
52
55
  if (process.env.ONP_ALLOW_PRIVATE === '1') console.log('WARNING: SSRF guard disabled (ONP_ALLOW_PRIVATE=1) — dev only');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opennodes/registry",
3
- "version": "0.1.56",
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)",
3
+ "version": "0.1.58",
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, AI Horde), MCP surface, and the web app (catalog, chat, advisor, Node Builder)",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "src/server.js",
@@ -43,7 +43,7 @@
43
43
  "access": "public"
44
44
  },
45
45
  "dependencies": {
46
- "@opennodes/core": "0.1.25",
46
+ "@opennodes/core": "0.1.27",
47
47
  "pg": "^8.13.1"
48
48
  }
49
49
  }
package/src/importers.js CHANGED
@@ -1,9 +1,12 @@
1
1
  // DS-IMP-01: seed importers so search is useful before any real registration.
2
2
  // Imported records enter as unverified, unsigned, source='import', and are
3
3
  // excluded from verified tiers until claimed by their operator.
4
+ import { readFileSync } from 'node:fs';
4
5
  import { validateCard } from '@opennodes/core';
5
6
  import { ARTIFACT } from './vendors.js';
6
7
 
8
+ const { version: REGISTRY_VERSION } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
9
+
7
10
  const slug = (s) => String(s).toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^[^a-z0-9]+/, '').slice(0, 100);
8
11
  const vendorSlug = (s) => slug(s).replace(/[._]/g, '-');
9
12
  /** The value as a string if it is a concrete http(s) URL, else undefined. Templated
@@ -409,6 +412,154 @@ export async function importOpenRouter(store, catalog) {
409
412
  return { providers: 1, offerings: offeringList.length, skipped: [] };
410
413
  }
411
414
 
415
+ /* ------------------------------------------------------------------ AI Horde */
416
+
417
+ // The AI Horde (aihorde.net, run by the non-profit Haidra) is a free network of volunteer GPUs: workers
418
+ // poll a coordinator and run whole models on their own machines, and queue priority follows kudos, a
419
+ // non-monetary credit earned by contributing compute. The registry only reads the public model status
420
+ // and Haidra's model reference; it never sends a prompt there (imports are never probed).
421
+
422
+ /** Text models with at least one online chat worker: the ones the OpenAI-compatible front can serve. */
423
+ export const HORDE_STATUS_URL = 'https://aihorde.net/api/v2/status/models?type=text&chat=true';
424
+ /** Haidra's text model reference (AGPL-3.0): Horde model name -> display name and Hugging Face record (`url`). */
425
+ export const HORDE_TEXT_REFERENCE_URL = 'https://raw.githubusercontent.com/Haidra-Org/AI-Horde-text-model-reference/main/db.json';
426
+ /** Haidra's own OpenAI-compatible front for the Horde (documented in the AI-Horde server README). */
427
+ export const HORDE_OPENAI_BASE = 'https://oai.aihorde.net/v1';
428
+ /** Horde asks every client for `Client-Agent: name:version:contact`. The contact is the project, never a person. */
429
+ export const HORDE_CLIENT_AGENT = `opennodes-registry:${REGISTRY_VERSION}:https://opennodes.io`;
430
+ /** The Horde FAQ (who can read prompts) and the date it and the privacy policy were read for this data policy. */
431
+ export const HORDE_POLICY_SOURCE = 'https://aihorde.net/faq';
432
+ export const HORDE_POLICY_CHECKED = '2026-11-20';
433
+ const HORDE_NODE_ID = 'import.aihorde.text';
434
+ const HORDE_EMPTY = 'AI Horde import: no text model with online chat workers and a public model record';
435
+
436
+ /**
437
+ * Lineage for Horde models, only where it is certain: a Hugging Face repo that is the developer's own
438
+ * from-scratch release (the developer trained the base itself, and any distillation teacher is its own
439
+ * model). A fine-tune, merge, quantization or re-upload under another account matches none of these and
440
+ * stays unknown: a list naming only the base developer would read as clean (ONP-2 §5). Distilled
441
+ * releases (`*-Distill-*`) are excluded even under a listed account.
442
+ */
443
+ export const HORDE_FROM_SCRATCH = Object.freeze([
444
+ [/^Qwen\/Qwen\d/, 'CN'], // Qwen/Qwen3-14B, Qwen/Qwen3.8-Flash-Next
445
+ [/^zai-org\/GLM-/, 'CN'],
446
+ [/^google\/gemma-/, 'US'],
447
+ [/^meta-llama\/(Meta-)?Llama-/, 'US'],
448
+ [/^mistralai\/(Mistral|Ministral|Magistral)-/, 'FR'],
449
+ ]);
450
+
451
+ /** `org/repo` of a Hugging Face model URL, or null. */
452
+ const hfRepo = (url) => {
453
+ const m = /^https:\/\/huggingface\.co\/([A-Za-z0-9][\w.-]*)\/([\w.-]+)\/?$/.exec(String(url ?? '').trim());
454
+ return m ? `${m[1]}/${m[2]}` : null;
455
+ };
456
+
457
+ /** The developer country for a from-scratch release, else null (unknown). */
458
+ export function hordeLineage(repo) {
459
+ if (!repo || /distill/i.test(repo)) return null;
460
+ return HORDE_FROM_SCRATCH.find(([re]) => re.test(repo))?.[1] ?? null;
461
+ }
462
+
463
+ /** Horde chat feature declarations -> ONP `serving.supports` (each declared by at least one worker). */
464
+ const HORDE_FEATURES = {
465
+ tools: 'tool_calls', json_object: 'json_mode', json_schema: 'structured_outputs',
466
+ vision: 'vision', reasoning_effort: 'reasoning',
467
+ };
468
+
469
+ /**
470
+ * Import the AI Horde's text models as one synthetic node (`import.aihorde.text`).
471
+ * `status` is GET /v2/status/models?type=text&chat=true; `reference` is Haidra's text model reference
472
+ * (db.json). An offering is made only for a model with online chat workers and a Hugging Face record in
473
+ * the reference: model names are declared by the workers, and an open-weight model is named by its public
474
+ * record (ONP-2 §5), so a name with no record is skipped, never given a made-up artifact. Worker count and
475
+ * queue go into the store as the `upstream` observation (reported by the Horde, not measured here).
476
+ * With nothing to list, the node is delisted rather than left showing workers that have gone.
477
+ */
478
+ export async function importHorde(store, status, reference = {}) {
479
+ if (!Array.isArray(status)) return { providers: 0, offerings: 0, skipped: ['status is not a list'] };
480
+ const reportedAt = new Date().toISOString();
481
+ const offeringList = [];
482
+ const upstream = new Map();
483
+ const skipped = [];
484
+ for (const m of status) {
485
+ const name = typeof m?.name === 'string' ? m.name : null;
486
+ const workers = Number(m?.chat?.workers ?? 0);
487
+ if (!name || m.type !== 'text' || !(workers >= 1)) continue;
488
+ const ref = reference?.[name];
489
+ const repo = hfRepo(ref?.url);
490
+ if (!repo || !ARTIFACT.test(`hf:${repo}`)) { skipped.push(`${name}: no public model record`); continue; }
491
+ const features = Array.isArray(m.chat.features) ? m.chat.features : [];
492
+ const vision = features.includes('vision');
493
+ const supports = ['streaming', ...new Set(features.map((f) => HORDE_FEATURES[f]).filter(Boolean))];
494
+ const lineage = hordeLineage(repo);
495
+ let offeringId = slug(name.replace(/\//g, '-')) || 'model';
496
+ if (offeringList.some((o) => o.offering_id === offeringId)) offeringId = slug(`${offeringId}-${offeringList.length}`);
497
+ offeringList.push({
498
+ offering_id: offeringId,
499
+ modality: vision ? 'multimodal' : 'text',
500
+ modalities: { input: vision ? ['text', 'image'] : ['text'], output: ['text'] },
501
+ model: {
502
+ name: ref.display_name || ref.model_name || name,
503
+ family: vendorSlug(repo.split('/')[0]),
504
+ artifact: `hf:${repo}`,
505
+ ...(lineage ? { lineage_origins: [lineage] } : {}),
506
+ // No `description`: the reference is AGPL-3.0, so only its facts (names, record URL) are used.
507
+ },
508
+ serving: {
509
+ supports,
510
+ ...(Number.isInteger(m.chat.max_context_length) && m.chat.max_context_length > 0 ? { context_window: m.chat.max_context_length } : {}),
511
+ ...(Number.isInteger(m.chat.max_length) && m.chat.max_length > 0 ? { max_output_tokens: m.chat.max_length } : {}),
512
+ },
513
+ binding: { profile: 'onp.openai.chat/v1', model_id: name },
514
+ // Free; queue order by kudos and the free output allowance have no ONP field yet (see the README).
515
+ pricing: { currency: 'USD', input_per_mtok: 0, output_per_mtok: 0, schemes: ['free'] },
516
+ // Volunteers run the models on their own machines and can read and keep prompts and outputs.
517
+ // Nobody can promise anything about training for them, so training_on_inputs stays unstated.
518
+ data_policy: { retention: 'logged', source: HORDE_POLICY_SOURCE, checked: HORDE_POLICY_CHECKED },
519
+ });
520
+ upstream.set(offeringId, {
521
+ source: 'aihorde', basis: 'reported', reported_at: reportedAt, workers,
522
+ queued_tokens: Number(m.queued ?? 0), jobs: Number(m.jobs ?? 0), eta_s: Number(m.eta ?? 0),
523
+ });
524
+ }
525
+
526
+ const node = await store.getNode(HORDE_NODE_ID);
527
+ if (!offeringList.length) {
528
+ if (node?.state === 'indexed') await store.setState(HORDE_NODE_ID, 'delisted', HORDE_EMPTY);
529
+ return { providers: 0, offerings: 0, skipped: [...skipped, 'nothing to list'] };
530
+ }
531
+ const card = {
532
+ onp: '0.1',
533
+ revision: reportedAt,
534
+ node: {
535
+ id: HORDE_NODE_ID,
536
+ name: 'AI Horde (volunteer GPUs)',
537
+ description: 'Imported from the AI Horde public model status (aihorde.net), run by the non-profit Haidra. '
538
+ + 'Free: volunteers run the models on their own machines, and the queue is ordered by kudos, so requests '
539
+ + 'with the anonymous key 0000000000 wait longest; a free registered key gets better priority. '
540
+ + 'Volunteer workers can technically read and keep prompts and outputs: never send personal data. '
541
+ + 'Worker counts and queues are a snapshot reported by the Horde. Call it with your own AI Horde key '
542
+ + 'at the OpenAI-compatible front. Terms: https://aihorde.net/terms. Privacy: https://aihorde.net/privacy. '
543
+ + 'FAQ: https://aihorde.net/faq. Metadata only, unclaimed by the operator.',
544
+ operator: { name: 'AI Horde (Haidra, volunteer workers)', url: 'https://aihorde.net' },
545
+ },
546
+ endpoints: { openai: HORDE_OPENAI_BASE, health: 'https://aihorde.net/api/v2/status/heartbeat', docs: 'https://oai.aihorde.net/docs' },
547
+ offerings: offeringList,
548
+ payment: { schemes: [{ scheme: 'free' }] },
549
+ };
550
+ const err = await saveImportedCard(store, HORDE_NODE_ID, 'https://aihorde.net', 'import:aihorde', card);
551
+ if (err) return { providers: 0, offerings: 0, skipped: [...skipped, err] };
552
+ // Back after an empty snapshot; a delisting by anyone else stays.
553
+ if (node?.state === 'delisted' && (await store.transitionsFor(HORDE_NODE_ID)).at(-1)?.reason === HORDE_EMPTY) {
554
+ await store.setState(HORDE_NODE_ID, 'indexed', 'AI Horde import: chat workers back online');
555
+ }
556
+ for (const [offeringId, value] of upstream) await store.setObservation(HORDE_NODE_ID, offeringId, 'upstream', value);
557
+ return {
558
+ providers: 1, offerings: offeringList.length, skipped,
559
+ workers: [...upstream.values()].reduce((n, u) => n + u.workers, 0),
560
+ };
561
+ }
562
+
412
563
  /* ------------------------------------------------------------------ locations (ONP-2 §3a) */
413
564
 
414
565
  /** Save a listing-only card: like saveImportedCard, but without invocation endpoints. */
package/src/mcp.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // MCP host gets ONP discovery (recommend, search_offerings, get_offering, get_node, estimate,
4
4
  // find_locations, find_residency) for free.
5
5
  import { readFileSync } from 'node:fs';
6
- import { readJson, sendJson, problem, estimateBounds, round6, extractFeatures, recommend, MCP_TOOLS, MCP_INSTRUCTIONS, summarizeNode, serverCheckOf } from '@opennodes/core';
6
+ import { readJson, sendJson, problem, estimateBounds, round6, extractFeatures, recommend, MCP_TOOLS, MCP_INSTRUCTIONS, summarizeNode, serverCheckOf, mcpToolResult } from '@opennodes/core';
7
7
  import { searchOfferingsPaged, searchOfferings, collectOfferings, pricePublished, locationSummary } from './search.js';
8
8
  import { buildLocations, buildResidency } from './locations.js';
9
9
  import { nodeIdsIn } from './counts.js';
@@ -139,11 +139,7 @@ async function handleRpc(store, seeds, msg, onResult, trusted) {
139
139
  try {
140
140
  const result = await runTool(store, seeds, params?.name, params?.arguments, trusted);
141
141
  onResult?.(nodesReturned(params.name, result));
142
- return reply({
143
- content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
144
- structuredContent: result,
145
- isError: false,
146
- });
142
+ return reply(mcpToolResult(result)); // operator text cut and marked untrusted (review 4.11)
147
143
  } catch (err) {
148
144
  return reply({ content: [{ type: 'text', text: String(err.message) }], isError: true });
149
145
  }
package/src/reimport.js CHANGED
@@ -3,24 +3,51 @@
3
3
  import {
4
4
  importModelsDev, importHuggingFace, importOpenRouter,
5
5
  importOllamaLibrary, parseOllamaLibrary,
6
- importOpenRouterProviders, fetchOpenRouterEndpoints,
6
+ importOpenRouterProviders, fetchOpenRouterEndpoints, importHorde,
7
7
  HF_ROUTER_URL, HF_HUB_URL, OPENROUTER_URL, OPENROUTER_PROVIDERS_URL, OLLAMA_LIBRARY_URL,
8
+ HORDE_STATUS_URL, HORDE_TEXT_REFERENCE_URL, HORDE_CLIENT_AGENT,
8
9
  } from './importers.js';
9
10
 
10
11
  export const MODELS_DEV_URL = 'https://models.dev/api.json';
11
12
 
13
+ /**
14
+ * Sources that go stale faster than the catalog interval. AI Horde workers come and go within minutes,
15
+ * so its snapshot is refreshed hourly (one status read an hour is far inside the Horde's limits).
16
+ */
17
+ export const SOURCE_INTERVALS = Object.freeze({ horde: 3600 * 1000 });
18
+
19
+ /** A source's interval: its own when it is a number of at least a minute, never above `intervalMs`. */
20
+ const intervalOf = (s, intervalMs, sourceIntervals) => {
21
+ const own = sourceIntervals?.[s];
22
+ return Math.min(Number.isFinite(own) && own >= 60_000 ? own : intervalMs, intervalMs);
23
+ };
24
+
25
+ /** The sources due at `now`: never run, or last run at least their interval ago. */
26
+ export function dueSources(sources, lastRun, now, intervalMs, sourceIntervals = SOURCE_INTERVALS) {
27
+ return sources.filter((s) => !lastRun.has(s) || now - lastRun.get(s) >= intervalOf(s, intervalMs, sourceIntervals));
28
+ }
29
+
12
30
  export function startReimport(store, {
13
31
  safeFetch,
14
32
  intervalMs = 6 * 3600 * 1000, // the HF re-test cadence
15
33
  sources = ['openrouter', 'huggingface'],
34
+ sourceIntervals = SOURCE_INTERVALS,
16
35
  onCycle = null,
17
36
  } = {}) {
18
37
  let stopped = false;
38
+ const lastRun = new Map();
19
39
  const json = async (url, t = 120_000) => (await safeFetch(url, {}, t)).json();
40
+ // A refused or failed read must never look like an empty catalog: that would delist the Horde node.
41
+ const jsonOk = async (url, opts, t = 60_000) => {
42
+ const res = await safeFetch(url, opts, t);
43
+ if (!res.ok) throw new Error(`${new URL(url).host} answered ${res.status}`);
44
+ return res.json();
45
+ };
20
46
 
21
- async function cycle() {
47
+ async function cycle(only = sources) {
22
48
  const results = {};
23
- for (const source of sources) {
49
+ for (const source of only) {
50
+ lastRun.set(source, Date.now());
24
51
  try {
25
52
  if (source === 'openrouter') {
26
53
  results[source] = await importOpenRouter(store, await json(OPENROUTER_URL));
@@ -40,6 +67,14 @@ export function startReimport(store, {
40
67
  } else if (source === 'ollama') {
41
68
  const html = await (await safeFetch(OLLAMA_LIBRARY_URL, {}, 120_000)).text();
42
69
  results[source] = await importOllamaLibrary(store, parseOllamaLibrary(html));
70
+ } else if (source === 'horde') {
71
+ // Public status only (with the Client-Agent the Horde asks of every client); no prompt is sent.
72
+ const status = await jsonOk(HORDE_STATUS_URL, { headers: { 'client-agent': HORDE_CLIENT_AGENT } });
73
+ // The reference gives each model its public record. Without it nothing can be listed honestly,
74
+ // so a failed read keeps the previous snapshot instead of emptying it.
75
+ const reference = await jsonOk(HORDE_TEXT_REFERENCE_URL, {}, 120_000);
76
+ if (!reference || typeof reference !== 'object' || !Object.keys(reference).length) throw new Error('empty AI Horde model reference');
77
+ results[source] = await importHorde(store, status, reference);
43
78
  } else {
44
79
  results[source] = { error: `unknown source: ${source}` };
45
80
  }
@@ -51,10 +86,13 @@ export function startReimport(store, {
51
86
  return results;
52
87
  }
53
88
 
89
+ // Wake at the shortest interval among the sources and run only the ones that are due.
90
+ const tick = Math.min(intervalMs, ...sources.map((s) => intervalOf(s, intervalMs, sourceIntervals)));
54
91
  const loop = async () => {
55
92
  if (stopped) return;
56
- await cycle().catch(() => {});
57
- if (!stopped) setTimeout(loop, intervalMs).unref?.();
93
+ const due = dueSources(sources, lastRun, Date.now(), intervalMs, sourceIntervals);
94
+ if (due.length) await cycle(due).catch(() => {});
95
+ if (!stopped) setTimeout(loop, tick).unref?.();
58
96
  };
59
97
  setTimeout(loop, 2000).unref?.(); // first cycle shortly after boot
60
98
 
package/src/search.js CHANGED
@@ -195,6 +195,9 @@ async function buildOfferings(store) {
195
195
  probes: checks.length,
196
196
  ttft_ms: obs.ttft_ms ?? null,
197
197
  tps: obs.tps ?? null,
198
+ // What an imported network reports about itself (AI Horde: workers, queue), basis `reported`:
199
+ // the upstream's own figures at `reported_at`, never measured by this registry.
200
+ ...(obs.upstream ? { upstream: obs.upstream } : {}),
198
201
  availability,
199
202
  },
200
203
  endpoints: card.endpoints,
package/src/server.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { randomUUID } from 'node:crypto';
3
3
  import {
4
4
  createApp, listen, closeApp, sendJson, problem, readJson,
5
- validateCard, verifyCardSignature, keyFromJwk, estimateBounds,
5
+ validateCard, verifyCardWithJwks, estimateBounds,
6
6
  extractFeatures, recommend, trustedView, DEFAULT_TRUSTED_JURISDICTIONS, serverCheckOf,
7
7
  } from '@opennodes/core';
8
8
  import { resolveTxt } from 'node:dns/promises';
@@ -27,8 +27,9 @@ import { checkNodeLocation, declaredOrigins } from './location.js';
27
27
  import {
28
28
  importModelsDev, importHuggingFace, importOpenRouter,
29
29
  importOllamaLibrary, parseOllamaLibrary,
30
- importOpenRouterProviders, fetchOpenRouterEndpoints, importLocationSeed,
30
+ importOpenRouterProviders, fetchOpenRouterEndpoints, importLocationSeed, importHorde,
31
31
  HF_ROUTER_URL, HF_HUB_URL, OPENROUTER_URL, OPENROUTER_PROVIDERS_URL, OLLAMA_LIBRARY_URL,
32
+ HORDE_STATUS_URL, HORDE_TEXT_REFERENCE_URL, HORDE_CLIENT_AGENT,
32
33
  } from './importers.js';
33
34
  import { locationRoutes, loadLocationSeeds, seedPlacements, seedNodeSites, nodeServes } from './locations.js';
34
35
  import { makeRequestCounter, nodeIdsIn } from './counts.js';
@@ -131,10 +132,7 @@ export async function startRegistry({
131
132
  jwks = await res.json();
132
133
  } catch (err) { return { ok: false, definite: false, error: `jwks fetch failed: ${err.message}` }; }
133
134
  try {
134
- const kid = card.signatures[0].kid;
135
- const jwk = (jwks.keys ?? []).find((k) => !kid || k.kid === kid) ?? jwks.keys?.[0];
136
- if (!jwk) return { ok: false, definite: true, error: 'no key in jwks' };
137
- verifyCardSignature(card, keyFromJwk(jwk));
135
+ verifyCardWithJwks(card, jwks); // any signature, by kid first, with a key the origin publishes
138
136
  return { ok: true };
139
137
  } catch (err) { return { ok: false, definite: true, error: String(err.message ?? err) }; }
140
138
  }
@@ -423,6 +421,9 @@ export async function startRegistry({
423
421
  if (!registerLimiter(clientOf(req))) return problem(res, 429, 'rate-limited', 'too many refresh requests from this address; try again later');
424
422
  const node = await store.getNode(params.id);
425
423
  if (!node) return problem(res, 404, 'unknown-node', params.id);
424
+ // A ping runs Stage A, which calls the endpoint. Imports are never probed: some upstreams (the AI
425
+ // Horde) answer requests without a key, so a public ping must not become traffic to them.
426
+ if (node.source === 'import') return problem(res, 409, 'imported-listing', `${node.id} is an imported catalog listing; the registry does not probe it`);
426
427
  try {
427
428
  const { card } = await indexCard(params.id, node.card_url);
428
429
  if (location) relocateIfStale(params.id, card).catch(() => {}); // background: a new API host is checked again now
@@ -780,6 +781,21 @@ export async function startRegistry({
780
781
  sendJson(res, 200, await importOpenRouter(store, catalog));
781
782
  }],
782
783
 
784
+ // AI Horde importer (admin): inline {status, reference}, or read the live public status (with the
785
+ // Client-Agent the Horde asks for) and Haidra's text model reference. Nothing is sent to a worker.
786
+ ['POST', '/v0/import/horde', async (req, res) => {
787
+ if (!adminOk(req, res)) return;
788
+ const body = await readJson(req, 20_000_000);
789
+ const read = async (url, opts) => {
790
+ const r = await safeFetch(url, opts, 60_000);
791
+ if (!r.ok) throw new Error(`${new URL(url).host} answered ${r.status}`);
792
+ return r.json();
793
+ };
794
+ const status = body.status ?? await read(HORDE_STATUS_URL, { headers: { 'client-agent': HORDE_CLIENT_AGENT } });
795
+ const reference = body.reference ?? await read(HORDE_TEXT_REFERENCE_URL, {});
796
+ sendJson(res, 200, await importHorde(store, status, reference));
797
+ }],
798
+
783
799
  // OpenRouter per-provider importer with declared locations (admin): inline
784
800
  // {providers, models, endpoints: {modelId: [...]}}, or fetch the live APIs (one call per model).
785
801
  ['POST', '/v0/import/openrouter-providers', async (req, res) => {
package/src/stageb.js CHANGED
@@ -85,10 +85,16 @@ export const STAGE_B_409 = 'identity-409';
85
85
  * revision, or null when the pinned one is still current.
86
86
  * - `stale`: a new revision, within the bound: recorded, the run stops unjudged, the caller retries;
87
87
  * - `refused`: the current revision was pinned: a reply that does not match;
88
- * - `moved`: a new revision again, beyond the bound: the run ends as not passed, never as a dispute
89
- * (the card the run holds is stale now, so even an honest node refuses what follows).
88
+ * - `repin`, beyond the bound, when the re-fetched card claims the same model for the offering: the run
89
+ * goes on with the re-fetched card pinned (`pin.card`) and asks again; a refusal with that revision
90
+ * pinned then counts as a reply that does not match. Before, the run ended as not passed, never as a
91
+ * dispute, so a node that swapped its model could publish a new revision at every run, reach the
92
+ * bound each time and stay at `community` instead of `disputed` (review M4, 24 Nov). An honest node
93
+ * that re-prices often loses nothing: it answers with the current revision pinned.
94
+ * - `moved`, beyond the bound, when the offering's claimed model or binding changed or is gone: the
95
+ * run ends as not passed (no reply was compared for the new claim; that change brings its own run).
90
96
  */
91
- function makeOn409(store, nodeId, card, { revisionMoved, maxExcused409 }) {
97
+ function makeOn409(store, nodeId, pin, { revisionMoved, maxExcused409 }) {
92
98
  // `status`: the reply that sent the registry to the card. Since rev. 14 scheduled runs go out on
93
99
  // the card already held, so a 404 for a model the node has just dropped gets the same rule as a
94
100
  // 409: re-fetched after the reply, excused only if the revision really moved, within the bound.
@@ -98,32 +104,53 @@ function makeOn409(store, nodeId, card, { revisionMoved, maxExcused409 }) {
98
104
  const since = (await store.getSchedule(nodeId, 'B'))?.last_at ?? '';
99
105
  const excused = await store.countProbes(nodeId, STAGE_B_409, since);
100
106
  if (excused >= maxExcused409) {
101
- return { kind: 'moved', reason: `the card revision moved again during Stage B, after ${excused} such 409s since the last judged run (at most ${maxExcused409} are excused)` };
107
+ const bound = `after ${excused} excused card changes since the last judged run (at most ${maxExcused409} are excused)`;
108
+ const latest = await store.latestCard(nodeId);
109
+ const now = latest?.revision === fresh ? latest.offerings?.find((o) => o.offering_id === offering.offering_id) : null;
110
+ if (now && testable(now) && sameModelClaim(offering, now)) {
111
+ pin.card = latest;
112
+ return { kind: 'repin', offering: now, beyond: `re-pinned to revision ${fresh} ${bound}` };
113
+ }
114
+ return { kind: 'moved', reason: `the card revision moved again during Stage B ${bound}, and the offering's claimed model or binding changed or is gone` };
102
115
  }
103
116
  await store.recordProbe(nodeId, offering.offering_id, 'B', STAGE_B_409, false,
104
- `${status} with revision ${card.revision} pinned; card re-indexed at ${fresh}; Stage B runs again later`);
117
+ `${status} with revision ${pin.card.revision} pinned; card re-indexed at ${fresh}; Stage B runs again later`);
105
118
  return { kind: 'stale' };
106
119
  };
107
120
  }
108
121
 
122
+ /** Whether two versions of an offering claim the same model behind the same binding. */
123
+ const sameModelClaim = (a, b) => a.model?.artifact === b.model?.artifact
124
+ && a.binding?.profile === b.binding?.profile && a.binding?.model_id === b.binding?.model_id;
125
+
109
126
  /**
110
127
  * DS-ADM-02: identity check against stored references. A reply that does not match is asked once
111
128
  * more before it counts (ONP-3 §6.3 disputes only a confirmed failure: batching on an engine with
112
129
  * parallel slots can change a temperature-0 reply now and then). A 409 counts as a reply that does
113
130
  * not match unless `on409` excuses it (makeOn409).
114
131
  */
115
- async function probeIdentity(safeFetch, card, offering, refs, on409) {
116
- let matches = 0, retried = 0, refused = 0, stop = null;
117
- const ask = async (prompt) => {
118
- const { status, text } = await chatOnce(safeFetch, card, offering, prompt);
132
+ async function probeIdentity(safeFetch, pin, offering, refs, on409) {
133
+ let matches = 0, retried = 0, refused = 0, refusedRepinned = 0, repinned = null, stop = null;
134
+ let current = offering;
135
+ const ask = async (prompt, again = true) => {
136
+ const { status, text } = await chatOnce(safeFetch, pin.card, current, prompt);
119
137
  if (status !== 200) {
120
138
  // A 409, or another failure (a 404 for a model dropped since the card was fetched): only a
121
139
  // revision that really moved excuses it; with the current revision pinned it does not match.
122
- const what = await on409(offering, status);
123
- if (what.kind === 'refused') { if (status === 409) refused++; } else stop = what;
140
+ const what = await on409(current, status);
141
+ if (what.kind === 'repin') {
142
+ // Beyond the bound: ask again with the revision just fetched pinned; a refusal then counts.
143
+ current = what.offering;
144
+ repinned = what.beyond;
145
+ if (again) return ask(prompt, false);
146
+ refusedRepinned++;
147
+ return null;
148
+ }
149
+ if (what.kind !== 'refused') stop = what;
150
+ else if (status === 409) refused++;
124
151
  return null;
125
152
  }
126
- return status === 200 && text !== null ? sha256(text) : null;
153
+ return text !== null ? sha256(text) : null;
127
154
  };
128
155
  for (const ref of refs) {
129
156
  let hash = await ask(ref.prompt);
@@ -131,7 +158,8 @@ async function probeIdentity(safeFetch, card, offering, refs, on409) {
131
158
  if (hash === ref.expected_hash) matches++;
132
159
  if (stop) break;
133
160
  }
134
- const extra = { ...(retried ? { retried } : {}), ...(refused ? { refused } : {}) };
161
+ const extra = { ...(retried ? { retried } : {}), ...(refused ? { refused } : {}),
162
+ ...(repinned ? { repinned, refused_repinned: refusedRepinned } : {}) };
135
163
  if (stop?.kind === 'stale') return { ok: false, matches, total: refs.length, ...extra, stale: true };
136
164
  if (stop?.kind === 'moved') return { ok: false, matches, total: refs.length, ...extra, moved: true, reason: stop.reason };
137
165
  // Deterministic battery: require all prompts to match the reference distribution.
@@ -237,14 +265,14 @@ async function probeCapacity(safeFetch, card, offering, corpus, { steps = CAPACI
237
265
  * offering cannot be verified: no usable reference for the artefact, or a proprietary artefact
238
266
  * claimed outside the vendor's namespace.
239
267
  */
240
- async function identityOf(store, nodeId, safeFetch, card, offering, { corpus, vendors, identitySample, on409 }) {
268
+ async function identityOf(store, nodeId, safeFetch, pin, offering, { corpus, vendors, identitySample, on409 }) {
241
269
  const artifact = offering.model?.artifact;
242
270
  const claim = vendorClaim(artifact, nodeId, vendors);
243
271
  if (!claim.ok) return { ok: false, unverified: true, reason: `${artifact} is not this node's to claim (vendor namespace)` };
244
272
  // References captured with public prompts prove nothing: a node could have recognised them.
245
273
  const refs = (await store.getFingerprints(artifact)).filter((r) => corpus.usableReference(r.prompt));
246
274
  if (!refs.length) return { ok: false, unverified: true, reason: NO_REFERENCE };
247
- return probeIdentity(safeFetch, card, offering, sample(refs, identitySample), on409);
275
+ return probeIdentity(safeFetch, pin, offering, sample(refs, identitySample), on409);
248
276
  }
249
277
 
250
278
  /**
@@ -260,7 +288,9 @@ export async function runStageB(store, nodeId, card, {
260
288
  safeFetch, capacity = {}, corpus = DEV_CORPUS, vendors = vendorTable(), signed = true, identitySample = IDENTITY_SAMPLE,
261
289
  revisionMoved = null, maxExcused409 = MAX_EXCUSED_409,
262
290
  } = {}) {
263
- const on409 = makeOn409(store, nodeId, card, { revisionMoved, maxExcused409 });
291
+ // The card the run pins: the one held, until a refusal beyond the bound re-pins the fetched one.
292
+ const pin = { card };
293
+ const on409 = makeOn409(store, nodeId, pin, { revisionMoved, maxExcused409 });
264
294
  const untested = untestedOfferings(card);
265
295
  if (!signed) {
266
296
  await store.recordProbe(nodeId, null, 'B', 'signature', false, UNSIGNED_CARD);
@@ -270,26 +300,31 @@ export async function runStageB(store, nodeId, card, {
270
300
  return { ok: false, identityFailed: false, reason: NO_TESTED_OFFERINGS, verdicts: [], untested };
271
301
  }
272
302
  const verdicts = [];
273
- for (const offering of card.offerings) {
274
- if (!testable(offering)) continue;
303
+ // The offering as the pinned card lists it now (a re-pin replaces the card mid-run).
304
+ const pinned = (o) => pin.card.offerings.find((p) => p.offering_id === o.offering_id) ?? o;
305
+ for (const listed of card.offerings) {
306
+ if (!testable(listed)) continue;
307
+ let offering = pinned(listed);
275
308
  const verdict = { offering_id: offering.offering_id, identity: null, context: null, capacity: null };
276
309
 
277
- verdict.identity = await identityOf(store, nodeId, safeFetch, card, offering, { corpus, vendors, identitySample, on409 });
310
+ verdict.identity = await identityOf(store, nodeId, safeFetch, pin, offering, { corpus, vendors, identitySample, on409 });
278
311
  if (verdict.identity.stale) {
279
312
  // The card's revision really moved (an excused 409, recorded). Abort without judging: the caller retries.
280
313
  return { ok: false, identityFailed: false, stale: true, verdicts: [...verdicts, verdict], untested };
281
314
  }
282
- const { matches, total, refused } = verdict.identity;
315
+ const { matches, total, refused, repinned, refused_repinned: refusedRepinned } = verdict.identity;
283
316
  await store.recordProbe(nodeId, offering.offering_id, 'B', 'identity', verdict.identity.ok,
284
317
  verdict.identity.unverified ? `identity unverified: ${verdict.identity.reason}`
285
318
  : verdict.identity.moved ? `not judged: ${verdict.identity.reason}`
286
- : `${matches}/${total} reference matches${refused ? `; ${refused} replies refused with 409, the current card revision pinned` : ''}`);
319
+ : `${matches}/${total} reference matches${refused ? `; ${refused} replies refused with 409, the current card revision pinned` : ''}`
320
+ + (repinned ? `; ${repinned}${refusedRepinned ? `, then ${refusedRepinned} refusals with it pinned, counted as replies that do not match` : ''}` : ''));
287
321
  if (verdict.identity.moved) {
288
- // Beyond the bound: not passed, and nothing more is sent on a card that is no longer current.
322
+ // Beyond the bound, and the claimed model changed: not passed, and nothing more is sent.
289
323
  return { ok: false, identityFailed: false, reason: `${offering.offering_id}: ${verdict.identity.reason}`, verdicts: [...verdicts, verdict], untested };
290
324
  }
325
+ offering = pinned(offering);
291
326
 
292
- verdict.context = await probeContext(safeFetch, card, offering, corpus);
327
+ verdict.context = await probeContext(safeFetch, pin.card, offering, corpus);
293
328
  await store.recordProbe(nodeId, offering.offering_id, 'B', 'context', verdict.context.ok,
294
329
  `claimed ${verdict.context.claimed}, verified ${verdict.context.verified_cap}`,
295
330
  verdict.context);
@@ -297,13 +332,15 @@ export async function runStageB(store, nodeId, card, {
297
332
  // earlier cap; 0 = nothing verified, shown as unverified rather than trusting the claim.
298
333
  await store.setObservation(nodeId, offering.offering_id, 'context_cap', verdict.context.verified_cap);
299
334
 
300
- verdict.capacity = await probeCapacity(safeFetch, card, offering, corpus, capacity);
335
+ verdict.capacity = await probeCapacity(safeFetch, pin.card, offering, corpus, capacity);
301
336
  if (!verdict.capacity.ok) {
302
337
  // A failed ramp on a card that has since moved (the model dropped or changed during the run)
303
338
  // is not judged, by the same rule and bound as a 409.
304
339
  const what = await on409(offering, 'capacity failure');
305
340
  if (what.kind === 'stale') return { ok: false, identityFailed: false, stale: true, verdicts: [...verdicts, verdict], untested };
306
341
  if (what.kind === 'moved') return { ok: false, identityFailed: false, reason: `${offering.offering_id}: ${what.reason}`, verdicts: [...verdicts, verdict], untested };
342
+ // Beyond the bound, same model: the ramp once more with the fetched card pinned, and that one counts.
343
+ if (what.kind === 'repin') { offering = what.offering; verdict.capacity = await probeCapacity(safeFetch, pin.card, offering, corpus, capacity); }
307
344
  }
308
345
  await store.recordProbe(nodeId, offering.offering_id, 'B', 'capacity', verdict.capacity.ok, null, verdict.capacity);
309
346
  if (verdict.capacity.ttft_ms.p50 != null) {
@@ -655,20 +655,20 @@
655
655
  <p class="sub">Listing is open; tiers are earned. The registry runs an automated admission battery against your live endpoints — no paperwork, no gatekeepers, no exceptions. Every verdict is recorded and visible in your node's listing history.</p>
656
656
  <div class="panel pad" style="max-width:56rem">
657
657
  <div class="stage"><span class="k">STAGE A</span><span><b>Conformance</b> — gate to <span class="chip t-community">COMMUNITY</span>, minutes. Health endpoint live; card valid; models list agrees with the card; one blind invocation returns proper usage accounting; a proprietary artefact (<code>urn:proprietary:{vendor}:…</code>) only from that vendor's own namespace, so name open-weight models by their public record (<code>hf:</code>, <code>ollama:</code>). Runs when you verify your registration, on every new card revision, and again at least every 6 hours on the registry's own timer.</span></div>
658
- <div class="stage"><span class="k">STAGE B</span><span><b>Substance</b> — gate to <span class="chip t-verified">VERIFIED</span>, hours. The registry chooses when it runs; nobody can ask for it. <b>Identity fingerprinting:</b> prompts from a private set, at temperature 0, compared with reference answers the registry captured from a deployment of the same weights it trusts. With no reference for your model's artefact, identity is unverified and the node stays at community. A mismatch marks the node <i>disputed</i> and delists it; registering again does not end a dispute, only a resolution the registry records after review. A 409 to a fingerprint prompt stops the run only when your card's revision really changed (then it runs again within the hour, at most 3 times before a run is judged); with the current revision pinned, a 409 counts as a reply that does not match. <b>Signed card:</b> the verified tier needs a card whose signature verifies against your JWKS. <b>Card-only listings:</b> if you gave a probe key at registration, probes carrying it are easy to pick out, so the node stays at community until the registry has bought access to your API as an ordinary customer; from then on probes use that access, and the next Stage B can verify the node. <b>Context verification:</b> needle-in-haystack probes at 25/50/90% of the claimed window; overclaims are capped to the verified size, visibly. <b>Capacity ramp:</b> stepped concurrent load; measured TTFT/throughput overrides claims in search results.</span></div>
658
+ <div class="stage"><span class="k">STAGE B</span><span><b>Substance</b> — gate to <span class="chip t-verified">VERIFIED</span>, hours. The registry chooses when it runs; nobody can ask for it. <b>Identity fingerprinting:</b> prompts from a private set, at temperature 0, compared with reference answers the registry captured from a deployment of the same weights it trusts. With no reference for your model's artefact, identity is unverified and the node stays at community. A mismatch marks the node <i>disputed</i> and delists it; registering again does not end a dispute, only a resolution the registry records after review. A 409 to a fingerprint prompt stops the run only when your card's revision really changed (then it runs again within the hour, at most 3 times before a run is judged); with the current revision pinned, or beyond those 3, a 409 counts as a reply that does not match. <b>Signed card:</b> the verified tier needs a card whose signature verifies against your JWKS. <b>Card-only listings:</b> if you gave a probe key at registration, probes carrying it are easy to pick out, so the node stays at community until the registry has bought access to your API as an ordinary customer; from then on probes use that access, and the next Stage B can verify the node. <b>Context verification:</b> needle-in-haystack probes at 25/50/90% of the claimed window; overclaims are capped to the verified size, visibly. <b>Capacity ramp:</b> stepped concurrent load; measured TTFT/throughput overrides claims in search results.</span></div>
659
659
  <div class="stage"><span class="k">STAGE C</span><span><b>Continuous</b> — keeps the tier honest. Liveness sweeps feed a rolling availability score; random blind invocations at unpredictable times, worded like ordinary requests, defeat "benchmark mode". On verified nodes some of them ask an identity prompt, and a reply that is not the reference's brings Stage B within the hour. Sustained liveness failures suspend the listing; blind invocations that keep failing while the node answers its health checks cost it a tier.</span></div>
660
660
  <div class="stage"><span class="k">COVERAGE</span><span><b>What is tested.</b> This registry has tests only for chat offerings (<code>onp.openai.chat/v1</code>). A tier covers only the offerings it could test: speech, embeddings, image or any other offering is listed as <span class="chip untested">UNTESTED</span>, and its tier is capped to <span class="chip t-unverified">UNVERIFIED</span> whatever the node's tier. A node with no chat offering stays unverified, because Stage A has nothing to call.</span></div>
661
661
  </div>
662
662
  <h2 id="probe-load">Probe load</h2>
663
663
  <p class="sub">Everything this registry sends to your endpoints, as the code runs today: how much, how often and what starts it, so you can size your probe allowance. A <i>chat offering</i> is one bound to <code>onp.openai.chat/v1</code>; other offerings get only the health and models checks. Probe calls carry your probe key if you gave one at registration, or, once the registry has bought access to your API as a customer, that access instead; the registry does not pay for calls made with your probe key. Their wording comes from a private set of ordinary requests, the same kind your customers send; it is not published.</p>
664
664
  <div class="panel pad" style="max-width:56rem" id="probe-load-table">
665
- <div class="stage"><span class="k">STAGE A</span><span><b>When:</b> when you verify your registration, on each <code>PUT /v0/nodes/{id}/ping</code>, on every new card revision, and at least every 6&nbsp;hours (each gap is random, 4.5 to 6&nbsp;hours), each time after a fetch of your card.<br><b>Sends:</b> 1 GET to your health endpoint, 1 GET to <code>/models</code>, and 1 blind chat completion per chat offering (a short request, at most 32 output tokens): about 4 of each a day.</span></div>
665
+ <div class="stage"><span class="k">STAGE A</span><span><b>When:</b> when you verify your registration, on each <code>PUT /v0/nodes/{id}/ping</code>, on every new card revision, and at least every 6&nbsp;hours (each gap is random, 4.5 to 6&nbsp;hours); a scheduled run uses the card the registry already holds.<br><b>Sends:</b> 1 GET to your health endpoint, 1 GET to <code>/models</code>, and 1 blind chat completion per chat offering (a short request, at most 32 output tokens): about 4 of each a day.</span></div>
666
666
  <div class="stage"><span class="k">STAGE B</span><span><b>When:</b> on the registry's schedule, never on request: between 1 and 24&nbsp;hours after your node reaches community; at a random time within 72&nbsp;hours of a change to a chat offering's model, serving, hardware or binding block, a new chat offering, or a change to your API endpoint; within 1&nbsp;hour of a confirmed identity mismatch in a blind call (below), at most once a day; within 1&nbsp;hour after a run stopped because your card's revision changed; again after 7&nbsp;days when a run did not pass; and after a pass at a random time from 1&nbsp;day on, and at most every 91&nbsp;days. That random run is set apart: a run that a change brings does not move it. The registry admin can also run it.<br><b>Sends, per chat offering</b> (up to 20 chat completions, plus one repeat for each identity reply that does not match):
667
667
  <br>· <b>Fingerprint battery:</b> 3 prompts drawn at random from the 8 reference prompts the registry holds for your model's artefact, at temperature 0, at most 64 output tokens each. With no reference for the artefact nothing is asked, and the offering cannot be verified.
668
668
  <br>· <b>Calibration:</b> 1 call with about 4,000 characters of text, at most 4 output tokens, to measure your tokenizer.
669
669
  <br>· <b>Context:</b> 3 probes sized at 25, 50 and 90% of the claimed context window, at most 64 output tokens each: about 1.65 times the window in prompt tokens altogether (about 210k tokens for a 128k window).
670
670
  <br>· <b>Capacity ramp:</b> one batch each of 1, 4 and 8 parallel requests (13 calls, at most 48 output tokens each) inside a 3-second budget; a step that would start after the budget is skipped.</span></div>
671
- <div class="stage"><span class="k">STAGE C</span><span><b>When:</b> continuously, for community, verified and attested nodes, and for nodes suspended for liveness until they recover.<br><b>Sends:</b> 1 GET to your health endpoint every 5&nbsp;minutes on average (each gap is random, 2.5 to 7.5&nbsp;minutes), and 1 blind chat completion per node per hour on average (30 to 90&nbsp;minutes apart, to a randomly chosen chat offering, at temperature 0 and at most 64 output tokens), each after a fetch of your card. That is about 288 health checks and 24 chat calls a day per node, whatever the number of offerings.<br><b>Identity:</b> on verified and attested nodes, about 1 in 4 of those calls asks one of the identity prompts the registry holds references for, instead of an ordinary request and in the same form. A reply that does not match is asked once more; a second miss makes Stage B due within the hour, at most once a day. It never changes your tier by itself.<br><b>409 answers:</b> excused only when your card's revision really changed, at most 3 a day; the registry then fetches the new card, asks once more at once, and sends one more blind chat completion against the new revision at a random time within the hour. Any other 409 counts as a failed call. When 3 blind calls in a row fail while your health checks pass, the node drops one tier (verified to community, community to unverified); the scheduled stages bring it back.</span></div>
671
+ <div class="stage"><span class="k">STAGE C</span><span><b>When:</b> continuously, for community, verified and attested nodes, and for nodes suspended for liveness until they recover.<br><b>Sends:</b> 1 GET to your health endpoint every 5&nbsp;minutes on average (each gap is random, 2.5 to 7.5&nbsp;minutes), and 1 blind chat completion per node per hour on average (30 to 90&nbsp;minutes apart, to a randomly chosen chat offering, at temperature 0 and at most 64 output tokens), on the card the registry already holds; it fetches your card about once an hour, on a timer of its own. That is about 288 health checks and 24 chat calls a day per node, whatever the number of offerings.<br><b>Identity:</b> on verified and attested nodes, about 1 in 4 of those calls asks one of the identity prompts the registry holds references for, instead of an ordinary request and in the same form. A reply that does not match is asked once more; a second miss makes Stage B due within the hour, at most once a day. It never changes your tier by itself.<br><b>409 answers:</b> excused only when your card's revision really changed, at most 3 a day; the registry then fetches the new card, asks once more at once, and sends one more blind chat completion against the new revision at a random time within the hour. Any other 409 counts as a failed call. When 3 blind calls in a row fail while your health checks pass, the node drops one tier (verified to community, community to unverified); the scheduled stages bring it back.</span></div>
672
672
  <div class="stage"><span class="k">REFERENCES</span><span><b>When:</b> when the registry admin captures identity references for a model, from a deployment of the same weights the registry trusts.<br><b>Sends:</b> 8 chat completions at temperature 0, at most 64 output tokens each.</span></div>
673
673
  <div class="stage"><span class="k">LOCATION</span><span><b>When:</b> after verification and then daily.<br><b>Sends:</b> 3 TCP connections to port 443 of your API host from each probe site (Nuremberg and Helsinki). No HTTP request.</span></div>
674
674
  </div>
@@ -924,11 +924,19 @@ const invocable = (o) => o.invocable !== false && Boolean(o.endpoints?.openai);
924
924
  const runsLocally = (o) => Boolean(o.local) || /^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])(:|\/|$)/i.test(o.endpoints?.openai ?? '');
925
925
  /** endpoints.docs only when it is a plain web link (cards are third-party data). */
926
926
  const docsUrl = (endpoints) => /^https?:\/\//i.test(endpoints?.docs ?? '') ? endpoints.docs : null;
927
+ /** The AI Horde import: volunteers' machines, so a catalog listing in the open pool, never a claim to verify. */
928
+ const HORDE_NODE = 'import.aihorde.text';
927
929
  function provLine(o) {
928
930
  const obs = o.observed || {};
929
931
  const bits = [`revision ${esc((o.card_revision || '').slice(0, 10))}`];
930
932
  if (obs.probes > 0) bits.push(`probes ${Math.round((obs.probe_success ?? 0) * obs.probes)}/${obs.probes} pass`);
931
- if (o.source === 'import') bits.push('catalog import — operator can claim this listing to get verified');
933
+ if (o.source === 'import') bits.push(o.node_id === HORDE_NODE ? 'catalog import from the AI Horde\'s public status — never probed by this registry'
934
+ : 'catalog import — operator can claim this listing to get verified');
935
+ const up = obs.upstream;
936
+ if (up && Number.isFinite(up.workers)) {
937
+ bits.push(`${up.workers} volunteer worker${up.workers === 1 ? '' : 's'} online, queue ${Number(up.eta_s) > 0 ? `≈${Math.round(up.eta_s)} s` : 'empty'}`
938
+ + ` — reported by ${up.source === 'aihorde' ? 'the AI Horde' : 'the upstream'}${up.reported_at ? ` at ${esc(String(up.reported_at).slice(0, 16).replace('T', ' '))} UTC` : ''}, not measured here`);
939
+ }
932
940
  if (!invocable(o)) bits.push('listing only — no known API endpoint, so it cannot be called from here'
933
941
  + (docsUrl(o.endpoints) ? ` (<a href="${esc(docsUrl(o.endpoints))}" target="_blank" rel="noopener">provider docs ↗</a>)` : ''));
934
942
  return bits.join(' · ');
@@ -1709,7 +1717,9 @@ function importKeyHint(offering, base, key) {
1709
1717
  const host = new URL(base).host;
1710
1718
  if (offering.local || /^(localhost|127\.0\.0\.1|\[::1\])(:|$)/.test(host)) return null; // your own machine: no key
1711
1719
  const where = host.includes('huggingface') ? 'a Hugging Face token (huggingface.co/settings/tokens)'
1712
- : host.includes('openrouter') ? 'an OpenRouter API key (openrouter.ai/keys)' : `an API key for ${host}`;
1720
+ : host.includes('openrouter') ? 'an OpenRouter API key (openrouter.ai/keys)'
1721
+ : host === 'oai.aihorde.net' ? 'an AI Horde key (free at aihorde.net/register; the anonymous key 0000000000 works but waits longest; volunteers can read prompts, so no personal data)'
1722
+ : `an API key for ${host}`;
1713
1723
  return `This is an imported catalog listing served by ${host}: your browser calls it directly, which needs ${where} — paste it in the API key field (stored only in this browser). Or run it locally with BYOK: npx @opennodes/cli gateway --key ${host}=<key>. Registered OpenNodes nodes need no key.`;
1714
1724
  }
1715
1725
  async function callTarget(t, messages, maxTokens = 1024) {
@@ -2563,6 +2573,19 @@ async function loadFeed() {
2563
2573
  const CLAIM_GUIDE = 'https://github.com/opennodes-io/opennodes/tree/main/node-kit#card-only-listing-you-already-run-an-openai-compatible-api';
2564
2574
  function claimBanner(n, card) {
2565
2575
  if (n.source !== 'import' || ['delisted', 'claimed'].includes(n.state)) return '';
2576
+ if (n.id === HORDE_NODE) {
2577
+ return `<div class="panel pad" style="max-width:56rem; margin:0.4rem 0 0.8rem; border-left:3px solid var(--accent)">
2578
+ <p style="margin:0 0 0.35rem; font-weight:600">About this listing</p>
2579
+ <p style="margin:0 0 0.6rem; font-size:0.86rem; color:var(--muted); overflow-wrap:anywhere">The AI Horde is a free network run by the non-profit Haidra: volunteers run the models on their own machines, and the queue is ordered by kudos. This registry reads only the Horde's public model status and Haidra's model reference, about once an hour, and never sends a prompt. Volunteer workers can technically read prompts and outputs, so these listings stay in the open pool: never use them for personal data. To call a model, use your own AI Horde key (or the anonymous key <span class="mono">0000000000</span>, which waits longest) at the Horde's OpenAI-compatible front. Haidra: to change or remove this listing, write to us.</p>
2580
+ <span style="display:inline-flex; gap:0.6rem; flex-wrap:wrap; font-size:0.84rem">
2581
+ <a href="https://aihorde.net/terms" target="_blank" rel="noopener">Horde terms ↗</a>
2582
+ <a href="https://aihorde.net/privacy" target="_blank" rel="noopener">Privacy ↗</a>
2583
+ <a href="https://aihorde.net/faq" target="_blank" rel="noopener">FAQ ↗</a>
2584
+ <a href="https://aihorde.net/register" target="_blank" rel="noopener">Get a free key ↗</a>
2585
+ <a href="mailto:operators@opennodes.io?subject=${encodeURIComponent('AI Horde listing')}">operators@opennodes.io</a>
2586
+ </span>
2587
+ </div>`;
2588
+ }
2566
2589
  const name = card.node?.operator?.name || card.node?.name || n.id;
2567
2590
  let host = null;
2568
2591
  try { host = new URL(card.endpoints?.openai).hostname; } catch { /* listing without an API */ }
@@ -2625,8 +2648,9 @@ function dataPolicyLine(o) {
2625
2648
  }
2626
2649
 
2627
2650
  /** Server-location check (registry location.js) in plain words; `check` is the node's server_check for its current card. */
2628
- function locationRow(loc, imported, check) {
2651
+ function locationRow(loc, imported, check, country = null) {
2629
2652
  const claim = imported ? 'inferred for this unclaimed listing' : 'declared by the operator';
2653
+ if (!loc && imported && !country) return `<tr><td style="color:var(--muted)" class="mono">server</td><td style="font-size:0.8rem">not checked <span style="color:var(--muted)">· this listing names no operator country, so it has nothing to be checked against</span></td></tr>`;
2630
2654
  if (!loc) return `<tr><td style="color:var(--muted)" class="mono">server</td><td style="font-size:0.8rem">not checked yet <span style="color:var(--muted)">· the operator's country is ${claim}, not verified</span></td></tr>`;
2631
2655
  const srv = loc.server || {};
2632
2656
  const words = {
@@ -2703,7 +2727,7 @@ async function loadNode(id) {
2703
2727
  <div class="panel pad" style="max-width:56rem; margin-top:0.6rem"><table class="grid">
2704
2728
  <tr><td style="color:var(--muted); width:8rem" class="mono">endpoint</td><td class="mono" style="font-size:0.74rem">${card.endpoints?.openai ? esc(card.endpoints.openai) : '— <span style="font-family:inherit; color:var(--muted)">listing only: no known API endpoint, not callable from OpenNodes</span>'}</td></tr>
2705
2729
  ${docsUrl(card.endpoints) ? `<tr><td style="color:var(--muted)" class="mono">docs</td><td class="mono" style="font-size:0.74rem"><a href="${esc(docsUrl(card.endpoints))}" target="_blank" rel="noopener">${esc(docsUrl(card.endpoints))}</a></td></tr>` : ''}
2706
- ${locationRow(n.location, n.source === 'import', n.server_check)}
2730
+ ${locationRow(n.location, n.source === 'import', n.server_check, card.node?.operator?.country ?? null)}
2707
2731
  ${card.hardware ? `<tr><td style="color:var(--muted)" class="mono">hardware</td><td style="font-size:0.78rem">${hwStr({ hardware: card.hardware })}</td></tr>` : ''}
2708
2732
  ${returnedRow(n.request_counts, n.id)}
2709
2733
  ${testedRow(n, offers.length, untested.size)}