Files
olp/models-registry.json
T
5288493f19 feat: D81 — dashboard-data quota_v2 shape + models-registry schema_version (Phase 5) (#53)
Authority citations (required per CLAUDE.md § Hard requirements):
  1. ADR 0012 D81 — the D-day being implemented (Phase 5 charter, audit-query
     + dashboard-data extension row in § D-day table)
  2. ADR 0013 Rule 5 — schema_version in models-registry.json mandate. D80
     used a local constant QUOTA_SCHEMA_VERSION = '2026-05-26' (reviewer nit
     #4 at PR #52). D81 folds in Rule 5 compliance: adds quota_probe.schema_version
     to models-registry.json and has anthropic.mjs read from there with the
     constant as fallback via _resolveSchemaVersion().
  3. ADR 0008 — the audit-query design being amended (Amendment 1 added at D81
     to docs/adr/0008-dashboard-and-audit-query.md documenting: quota_probe in
     registry, aggregateProviderQuota() API shape, quota_v2 key, deprecation
     timeline for legacy quota key).
  4. D80 PR #52 (commit 82d2e1c) — producer of the quotaStatus() shape that
     D81 normalizes. The 13-field anthropic-ratelimit-unified-* shape from
     _parseRateLimitHeaders() is consumed by _normalizeAnthropicQuota() here.

Changes (A–G per D81 spec):

A. models-registry.json — new top-level quota_probe key
   - quota_probe.schema_version = '2026-05-26'
   - quota_probe.anthropic.{ source, endpoint, fields_pinned[13] }
   - fields_pinned is load-bearing for drift detection (ADR 0013 Rule 5)

B. lib/providers/anthropic.mjs — _resolveSchemaVersion() helper
   - Reads quota_probe.schema_version from modelsRegistryRaw at call time
   - Falls back to QUOTA_SCHEMA_VERSION constant if registry field absent
   - quotaStatus() now uses _resolveSchemaVersion() instead of raw constant

C. lib/audit-query.mjs — aggregateProviderQuota() export
   - Normalizes per-provider quotaStatus() returns to ProviderQuotaEntry shape
   - Live → { status:'live', utilization, reset, representative_claim, … }
   - Stale → { status:'stale', … }
   - null return → { status:'unavailable', reason:'no public quota api or probe disabled' }
   - throw → { status:'unavailable', reason:<error.message> }
   - getQuotaStatus injection point for full test isolation (D81 §F)

D. server.mjs handleManagementDashboardData — quota_v2 added
   - Calls auditAggregateProviderQuota({ providers: loadedProviders })
   - Both legacy quota (backwards compat) and quota_v2 in response
   - Graceful degradation: quota_v2 failure → warn log + empty array, rest of
     payload unaffected

E. server.mjs handleManagementQuota — quota_v2 added (mirrors D)

F. test-features.mjs — Suite 37 (7 new tests)
   - 37a: live shape normalization (status=live, utilization, reset, etc.)
   - 37b: stale shape (status=stale)
   - 37c: null returns → unavailable entries
   - 37d: throw path → unavailable with reason
   - 37e: mixed providers (live + unavailable)
   - 37f: getQuotaStatus injection verified
   - 37g: models-registry.json has quota_probe.schema_version + 13 fields_pinned

G. docs/adr/0008-dashboard-and-audit-query.md — Amendment 1 added

Test delta: 720 → 727 (+7), 0 failures.

Live quota_v2 JSON sample (illustrative — probe is opt-in per ADR 0013 Rule 4;
real values require quota_probe_enabled:true + valid OAuth credentials):

  GET /v0/management/dashboard-data (owner-only)
  {
    "quota_v2": [
      {
        "provider": "anthropic",
        "status": "live",
        "schema_version": "2026-05-26",
        "last_fresh_at": 1748300000000,
        "utilization": { "5h": 0.49, "7d": 0.31 },
        "reset": { "5h": 1748290000, "7d": 1748500000, "overall": 1748300000, "overage": null },
        "representative_claim": "five_hour",
        "fallback_percentage": 0.5,
        "overage": { "status": "rejected", "disabled_reason": "org_level_disabled_until" },
        "raw_available": true
      },
      {
        "provider": "openai",
        "status": "unavailable",
        "reason": "no public quota api or probe disabled",
        "schema_version": null,
        "last_fresh_at": null,
        "utilization": null,
        "reset": null,
        "representative_claim": null,
        "fallback_percentage": null,
        "overage": null,
        "raw_available": false
      }
    ]
  }

When probe is disabled (default), anthropic entry also returns unavailable:
  { "provider": "anthropic", "status": "unavailable",
    "reason": "no public quota api or probe disabled", ... }

NOT modified: dashboard.html (D82), codex.mjs, mistral.mjs, any quotaStatus()
return shape from anthropic.mjs (D80 contract unchanged — normalization is in
the new audit-query layer only).

Co-authored-by: dtzp555 <dtzp555@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 17:06:41 +10:00

185 lines
7.2 KiB
JSON

{
"version": "0.1.0-bootstrap",
"comment": "OLP models registry — SPOT for (provider, model) → metadata per CLAUDE.md release_kit overlay. v0.1 founding shipped zero Enabled Providers per ALIGNMENT.md § Provider Inventory. D4 populates providers.anthropic as Candidate; D5 transitions to Enabled pending E2E audit. Schema validated by .github/workflows/alignment.yml; provider keys must match ALIGNMENT.md inventory.",
"quota_probe": {
"schema_version": "2026-05-26",
"comment": "D81 — ADR 0013 Rule 5 mandate: schema_version pinned in registry so downstream consumers can detect schema drift. fields_pinned is load-bearing: if Anthropic adds/renames a header, dashboard consumers comparing field-presence against this list can flag 'schema drift detected'. Last verified: 2026-05-26 via live probe against api.anthropic.com (Path B per ADR 0013 Rule 5).",
"anthropic": {
"source": "anthropic-ratelimit-unified-headers",
"endpoint": "https://api.anthropic.com/v1/messages",
"fields_pinned": [
"status",
"representative_claim",
"reset",
"fallback_percentage",
"status_5h",
"utilization_5h",
"reset_5h",
"status_7d",
"utilization_7d",
"reset_7d",
"overage_status",
"overage_disabled_reason",
"overage_reset"
]
}
},
"bootstrapCreated": 1778630400,
"bootstrapCreatedComment": "Fallback Unix timestamp for models whose precise release date is unknown. Value = 2026-05-13 (the day before the Anthropic billing-split announcement that triggered OLP). Used by handleModels() in server.mjs when a model entry does not have a model-level 'created' field. Per F12 round-5 cold-audit: OpenAI spec treats 'created' as a stable per-model attribute; synthesizing Date.now() on each request causes spurious updates for clients caching models by 'created'.",
"providers": {
"anthropic": {
"displayName": "Anthropic Claude",
"tier": "D",
"candidate": true,
"models": [
{
"id": "claude-opus-4-7",
"displayName": "Claude Opus 4.7",
"contextWindow": 200000,
"deprecated": false,
"created": 1782864000
},
{
"id": "claude-sonnet-4-6",
"displayName": "Claude Sonnet 4.6",
"contextWindow": 200000,
"deprecated": false,
"created": 1775001600
},
{
"id": "claude-haiku-4-5",
"displayName": "Claude Haiku 4.5",
"contextWindow": 200000,
"deprecated": false,
"created": 1769904000
}
],
"aliases": {
"claude": "claude-sonnet-4-6",
"sonnet": "claude-sonnet-4-6",
"opus": "claude-opus-4-7",
"haiku": "claude-haiku-4-5"
}
},
"openai": {
"displayName": "OpenAI Codex",
"tier": "D",
"candidate": true,
"comment": "Model IDs sourced from canonical Codex models doc (https://developers.openai.com/codex/models, retrieved 2026-05-23). Each id is documented as a `codex -m <id>` example on that page. D7 E2E will probe each one.",
"models": [
{
"id": "gpt-5.5",
"displayName": "GPT-5.5",
"contextWindow": null,
"deprecated": false,
"note": "Frontier recommended model. Docs example: `codex -m gpt-5.5`.",
"created": 1778630400
},
{
"id": "gpt-5.4",
"displayName": "GPT-5.4",
"contextWindow": null,
"deprecated": false,
"note": "Docs example: `codex -m gpt-5.4`.",
"created": 1778630400
},
{
"id": "gpt-5.4-mini",
"displayName": "GPT-5.4 Mini",
"contextWindow": null,
"deprecated": false,
"note": "Lower-cost gpt-5.4 variant. Docs example: `codex -m gpt-5.4-mini`.",
"created": 1778630400
},
{
"id": "gpt-5.3-codex",
"displayName": "GPT-5.3-Codex",
"contextWindow": null,
"deprecated": false,
"note": "Docs example: `codex -m gpt-5.3-codex`. Distinct from the -spark variant.",
"created": 1778630400
},
{
"id": "gpt-5.3-codex-spark",
"displayName": "GPT-5.3-Codex Spark",
"contextWindow": null,
"deprecated": false,
"note": "Research preview. Docs example: `codex -m gpt-5.3-codex-spark`.",
"created": 1778630400
}
],
"aliases": {
"codex": "gpt-5.3-codex",
"codex-spark": "gpt-5.3-codex-spark",
"gpt5": "gpt-5.5",
"gpt5-mini": "gpt-5.4-mini"
}
},
"mistral": {
"displayName": "Mistral Vibe",
"tier": "D",
"candidate": true,
"comment": "Model IDs sourced from canonical Mistral models registry (https://docs.mistral.ai/getting-started/models/models_overview, retrieved 2026-05-23). Each id is the date-stamped canonical form Mistral's own model registry uses. The short forms (devstral-2, devstral-small-2) are aliases used in Vibe's config.toml TOML examples and are exposed as user-facing aliases below. Both models have 262144-token context window per the canonical registry + DOCS-5 launch announcement.",
"models": [
{
"id": "devstral-2-25-12",
"displayName": "Devstral 2",
"contextWindow": 262144,
"deprecated": false,
"note": "123B-parameter dense transformer. DOCS-5: $0.40/$2.00 per million tokens (input/output). Canonical date-stamped id; Vibe config.toml accepts the short form 'devstral-2' as an alias.",
"created": 1764547200
},
{
"id": "devstral-small-2-25-12",
"displayName": "Devstral Small 2",
"contextWindow": 262144,
"deprecated": false,
"note": "24B-parameter model, runs on consumer-grade GPUs. DOCS-5: $0.10/$0.30 per million tokens (input/output). Canonical date-stamped id; Vibe config.toml accepts the short form 'devstral-small-2' as an alias.",
"created": 1764547200
}
],
"aliases": {
"devstral": "devstral-2-25-12",
"devstral-2": "devstral-2-25-12",
"devstral-small": "devstral-small-2-25-12",
"devstral-small-2": "devstral-small-2-25-12"
}
},
"grok": {
"displayName": "xAI Grok",
"tier": "C",
"candidate": true,
"models": [],
"comment": "anticipated Phase 8+; no canonical models pinned yet"
},
"kimi": {
"displayName": "Moonshot Kimi",
"tier": "C",
"candidate": true,
"models": [],
"comment": "anticipated Phase 8+; no canonical models pinned yet"
},
"minimax": {
"displayName": "MiniMax",
"tier": "B",
"candidate": true,
"models": [],
"comment": "anticipated Phase 8+; no canonical models pinned yet"
},
"glm": {
"displayName": "Zhipu GLM",
"tier": "B",
"candidate": true,
"models": [],
"comment": "anticipated Phase 8+; no canonical models pinned yet"
},
"qwen": {
"displayName": "Alibaba Qwen",
"tier": "B",
"candidate": true,
"models": [],
"comment": "anticipated Phase 8+; no canonical models pinned yet"
}
}
}