Repository navigation
fix: correct model lineup (live), remove legacy supported_models catalog, persist platform pricing - #259
Conversation
…n restart Addresses the stale model lineup (#257) and its backend root cause, plus a critical billing bug found along the way. Pricing (critical): the model_prices startup cleanup deleted the synthetic "platform" account rows on every boot (platform != a users row), silently reverting billing to the fallback $0.05/$0.20. Exclude "platform" and gate the one-time cleanup behind a schema_migrations marker so it never runs again. Backend: remove the legacy supported_models catalog -- the bare GET/POST/DELETE /v1/admin/models endpoints, the store CRUD + table (now DROP TABLE), the empty-registry fallbacks, the IsRetiredProviderModel filter, and the dead seedModelCatalog. The manifest-backed model_registry is the single source of truth. The SupportedModel struct stays as the in-memory shape derived from the registry. The registry admin path and PUT /v1/admin/pricing are untouched. Frontend/docs: the landing pricing table and earnings calculator now source the lineup live from /v1/models/catalog + /v1/pricing (static fallback = the two served models). Public read endpoints (/v1/models/catalog, /v1/pricing) get permissive CORS so the marketing site can read them cross-origin. README, console-ui and benchmark scripts updated to Gemma 4 26B + GPT-OSS 20B; README revenue split made consistent (100% during the public alpha). Refs #257, #256
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This PR removes a dead code function ( Trust Boundaries Touched
Threat Analysis
New Attack SurfaceNone. The deleted function was not called at startup (the diff comment confirms this) and contained only Open Findings ResolvedNone. SEC-027 (T-038), SEC-007/T-007/T-012/T-027 (weight hash enforcement), and all other open findings are unaffected.
🔐 Threat model: |
The README, landing pricing table / earnings calculator, and the console models comparison were showing the $0.05/$0.20 platform fallback. Set them to the intended ~50%-of-OpenRouter rates: - Gemma 4 26B: $0.03 in / $0.165 out (OpenRouter google/gemma-4-26b-a4b-it: $0.06/$0.33) - GPT-OSS 20B: $0.015 in / $0.07 out (OpenRouter openai/gpt-oss-20b: $0.03/$0.14) console baselinePricing now holds the real OpenRouter output rates (330000 / 140000 micro-USD) so the "50% lower" comparison reads correctly. Live platform pricing must still be set in the coordinator (PUT /v1/admin/pricing or the register-model workflow) to match these docs; values now persist across restarts after the model_prices cleanup fix.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed3729ec66
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if publicCORSPaths[r.URL.Path] { | ||
| w.Header().Set("Access-Control-Allow-Origin", "*") | ||
| w.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS") | ||
| w.Header().Set("Access-Control-Allow-Headers", "Content-Type") |
There was a problem hiding this comment.
Preserve credentialed CORS for pricing mutations
When a browser preflights DELETE /v1/pricing to revert a provider price, this branch is selected solely by path and returns Access-Control-Allow-Methods: GET, OPTIONS with no Authorization header or credentials support, even though the same path is also registered for authenticated pricing mutations. That preflight will be rejected before handleDeletePricing can run; gate the wildcard/public CORS behavior on the actual requested method (including Access-Control-Request-Method) or keep the credentialed CORS headers for non-GET pricing requests.
Useful? React with 👍 / 👎.
The price comparison shouldn't name OpenRouter as the baseline. - console models page: baseline label "OpenRouter" -> "typical APIs"; the per-card line now reads "X% cheaper vs typical APIs"; footnote reworded to "typical hosted-API list rates". - README pricing note: drop the OpenRouter naming and the OpenRouter slug-style references; keep our model ids (gemma-4-26b, gpt-oss-20b) and a generic "typical hosted-API list rates" framing. Model ids shown are already our ids everywhere -- the /v1/models and /v1/models/openrouter `id` field is our model id; the OpenRouter marketplace `slug` is a separate, optional field. Left the API-compatibility references (the /v1/models/openrouter feed docs + provider-schema code comments) intact since they describe a real integration, not a pricing claim.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb68641202
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| > **Public Alpha** -- Darkbloom is a decentralized private inference network for Apple Silicon. Currently in public alpha -- expect rough edges, breaking changes, and downtime. | ||
|
|
||
| AI compute today flows through three layers of markup — GPU manufacturers to hyperscalers to API providers to end users. Meanwhile, over 100 million Apple Silicon Macs sit idle most of each day with 64–512 GB of unified memory and up to 819 GB/s memory bandwidth, capable of running models with up to 500 billion parameters at interactive speeds. Darkbloom connects this idle capacity directly to demand. The core technical challenge is that the machine owner has root access and physical custody — they should not be able to see user prompts or model responses. We solve this by eliminating every software path through which inference data could be observed: the inference engine runs in-process (no subprocess, no local server, no IPC), debuggers are denied at the kernel level (PT_DENY_ATTACH), memory-reading APIs are blocked by Hardened Runtime, and these protections are provably immutable for the process lifetime because disabling SIP requires a reboot that terminates the process. A four-layer attestation architecture — Secure Enclave signatures, MDM-based independent verification, Apple Managed Device Attestation with Apple-signed certificate chains, and periodic challenge-response — verifies that each machine's security posture has not been tampered with. The result: the only remaining attack is physically probing memory chips soldered into the SoC package, the same residual threat model accepted by Apple's Private Cloud Compute for Siri and Apple Intelligence. The API is OpenAI-compatible. Operators keep 95% of revenue. | ||
| AI compute today flows through three layers of markup — GPU manufacturers to hyperscalers to API providers to end users. Meanwhile, over 100 million Apple Silicon Macs sit idle most of each day with 64–512 GB of unified memory and up to 819 GB/s memory bandwidth, capable of running models with up to 500 billion parameters at interactive speeds. Darkbloom connects this idle capacity directly to demand. The core technical challenge is that the machine owner has root access and physical custody — they should not be able to see user prompts or model responses. We solve this by eliminating every software path through which inference data could be observed: the inference engine runs in-process (no subprocess, no local server, no IPC), debuggers are denied at the kernel level (PT_DENY_ATTACH), memory-reading APIs are blocked by Hardened Runtime, and these protections are provably immutable for the process lifetime because disabling SIP requires a reboot that terminates the process. A four-layer attestation architecture — Secure Enclave signatures, MDM-based independent verification, Apple Managed Device Attestation with Apple-signed certificate chains, and periodic challenge-response — verifies that each machine's security posture has not been tampered with. The result: the only remaining attack is physically probing memory chips soldered into the SoC package, the same residual threat model accepted by Apple's Private Cloud Compute for Siri and Apple Intelligence. The API is OpenAI-compatible. During the public alpha, operators keep 100% of revenue (0% platform fee). |
There was a problem hiding this comment.
Set the alpha fee to 0% before advertising 100%
This newly changes the public-facing revenue-share claim to 0% platform fee, but the billing code still defaults to platformFeePercent = 5 in coordinator/payments/pricing.go:35, and normal completion settlement pays providers via ProviderPayoutWithPercent(totalCost, feePercent) with a nil/absent override falling back to that default. For ordinary consumers/providers without a per-account 0% override, the system will still retain 5%, so this copy can mislead operators unless the default fee (or guaranteed overrides) is updated at the same time.
Useful? React with 👍 / 👎.
| return {"&":"&","<":"<",">":">","\"":""","'":"'"}[c]; | ||
| }); | ||
| } | ||
| function usd(micro){ return "$" + (Number(micro || 0) / 1e6).toFixed(2); } |
There was a problem hiding this comment.
Preserve sub-cent precision in live pricing
When the live catalog fetch succeeds, this formatter overwrites the static pricing rows with only two decimal places. Current advertised/token prices include values like 15,000 and 165,000 micro-USD per 1M tokens ($0.015 and $0.165), so the loaded page will show rounded/truncated prices such as $0.01/$0.17 instead of the exact API prices. Use the same variable precision as the static rows or API *_usd fields so visitors do not see incorrect model pricing after the live refresh.
Useful? React with 👍 / 👎.
| } | ||
| function catalogActiveParamsGB(m, sizeGB) { | ||
| const text = `${m.id || ""} ${m.architecture || ""}`; | ||
| const active = text.match(/A(\d{1,3})B/i) || text.match(/(\d{1,3})B\s+active/i); |
There was a problem hiding this comment.
Parse decimal active-parameter counts
When the live catalog refresh sees an MoE architecture string with a decimal active count, such as 3.6B active for GPT-OSS, this regex does not match it and the calculator falls back to Math.round(sizeGB * 0.15). For a 12 GB GPT-OSS row that becomes 3 active GB instead of roughly 4, inflating the displayed decode speed and monthly earnings by about a third after the live refresh replaces the static fallback. Accept decimal active counts before falling back to the size-based estimate.
Useful? React with 👍 / 👎.
…nt prices, decimal active-params) Resolves the four P2 Codex findings on this PR. #2 (most important): the default platform fee was 5% (payments/pricing.go), so providers actually received 95% despite the README/landing advertising "100% during the public alpha". Set the alpha default to 0% so the code matches the copy; per-account overrides via PUT /v1/admin/users/platform-fee still apply. Updated the pricing tests. NOTE: the referral program pays out a share of the platform fee, so referral payouts are dormant while the default fee is 0. #1: /v1/pricing serves a public GET plus authenticated PUT/DELETE, but the new public-CORS rule matched by path only and returned GET-only, no-credentials headers for every method — which would reject a browser preflight for the authenticated pricing mutations. Gate the wildcard CORS on the effective GET method (preflight-aware via Access-Control-Request-Method) and add PUT to the credentialed Allow-Methods. Extended the CORS test. #3: the landing live price formatter and the earnings calculator's currency reformatter rounded to 2 decimals, showing $0.015 -> $0.01 and $0.165 -> $0.17. Allow up to 4 fraction digits so sub-cent model prices render exactly. #4: the earnings calculator's active-parameter estimate ignored decimal counts and only read id/architecture ("MoE"), under-counting GPT-OSS active params (3 vs ~3.6) and inflating projected earnings after the live refresh. Parse the model description and accept decimals (mirrored in the console earn page).
The platform fee now defaults to 0% (providers keep 100% during the alpha), so TestIntegration_ProviderPayoutSplit (asserted a non-zero fee) and TestIntegration_ReferralRewardDistribution (rewards are funded from the platform fee) failed in CI. Give each test's consumer an explicit 5% per-account fee override (CreateUser with PlatformFeePercent) so they exercise the payout-split and referral mechanics end-to-end regardless of the global default; compute the split expectation via the *WithPercent helpers.

Summary
Resolves the stale landing-page model lineup (#257), removes its backend root
cause (a duplicate legacy catalog), and fixes a critical billing bug found
along the way where platform pricing was wiped on every coordinator restart.
The real, served lineup today is Gemma 4 26B + GPT-OSS 20B (verified against
live
/v1/models/catalog). Everything now flows from the manifest-backedmodel_registryas the single source of truth.Architecture — before / after
Before — two overlapping catalogs (
supported_models, read by the bare adminCRUD and as a fallback hidden behind a token hack), plus a startup cleanup that
deleted platform pricing on every boot:
flowchart TD subgraph API["API surface"] ADM["GET / POST / DELETE<br/>/v1/admin/models"] MODELS["GET /v1/models"] CATALOG["GET /v1/models/catalog"] SYNC["SyncModelCatalog"] end ADM --> SUP[("supported_models<br/>legacy duplicate")] MODELS --> REG[("model_registry<br/>canonical")] CATALOG --> REG SYNC --> REG MODELS -. "fallback if registry empty" .-> SUP CATALOG -. fallback .-> SUP SYNC -. fallback .-> SUP SUP --> HACK["IsRetiredProviderModel()<br/>hides stale rows"] BOOT(["coordinator restart"]) -->|"startup DELETE: account_id NOT IN users"| MP[("model_prices")] MP -. "platform pricing wiped every boot" .-> FB["billing reverts to<br/>$0.05 / $0.20 fallback"]After —
model_registryis the single source of truth, the legacy catalog isgone, and the one-time
model_pricescleanup is run-once and preserves theplatformaccount:flowchart TD subgraph API["API surface"] REGADMIN["POST /v1/admin/models/register<br/>+ per-model actions"] MODELS["GET /v1/models"] CATALOG["GET /v1/models/catalog"] SYNC["SyncModelCatalog"] PRICING["PUT /v1/admin/pricing"] end REGADMIN --> REG[("model_registry<br/>single source of truth")] MODELS --> REG CATALOG --> REG SYNC --> REG PRICING --> MP[("model_prices")] BOOT(["coordinator restart"]) -->|"run-once cleanup, keeps platform"| MP MP --> KEEP["platform pricing persists"] REG --> FE["landing + console:<br/>live lineup (Gemma 4 26B, GPT-OSS 20B)"]1. Critical fix — platform pricing wiped on every restart
coordinator/store/postgres.goran this in its startup migration list on everyboot:
It was a one-time cleanup for legacy Solana-wallet-keyed rows, but platform
default pricing is stored under the synthetic
account_id = 'platform', which isnever a row in
users— so all per-model platform pricing was deleted on everyrestart, silently reverting billing (
consumer.go,provider.go) to the$0.05 / $0.20fallback. Models survived because they live in a different table(
model_registry).Fix:
'platform'system account from the cleanup.schema_migrationsmarkerso it runs once, not on every boot (defense against the next synthetic
account hitting the same trap).
Tests:
TestPostgresWalletPriceCleanupPreservesPlatformandTestPostgresWalletPriceCleanupRunsOnce(verified against a real Postgres;proven to fail on the old query and pass with the fix).
2. Backend — remove the legacy
supported_modelscatalogsupported_modelswas a duplicate ofmodel_registry, read only by the bareadmin CRUD and as an empty-registry fallback. It's what made the lineup look
"5-strong". Removed:
GET/POST/DELETE /v1/admin/models+ their handlers.SetSupportedModel/ListSupportedModels/DeleteSupportedModel(interface + memory + postgres) and the
supported_modelstable (nowDROP TABLE IF EXISTS).activeCatalogLookups,SyncModelCatalog,handleModelCatalog(now registry-only).model_catalog_filter.go(theIsRetiredProviderModeltoken hack) and thedead
seedModelCatalog.scripts/admin.sh models listto/v1/models/catalog.Untouched / intact: the manifest-backed registry path
(
POST /v1/admin/models/register,/v1/admin/models/{id}/...),PUT /v1/admin/pricing,/v1/models*, and thestore.SupportedModelstruct(now documented as the in-memory shape derived from the registry).
3. Frontend / docs — live lineup + stale removal
landing/index.html: the pricing table is now sourced live from/v1/models/catalog+/v1/pricing, with the two served models as a staticfallback. The API example uses
gemma-4-26b.landing/earn-calculator.js: model list now built live from the catalog(mirrors the already-live console earn page), with a corrected 2-model
fallback.
/v1/models/catalog,/v1/pricing) now return awildcard CORS origin (no credentials) so the marketing site can read them
cross-origin. Credentialed endpoints stay locked to the single configured
origin. Covered by
TestCORSPublicEndpointsAllowAnyOrigin.README.md: model table, example model id, and pricing table corrected to thetwo served models; the 95% vs 100% revenue-split contradiction resolved to
100% during the public alpha (consistent with the landing page and the 0%
platform fee default).
console-ui(models,api/stats,api-console,providers/setup) and thescripts/*.pybenchmark/load lists updated to the served lineup.Out of scope (intentionally not changed)
papers/dginf-private-inference.tex— published benchmark content, not productsurface.
scripts/mlx_lm_batch_bench.py— uses the real HuggingFace weights path for astandalone MLX tool, not a coordinator model id.
Testing
go build ./...,go vet ./...,gofmt -lclean.coordinatorapi+store(vs ephemeral Postgres) +cmdsuites pass.console-ui:npx eslint src/(0 errors) andnpm run buildpass.syntax-checked.
Deploy ordering
Ship the coordinator first — the landing page's live fetch only works in-browser
once the new CORS is deployed (until then it shows the correct static fallback).
Refs #257, #256
Need help on this PR? Tag
@codesmithwith what you need. Autofix is disabled.