@opennodes/registry 0.1.40 → 0.1.41

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
@@ -13,9 +13,12 @@ What it does:
13
13
  - **Registration with proof of resource** — namespace challenge (HTTP or DNS TXT), Stage A conformance probes, Stage B identity fingerprinting / context verification / capacity ramp, Stage C continuous liveness and blind probes. Trust tiers: `unverified → community → verified` (+ `disputed`, `suspended`). Claimed ≠ measured ≠ attested — always labeled, never blended.
14
14
  - **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`).
15
15
  - **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.
16
- - **MCP surface** at `/mcp` and a signed **export feed** for federation.
17
- - **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, and the Node Builder.
16
+ - **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 first). Search takes `region=`, `location_basis=` and `exclude_lineage=`.
17
+ - **MCP surface** at `/mcp` (including `find_locations`) and a signed **export feed** for federation.
18
+ - **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.
18
19
 
19
- Environment: `PORT`, `ONP_DB`, `ONP_REGISTRY_KEY`, `ONP_ADMIN_TOKEN`, `ONP_ALLOW_PRIVATE=1` (dev only: permit localhost nodes), `ONP_STAGE_C=0`, `ONP_REIMPORT=1`.
20
+ Environment: `PORT`, `ONP_DB`, `ONP_REGISTRY_KEY`, `ONP_ADMIN_TOKEN`, `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.
21
+
22
+ 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. Corrections and new countries are welcome by pull request: cite the provider's own page for `documented`, anything else is `claimed`.
20
23
 
21
24
  Part of [OpenNodes](https://opennodes.io) · [specification](https://github.com/opennodes-io/opennodes/tree/main/spec) · Apache-2.0.
package/bin.js CHANGED
@@ -15,6 +15,11 @@ const registry = await startRegistry({
15
15
  admitCooldownMs: Number(process.env.ONP_ADMIT_COOLDOWN_MS ?? 30 * 60_000), // Stage B per node
16
16
  trustProxy: process.env.ONP_TRUST_PROXY === '1', // behind Caddy / a CDN
17
17
  adminToken: process.env.ONP_ADMIN_TOKEN ?? null,
18
+ locationSeeds: process.env.ONP_LOCATION_SEEDS !== '0', // curated "where models run" seeds
19
+ // Basemap for the locations map: unset = OpenStreetMap, "off" = no map, else an XYZ tile URL template.
20
+ ...(process.env.ONP_MAP_TILES ? { mapTiles: process.env.ONP_MAP_TILES === 'off' ? null : {
21
+ tiles: process.env.ONP_MAP_TILES, attribution: process.env.ONP_MAP_ATTRIBUTION ?? '', max_zoom: 19,
22
+ } } : {}),
18
23
  stageC: process.env.ONP_STAGE_C === '0' ? null : {
19
24
  livenessIntervalMs: Number(process.env.ONP_LIVENESS_MS ?? 300_000),
20
25
  blindIntervalMs: Number(process.env.ONP_BLIND_MS ?? 3_600_000),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opennodes/registry",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
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.17",
46
+ "@opennodes/core": "0.1.18",
47
47
  "pg": "^8.13.1"
48
48
  }
49
49
  }
@@ -0,0 +1,208 @@
1
+ {
2
+ "seed": "ca",
3
+ "title": "Where AI models run in Canada",
4
+ "checked": "2026-11-02",
5
+ "note": "Curated by the OpenNodes project from public sources (ONP-2 §3a). documented = the provider's own dated page; claimed = provider statements or news reports. Corrections by pull request.",
6
+ "providers": [
7
+ {
8
+ "id": "aws-bedrock",
9
+ "name": "Amazon Bedrock (Canadian regions)",
10
+ "operator": { "name": "Amazon Web Services", "country": "US", "url": "https://docs.aws.amazon.com/bedrock/latest/userguide/models-region-compatibility.html" },
11
+ "note": "In-region processing only. Newer models (recent Claude, GPT, Grok, Nova, Kimi) reach the Canadian regions only through Geo or Global cross-region routing and are not listed.",
12
+ "sites": [
13
+ { "id": "mtl", "region": "CA-QC", "site": "Montréal (ca-central-1)", "status": "live", "basis": "documented", "source": "https://docs.aws.amazon.com/bedrock/latest/userguide/models-region-compatibility.html", "checked": "2026-11-02", "geo": { "lat": 45.5019, "lon": -73.5674, "precision": "city" } },
14
+ { "id": "yyc", "region": "CA-AB", "site": "Calgary (ca-west-1)", "status": "live", "basis": "documented", "source": "https://docs.aws.amazon.com/bedrock/latest/userguide/models-region-compatibility.html", "checked": "2026-11-02", "note": "No model is processed in-region here", "geo": { "lat": 51.0447, "lon": -114.0719, "precision": "city" } }
15
+ ],
16
+ "models": [
17
+ { "name": "Claude 3 Haiku", "family": "anthropic", "lineage_origins": ["US"], "sites": ["mtl"] },
18
+ { "name": "Llama 3 8B Instruct", "family": "meta", "lineage_origins": ["US"], "sites": ["mtl"] },
19
+ { "name": "Llama 3 70B Instruct", "family": "meta", "lineage_origins": ["US"], "sites": ["mtl"] },
20
+ { "name": "Mistral 7B Instruct", "family": "mistral", "lineage_origins": ["FR"], "sites": ["mtl"] },
21
+ { "name": "Mixtral 8x7B Instruct", "family": "mistral", "lineage_origins": ["FR"], "sites": ["mtl"] },
22
+ { "name": "Mistral Large", "family": "mistral", "lineage_origins": ["FR"], "sites": ["mtl"] },
23
+ { "name": "Cohere Embed English v3", "family": "cohere", "modality": "embedding", "lineage_origins": ["CA"], "sites": ["mtl"] },
24
+ { "name": "Cohere Embed Multilingual v3", "family": "cohere", "modality": "embedding", "lineage_origins": ["CA"], "sites": ["mtl"] },
25
+ { "name": "Cohere Rerank 3.5", "family": "cohere", "modality": "rerank", "lineage_origins": ["CA"], "sites": ["mtl"] },
26
+ { "name": "Amazon Rerank", "family": "amazon", "modality": "rerank", "lineage_origins": ["US"], "sites": ["mtl"] },
27
+ { "name": "Titan Text Embeddings V2", "family": "amazon", "modality": "embedding", "lineage_origins": ["US"], "sites": ["mtl"] },
28
+ { "name": "Titan Multimodal Embeddings G1", "family": "amazon", "modality": "embedding", "lineage_origins": ["US"], "sites": ["mtl"] }
29
+ ]
30
+ },
31
+ {
32
+ "id": "google-vertex",
33
+ "name": "Google Vertex AI (Montréal)",
34
+ "operator": { "name": "Google Cloud", "country": "US", "url": "https://cloud.google.com/vertex-ai/generative-ai/docs/learn/data-residency" },
35
+ "note": "Only Google models are processed in Canada; partner and open models on Vertex AI are not. Toronto (northamerica-northeast2) is not listed for generative AI.",
36
+ "sites": [
37
+ { "id": "mtl", "region": "CA-QC", "site": "Montréal (northamerica-northeast1)", "status": "live", "basis": "documented", "source": "https://cloud.google.com/vertex-ai/generative-ai/docs/learn/data-residency", "checked": "2026-11-02", "geo": { "lat": 45.5019, "lon": -73.5674, "precision": "city" } }
38
+ ],
39
+ "models": [
40
+ { "name": "Gemini 3.5 Flash", "family": "google", "modality": "multimodal", "lineage_origins": ["US"] },
41
+ { "name": "Gemini 2.5 Flash", "family": "google", "modality": "multimodal", "lineage_origins": ["US"] },
42
+ { "name": "Gemini 2.5 Pro", "family": "google", "modality": "multimodal", "lineage_origins": ["US"] },
43
+ { "name": "text-embedding-004", "family": "google", "modality": "embedding", "lineage_origins": ["US"] },
44
+ { "name": "text-multilingual-embedding-002", "family": "google", "modality": "embedding", "lineage_origins": ["US"] }
45
+ ]
46
+ },
47
+ {
48
+ "id": "azure-openai",
49
+ "name": "Azure OpenAI in Foundry (Canadian regions)",
50
+ "operator": { "name": "Microsoft", "country": "US", "url": "https://learn.microsoft.com/en-us/azure/ai-foundry/openai/concepts/models" },
51
+ "note": "OpenAI models only; no Canada data zone. Standard deployments in Canada East; the rest is provisioned (reserved) capacity. Region tables not re-checked on Microsoft's page, so claimed.",
52
+ "sites": [
53
+ { "id": "yqb", "region": "CA-QC", "site": "Québec City (Canada East)", "status": "live", "basis": "claimed", "source": "https://learn.microsoft.com/en-us/azure/ai-foundry/openai/concepts/models", "checked": "2026-11-02", "geo": { "lat": 46.8139, "lon": -71.208, "precision": "city" } },
54
+ { "id": "yyz", "region": "CA-ON", "site": "Toronto (Canada Central)", "status": "live", "basis": "claimed", "source": "https://learn.microsoft.com/en-us/azure/ai-foundry/openai/concepts/models", "checked": "2026-11-02", "geo": { "lat": 43.6532, "lon": -79.3832, "precision": "city" } }
55
+ ],
56
+ "models": [
57
+ { "name": "gpt-4o", "family": "openai", "modality": "multimodal", "lineage_origins": ["US"], "sites": ["yqb", "yyz"] },
58
+ { "name": "gpt-4o-mini", "family": "openai", "modality": "multimodal", "lineage_origins": ["US"], "sites": ["yqb", "yyz"] },
59
+ { "name": "gpt-4.1", "family": "openai", "lineage_origins": ["US"], "sites": ["yyz"] },
60
+ { "name": "gpt-4.1-mini", "family": "openai", "lineage_origins": ["US"], "sites": ["yqb"] },
61
+ { "name": "gpt-5", "family": "openai", "lineage_origins": ["US"], "sites": ["yqb"] },
62
+ { "name": "gpt-5-mini", "family": "openai", "lineage_origins": ["US"], "sites": ["yqb"] },
63
+ { "name": "gpt-5.1", "family": "openai", "lineage_origins": ["US"], "sites": ["yqb"] },
64
+ { "name": "gpt-5.2", "family": "openai", "lineage_origins": ["US"], "sites": ["yqb", "yyz"] },
65
+ { "name": "o3-mini", "family": "openai", "lineage_origins": ["US"], "sites": ["yqb"] },
66
+ { "name": "text-embedding-3-large", "family": "openai", "modality": "embedding", "lineage_origins": ["US"], "sites": ["yqb"] },
67
+ { "name": "text-embedding-3-small", "family": "openai", "modality": "embedding", "lineage_origins": ["US"], "sites": ["yqb"] },
68
+ { "name": "text-embedding-ada-002", "family": "openai", "modality": "embedding", "lineage_origins": ["US"], "sites": ["yqb"] }
69
+ ]
70
+ },
71
+ {
72
+ "id": "cohere",
73
+ "name": "Cohere",
74
+ "operator": { "name": "Cohere", "country": "CA", "url": "https://docs.cohere.com/docs/models" },
75
+ "note": "Cohere's hosted API runs in the US (Trust Center: no servers outside the US). Canadian serving needs Model Vault Canada, a partner such as Bell, or self-hosted weights.",
76
+ "sites": [
77
+ { "id": "us-central", "region": "US", "site": "Google Cloud US-Central (hosted API)", "status": "live", "basis": "documented", "source": "https://trustcenter.cohere.com", "checked": "2026-11-02", "geo": { "lat": 41.2619, "lon": -95.8608, "precision": "region" } },
78
+ { "id": "vault-ca", "region": "CA", "site": "Model Vault, Canadian region (not named)", "status": "live", "basis": "claimed", "note": "Secondary source, Sep 2026; models served there not published" }
79
+ ],
80
+ "models": [
81
+ { "name": "Command A+", "family": "cohere", "modality": "multimodal", "artifact": "hf:CohereLabs/command-a-plus-05-2026", "lineage_origins": ["CA"], "sites": ["us-central"] },
82
+ { "name": "Command A", "family": "cohere", "lineage_origins": ["CA"], "sites": ["us-central"] },
83
+ { "name": "Command A Reasoning", "family": "cohere", "lineage_origins": ["CA"], "sites": ["us-central"] },
84
+ { "name": "Command A Vision", "family": "cohere", "modality": "multimodal", "lineage_origins": ["CA"], "sites": ["us-central"] },
85
+ { "name": "Command A Translate", "family": "cohere", "lineage_origins": ["CA"], "sites": ["us-central"] },
86
+ { "name": "Command R7B", "family": "cohere", "lineage_origins": ["CA"], "sites": ["us-central"] },
87
+ { "name": "North Mini Code", "family": "cohere", "sites": ["us-central"] },
88
+ { "name": "Embed 4", "family": "cohere", "modality": "embedding", "lineage_origins": ["CA"], "sites": ["us-central"] },
89
+ { "name": "Rerank 3.5", "family": "cohere", "modality": "rerank", "lineage_origins": ["CA"], "sites": ["us-central"] }
90
+ ]
91
+ },
92
+ {
93
+ "id": "denvr-dataworks",
94
+ "name": "Denvr Dataworks",
95
+ "operator": { "name": "Denvr Dataworks", "country": "CA", "url": "https://www.denvr.com/ai-inference" },
96
+ "note": "Dedicated endpoints in Canadian and US data centres; the customer chooses the site, so each listing covers both countries.",
97
+ "sites": [
98
+ { "id": "ca", "region": "CA", "site": "Canadian data centres (not named)", "status": "live", "basis": "documented", "source": "https://www.denvr.com/ai-inference", "checked": "2026-11-02" },
99
+ { "id": "us", "region": "US", "site": "US data centres (not named)", "status": "live", "basis": "documented", "source": "https://www.denvr.com/ai-inference", "checked": "2026-11-02" }
100
+ ],
101
+ "models": [
102
+ { "name": "Llama 3.3 70B", "family": "meta", "lineage_origins": ["US"] },
103
+ { "name": "gpt-oss-120b", "family": "openai", "lineage_origins": ["US"] },
104
+ { "name": "Gemma 3", "family": "google", "lineage_origins": ["US"] },
105
+ { "name": "DeepSeek R1", "family": "deepseek", "lineage_origins": ["CN"] },
106
+ { "name": "Qwen3 Coder Next", "family": "qwen", "lineage_origins": ["CN"] }
107
+ ]
108
+ },
109
+ {
110
+ "id": "cerebras",
111
+ "name": "Cerebras Inference",
112
+ "operator": { "name": "Cerebras Systems", "country": "US", "url": "https://inference-docs.cerebras.ai/models/overview" },
113
+ "note": "Which site serves which model is not stated, so each listing covers both countries.",
114
+ "sites": [
115
+ { "id": "yul", "region": "CA-QC", "site": "Saint-Jérôme (MTL-3)", "status": "live", "basis": "claimed", "facility_operator": "Enovum / WhiteFiber", "note": "Operating since Oct 2025 (secondary sources)", "geo": { "lat": 45.7804, "lon": -74.0036, "precision": "city" } },
116
+ { "id": "us", "region": "US", "site": "US data centres", "status": "live", "basis": "claimed" }
117
+ ],
118
+ "models": [
119
+ { "name": "gpt-oss-120b", "family": "openai", "lineage_origins": ["US"] },
120
+ { "name": "Qwen 3.8 27B", "family": "qwen", "lineage_origins": ["CN"] }
121
+ ]
122
+ },
123
+ {
124
+ "id": "telus-sovereign-ai-factory",
125
+ "name": "TELUS Sovereign AI Factory",
126
+ "operator": { "name": "TELUS", "country": "CA", "url": "https://www.telus.com/business/medium-large/sovereign-ai-factory" },
127
+ "sites": [
128
+ { "id": "rimouski", "region": "CA-QC", "site": "Rimouski", "status": "live", "basis": "claimed", "source": "https://www.rcrwireless.com/20260512/carriers/telus-ai-data-centers", "checked": "2026-11-02", "note": "Live since Sep 2025; reported sold out (news report)", "geo": { "lat": 48.4489, "lon": -68.523, "precision": "city" } },
129
+ { "id": "kamloops", "region": "CA-BC", "site": "Kamloops", "status": "planned", "basis": "claimed", "source": "https://www.rcrwireless.com/20260512/carriers/telus-ai-data-centers", "checked": "2026-11-02", "note": "Expected later in 2026", "geo": { "lat": 50.6745, "lon": -120.3273, "precision": "city" } },
130
+ { "id": "vancouver", "region": "CA-BC", "site": "Vancouver", "status": "planned", "basis": "claimed", "source": "https://www.rcrwireless.com/20260512/carriers/telus-ai-data-centers", "checked": "2026-11-02", "note": "Expected end of 2026", "geo": { "lat": 49.2827, "lon": -123.1207, "precision": "city" } }
131
+ ],
132
+ "models": [],
133
+ "models_note": "Pay-per-token open models; TELUS has not published which models each site serves."
134
+ },
135
+ {
136
+ "id": "bell-ai-fabric",
137
+ "name": "Bell AI Fabric",
138
+ "operator": { "name": "Bell Canada", "country": "CA" },
139
+ "sites": [
140
+ { "id": "kamloops", "region": "CA-BC", "site": "Kamloops", "status": "live", "basis": "claimed", "facility_operator": "Groq", "source": "https://groq.com/blog/groq-becomes-exclusive-inference-provider-for-bell-canadas-sovereign-ai-network", "checked": "2026-11-02", "note": "Groq inference site", "geo": { "lat": 50.6745, "lon": -120.3273, "precision": "city" } },
141
+ { "id": "merritt", "region": "CA-BC", "site": "Merritt", "status": "planned", "basis": "claimed", "facility_operator": "BUZZ HPC, Hypertec", "note": "For Cohere; expected late 2026 to early 2027 (news report)", "geo": { "lat": 50.1113, "lon": -120.7862, "precision": "city" } }
142
+ ],
143
+ "models": [],
144
+ "models_note": "Kamloops models not disclosed. GroqCloud's public catalogue is not site-specific."
145
+ },
146
+ {
147
+ "id": "thinkon",
148
+ "name": "ThinkOn",
149
+ "operator": { "name": "ThinkOn", "country": "CA", "url": "https://thinkon.com" },
150
+ "sites": [
151
+ { "id": "ca", "region": "CA", "site": "Canadian data centres (not named)", "status": "live", "basis": "documented", "source": "https://thinkon.com/blogs/selected-to-power-canadas-sovereign-ai-platform/", "checked": "2026-11-02" }
152
+ ],
153
+ "models": [],
154
+ "models_note": "Hosts the federal GC AI Platform and CANChat; models not published."
155
+ },
156
+ {
157
+ "id": "oracle-oci",
158
+ "name": "Oracle OCI Generative AI (Canadian regions)",
159
+ "operator": { "name": "Oracle", "country": "US", "url": "https://docs.oracle.com/en-us/iaas/Content/generative-ai/regions-without-local-on-demand-model-hosting.htm" },
160
+ "sites": [
161
+ { "id": "yyz", "region": "CA-ON", "site": "Toronto", "status": "live", "basis": "documented", "source": "https://docs.oracle.com/en-us/iaas/Content/generative-ai/regions-without-local-on-demand-model-hosting.htm", "checked": "2026-11-02", "geo": { "lat": 43.6532, "lon": -79.3832, "precision": "city" } },
162
+ { "id": "yul", "region": "CA-QC", "site": "Montréal", "status": "live", "basis": "documented", "source": "https://docs.oracle.com/en-us/iaas/Content/generative-ai/regions-without-local-on-demand-model-hosting.htm", "checked": "2026-11-02", "geo": { "lat": 45.5019, "lon": -73.5674, "precision": "city" } }
163
+ ],
164
+ "models": [],
165
+ "models_note": "No local on-demand model hosting: requests from these regions are processed in other regions."
166
+ },
167
+ {
168
+ "id": "ovhcloud",
169
+ "name": "OVHcloud (Beauharnois)",
170
+ "operator": { "name": "OVHcloud", "country": "FR", "url": "https://help.ovhcloud.com/csm/en-public-cloud-ai-endpoints-capabilities?id=kb_article_view" },
171
+ "sites": [
172
+ { "id": "bhs", "region": "CA-QC", "site": "Beauharnois", "status": "live", "basis": "documented", "source": "https://help.ovhcloud.com/csm/en-public-cloud-ai-endpoints-capabilities?id=kb_article_view", "checked": "2026-11-02", "note": "General cloud region", "geo": { "lat": 45.3151, "lon": -73.8724, "precision": "city" } }
173
+ ],
174
+ "models": [],
175
+ "models_note": "No models served here: AI Endpoints runs in Gravelines, France."
176
+ },
177
+ {
178
+ "id": "isaic",
179
+ "name": "ISAIC (University of Alberta)",
180
+ "operator": { "name": "University of Alberta", "country": "CA", "url": "https://isaic.ca" },
181
+ "sites": [
182
+ { "id": "edmonton", "region": "CA-AB", "site": "Edmonton", "status": "live", "basis": "documented", "source": "https://isaic.ca", "checked": "2026-11-02", "geo": { "lat": 53.5461, "lon": -113.4938, "precision": "city" } }
183
+ ],
184
+ "models": [],
185
+ "models_note": "GPU rental (L40S, A100, H100); no hosted models."
186
+ },
187
+ {
188
+ "id": "coreweave-cambridge",
189
+ "name": "CoreWeave (Cambridge, Ontario)",
190
+ "operator": { "name": "CoreWeave", "country": "US" },
191
+ "sites": [
192
+ { "id": "cambridge", "region": "CA-ON", "site": "Cambridge", "status": "live", "basis": "claimed", "note": "Cohere is the anchor tenant (news report)", "geo": { "lat": 43.3616, "lon": -80.3144, "precision": "city" } }
193
+ ],
194
+ "models": [],
195
+ "models_note": "Private workloads; no public model API."
196
+ },
197
+ {
198
+ "id": "qscale",
199
+ "name": "QScale (Lévis)",
200
+ "operator": { "name": "QScale" },
201
+ "sites": [
202
+ { "id": "levis", "region": "CA-QC", "site": "Lévis", "status": "live", "basis": "claimed", "note": "Bought by Goldman Sachs Alternatives in May 2026 (news report)", "geo": { "lat": 46.8033, "lon": -71.1779, "precision": "city" } }
203
+ ],
204
+ "models": [],
205
+ "models_note": "Colocation only; no model service."
206
+ }
207
+ ]
208
+ }
package/src/importers.js CHANGED
@@ -406,3 +406,199 @@ export async function importOpenRouter(store, catalog) {
406
406
  if (err) return { providers: 0, offerings: 0, skipped: [err] };
407
407
  return { providers: 1, offerings: offeringList.length, skipped: [] };
408
408
  }
409
+
410
+ /* ------------------------------------------------------------------ locations (ONP-2 §3a) */
411
+
412
+ /** Save a listing-only card: like saveImportedCard, but without invocation endpoints. */
413
+ async function saveListingCard(store, nodeId, origin, sourceRef, card) {
414
+ const errors = validateCard(card)
415
+ .filter((e) => !/^\/endpoints must have required property '(openai|health)'$/.test(e));
416
+ if (errors.length) return errors[0];
417
+ await store.upsertNode(nodeId, origin, sourceRef, 'indexed', 'import');
418
+ await store.saveRevision(nodeId, card.revision, card, false);
419
+ return null;
420
+ }
421
+
422
+ export const OPENROUTER_PROVIDERS_URL = 'https://openrouter.ai/api/v1/providers';
423
+
424
+ /**
425
+ * Region segments seen in OpenRouter endpoint tags (`amazon-bedrock/eu-west-1`,
426
+ * `baseten/fp4/us`) -> ONP region codes. `global` means the provider may serve anywhere.
427
+ */
428
+ export const CLOUD_REGIONS = {
429
+ us: 'US', eu: 'EU', europe: 'EU', global: null,
430
+ 'us-east-1': 'US-VA', 'us-east-2': 'US-OH', 'us-west-2': 'US-OR', 'us-east5': 'US-OH', 'us-central1': 'US-IA',
431
+ 'eu-west-1': 'IE', 'eu-central-1': 'DE', swedencentral: 'SE',
432
+ 'ca-central-1': 'CA-QC', 'ca-west-1': 'CA-AB', canadacentral: 'CA-ON', canadaeast: 'CA-QC',
433
+ 'northamerica-northeast1': 'CA-QC', 'northamerica-northeast2': 'CA-ON',
434
+ };
435
+
436
+ /** Fetch every model's endpoint list (`links.details`), a few at a time. Returns Map(model id -> endpoints). */
437
+ export async function fetchOpenRouterEndpoints(getJson, models, concurrency = 4) {
438
+ const out = new Map();
439
+ const queue = [...models];
440
+ const worker = async () => {
441
+ for (let m = queue.shift(); m; m = queue.shift()) {
442
+ const path = m.links?.details ?? `/api/v1/models/${m.id}/endpoints`;
443
+ try { out.set(m.id, (await getJson(new URL(path, 'https://openrouter.ai').href))?.data?.endpoints ?? []); }
444
+ catch { out.set(m.id, []); } // a model can vanish between the two calls
445
+ }
446
+ };
447
+ await Promise.all(Array.from({ length: concurrency }, worker));
448
+ return out;
449
+ }
450
+
451
+ /**
452
+ * Import OpenRouter per provider, with the locations providers declare to OpenRouter:
453
+ * `headquarters` -> operator country, `datacenters` -> node locations, and a region segment
454
+ * in the endpoint tag -> that offering's location. All are `claimed`. Only endpoints with
455
+ * some location become offerings (listing-only, node `import.openrouter.p.{provider}`); the
456
+ * rest are counted as `unlocated`, which is the size of the gap.
457
+ */
458
+ export async function importOpenRouterProviders(store, providers, models, endpointsById, { checked = today() } = {}) {
459
+ const bySlug = new Map((providers ?? []).map((p) => [p.slug, p]));
460
+ const byName = new Map((providers ?? []).map((p) => [p.name, p]));
461
+ const groups = new Map(); // provider slug -> offerings[]
462
+ let unlocated = 0;
463
+
464
+ for (const model of models ?? []) {
465
+ const author = vendorSlug(model.id.split('/')[0] || 'unknown');
466
+ const inputs = model.architecture?.input_modalities ?? ['text'];
467
+ const outputs = model.architecture?.output_modalities ?? ['text'];
468
+ for (const ep of endpointsById.get(model.id) ?? []) {
469
+ const [tagSlug, ...rest] = String(ep.tag ?? '').split('/');
470
+ const provider = bySlug.get(tagSlug) ?? byName.get(ep.provider_name);
471
+ if (!provider) { unlocated++; continue; }
472
+ const regionSeg = rest.find((s) => s in CLOUD_REGIONS);
473
+ const declared = provider.datacenters ?? [];
474
+ if (regionSeg === 'global' || (!regionSeg && !declared.length)) { unlocated++; continue; }
475
+
476
+ const supports = ['streaming'];
477
+ const params = ep.supported_parameters ?? model.supported_parameters ?? [];
478
+ if (params.includes('tools')) supports.push('tool_calls');
479
+ if (params.includes('response_format') || params.includes('structured_outputs')) supports.push('json_mode');
480
+ if (inputs.includes('image') && outputs.includes('text')) supports.push('vision');
481
+ const offering = {
482
+ offering_id: slug([model.id.replace('/', '-'), ...rest].join('-')),
483
+ modality: mapModalities(inputs, outputs),
484
+ modalities: { input: inputs, output: outputs },
485
+ model: {
486
+ name: model.name ?? model.id,
487
+ family: author,
488
+ artifact: model.hugging_face_id
489
+ ? `hf:${model.hugging_face_id}`
490
+ : `urn:proprietary:${author}:${slug(model.id.split('/').slice(1).join('-') || model.id)}`,
491
+ ...(ep.quantization && ep.quantization !== 'unknown' ? { quantization: ep.quantization } : {}),
492
+ },
493
+ serving: {
494
+ supports,
495
+ ...(ep.context_length ? { context_window: Math.floor(ep.context_length) } : {}),
496
+ ...(ep.max_completion_tokens ? { max_output_tokens: Math.floor(ep.max_completion_tokens) } : {}),
497
+ },
498
+ binding: { profile: 'onp.openai.chat/v1', model_id: model.id },
499
+ pricing: {
500
+ currency: 'USD',
501
+ input_per_mtok: perMtok(ep.pricing?.prompt),
502
+ output_per_mtok: perMtok(ep.pricing?.completion),
503
+ schemes: ['prepaid'],
504
+ },
505
+ ...(regionSeg ? { locations: [{
506
+ region: CLOUD_REGIONS[regionSeg], basis: 'claimed', note: `OpenRouter endpoint tag ${ep.tag}`,
507
+ }] } : {}),
508
+ };
509
+ if (!groups.has(provider.slug)) groups.set(provider.slug, []);
510
+ const list = groups.get(provider.slug);
511
+ if (list.some((o) => o.offering_id === offering.offering_id)) offering.offering_id = slug(`${offering.offering_id}-${list.length}`);
512
+ list.push(offering);
513
+ }
514
+ }
515
+
516
+ let count = 0, offerings = 0;
517
+ const skipped = [];
518
+ for (const [providerSlug, offeringList] of groups) {
519
+ const p = bySlug.get(providerSlug);
520
+ const nodeId = `import.openrouter.p.${vendorSlug(providerSlug)}`;
521
+ const declared = (p.datacenters ?? []).filter((c) => /^[A-Z]{2}$/.test(c));
522
+ const card = {
523
+ onp: '0.1',
524
+ revision: new Date().toISOString(),
525
+ node: {
526
+ id: nodeId,
527
+ name: `${p.name} (via OpenRouter)`,
528
+ description: 'Imported from the OpenRouter provider and endpoint APIs. Locations are what the provider declares to OpenRouter (claimed). Listing only: call it through OpenRouter with provider routing.',
529
+ operator: { name: p.name, ...(/^[A-Z]{2}$/.test(p.headquarters ?? '') ? { country: p.headquarters } : {}) },
530
+ ...(declared.length ? {
531
+ regions: declared,
532
+ locations: declared.map((c) => ({ region: c, basis: 'claimed', source: OPENROUTER_PROVIDERS_URL, checked })),
533
+ } : {}),
534
+ },
535
+ endpoints: { docs: `https://openrouter.ai/provider/${encodeURIComponent(providerSlug)}` },
536
+ offerings: offeringList,
537
+ payment: { schemes: [{ scheme: 'prepaid', signup: 'https://openrouter.ai/keys' }] },
538
+ };
539
+ const err = await saveListingCard(store, nodeId, 'https://openrouter.ai', `import:openrouter-provider:${providerSlug}`, card);
540
+ if (err) { skipped.push(`${providerSlug}: ${err}`); continue; }
541
+ count++;
542
+ offerings += offeringList.length;
543
+ }
544
+ return { providers: count, offerings, unlocated, skipped };
545
+ }
546
+
547
+ /**
548
+ * Import a curated location seed (src/data/locations-*.json): providers, their sites with
549
+ * evidence, and the models each site serves. A provider with listed models becomes a
550
+ * listing-only node `import.seed.{seed}.{id}`; one without (models not published) stays
551
+ * site-only and is served by /v0/locations straight from the seed.
552
+ */
553
+ export async function importLocationSeed(store, seed) {
554
+ let providers = 0, offerings = 0, siteOnly = 0;
555
+ const skipped = [];
556
+ for (const p of seed?.providers ?? []) {
557
+ if (!p.models?.length) { siteOnly++; continue; }
558
+ const sites = new Map((p.sites ?? []).map((s) => [s.id, siteLocation(s)]));
559
+ const offeringList = p.models.map((m) => {
560
+ const family = vendorSlug(m.family ?? p.id);
561
+ return {
562
+ offering_id: slug(m.id ?? m.name),
563
+ modality: m.modality ?? 'text',
564
+ model: {
565
+ name: m.name,
566
+ family,
567
+ artifact: m.artifact ?? `urn:proprietary:${family}:${slug(m.id ?? m.name).replace(/\//g, '-')}`,
568
+ ...(m.lineage_origins ? { lineage_origins: m.lineage_origins } : {}),
569
+ },
570
+ serving: {},
571
+ binding: { profile: m.modality === 'embedding' ? 'onp.openai.embeddings/v1' : 'onp.openai.chat/v1', model_id: m.model_id ?? m.name },
572
+ pricing: { currency: 'USD', schemes: ['contract'] },
573
+ ...(m.sites ? { locations: m.sites.map((id) => sites.get(id)).filter(Boolean) } : {}),
574
+ };
575
+ });
576
+ const nodeId = `import.seed.${vendorSlug(seed.seed)}.${vendorSlug(p.id)}`;
577
+ const card = {
578
+ onp: '0.1',
579
+ revision: new Date().toISOString(),
580
+ node: {
581
+ id: nodeId,
582
+ name: p.name,
583
+ description: [p.note, seed.note].filter(Boolean).join(' ').slice(0, 4000),
584
+ operator: { name: p.operator?.name ?? p.name, ...(p.operator?.country ? { country: p.operator.country } : {}), ...(p.operator?.url ? { url: p.operator.url } : {}) },
585
+ locations: [...sites.values()],
586
+ },
587
+ endpoints: { ...(p.operator?.url ? { docs: p.operator.url } : {}) },
588
+ offerings: offeringList,
589
+ payment: { schemes: [{ scheme: 'contract' }] },
590
+ };
591
+ const err = await saveListingCard(store, nodeId, p.operator?.url ? new URL(p.operator.url).origin : 'https://opennodes.io', `import:seed:${seed.seed}:${p.id}`, card);
592
+ if (err) { skipped.push(`${p.id}: ${err}`); continue; }
593
+ providers++;
594
+ offerings += offeringList.length;
595
+ }
596
+ return { providers, offerings, site_only: siteOnly, skipped };
597
+ }
598
+
599
+ /** A seed site -> an ONP location (drops the seed-local `id`). */
600
+ export function siteLocation({ id, ...location }) {
601
+ return location;
602
+ }
603
+
604
+ const today = () => new Date().toISOString().slice(0, 10);
package/src/location.js CHANGED
@@ -1,4 +1,4 @@
1
- // Server-location checks (ONP-1 §6 threat 5, ONP-3 §6.5): where a node's API host actually is,
1
+ // Server-location checks (ONP-1 §6 threat 5, ONP-3 §6.4): where a node's API host actually is,
2
2
  // compared with the operator's declared country. Two signals, both evidence rather than proof:
3
3
  // (a) IP geolocation + network owner of the endpoint host (RIPE NCC RIPEstat, no key needed);
4
4
  // CDN / anycast networks are reported as such, never as a location.
@@ -10,7 +10,7 @@
10
10
  // (an auditor's credential) is the strong guarantee, planned for Draft 0.2.
11
11
  import net from 'node:net';
12
12
  import dns from 'node:dns/promises';
13
- import { EEA_COUNTRIES } from '@opennodes/core';
13
+ import { EEA_COUNTRIES, distanceKm } from '@opennodes/core';
14
14
  import { isPrivateHost } from './namespace.js';
15
15
 
16
16
  const RIPESTAT = 'https://stat.ripe.net/data';
@@ -25,12 +25,8 @@ export const CDN_ASNS = new Map([
25
25
 
26
26
  const EEA = new Set(EEA_COUNTRIES);
27
27
 
28
- export function haversineKm(a, b) {
29
- const rad = (d) => (d * Math.PI) / 180;
30
- const dLat = rad(b.lat - a.lat), dLon = rad(b.lon - a.lon);
31
- const h = Math.sin(dLat / 2) ** 2 + Math.cos(rad(a.lat)) * Math.cos(rad(b.lat)) * Math.sin(dLon / 2) ** 2;
32
- return 2 * 6371 * Math.asin(Math.sqrt(h));
33
- }
28
+ /** Great-circle distance in km; one implementation, shared with /v0/locations (core geo.js). */
29
+ export const haversineKm = distanceKm;
34
30
 
35
31
  /**
36
32
  * Judge measured RTTs against a claimed point. vantages: [{site, lat, lon, rtt_ms}].