Skip to content

feat: auto-sync models & prices, provider quick setup, menu bar model picker - #94

Merged
sylearn merged 1 commit into
mainfrom
feat/model-sync-provider-presets
Nov 14, 2026
Merged

sylearn merged 1 commit into
mainfrom
feat/model-sync-provider-presets

Conversation

@sylearn

@sylearn sylearn commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Summary

Model & price auto-sync

  • Background coordinator keeps API providers and Claude / Codex / OpenCode nodes up to date every 6 hours. Settings has a toggle, "Sync All Now" and the last sync time; every node card gets a right-click "Update Models & Prices".
  • New models use a per-node baseline of seen upstream models: only newly listed models are added, models the user removed are never re-added, nothing is deleted. A background first sync only records the baseline; an explicit sync on a Claude / Codex node merges the full list, like the editor's sync button.
  • Prices: blanks are filled and models.dev-sourced prices follow models.dev; manual and explicitly free prices are never overwritten. Nodes linked to an API provider prefer the provider's own default price.
  • Claude / Codex catalogs are updated without restarting the node runtime. Each sync fetches first, then re-reads the latest config before writing, so concurrent edits are not overwritten.
  • The models.dev catalog (~6 MB, 9k models) is parsed and indexed off the main thread, cached, and evicted after expiry. Matching is a dictionary lookup instead of a full scan per model.

Editors

  • One "Fetch Models & Prices" action replaces fetch → match public prices → preview → apply. New, empty lists with ≤ 60 upstream models are added in one click; larger catalogs keep the picker, which now shows public prices inline.
  • Performance: the Claude / Codex price table filtered all rows once per row (O(n²) per keystroke); provider and OpenCode model rows are now lazy; string fingerprints replaced with Equatable change detection.
  • Fixed: prices ≥ 1000 rendered as 1,250 and were read back as 0.

Provider quick setup & sponsor

  • "Quick Setup" card when creating API providers and Claude / Codex / OpenCode nodes: pick a provider, the Base URL is filled for the chosen interface, paste the key, fetch models and prices.
  • First preset: API Models (verified: OpenAI Chat, Responses and Anthropic Messages all route on https://api-models.com). Marked as sponsored with a disclosure. Logo is bundled, not hot-linked.
  • Subtle sidebar sponsor spot above the version number; hideable from its context menu or Settings → About. Links carry the referral code plus utm_campaign per placement.

Menu bar

  • Account Quota and Cost & Usage sections are collapsible (remembered), with a one-line summary when collapsed.
  • Track panels gain a model picker: hot-swap for Codex / OpenCode global proxies, per-route (Default / Opus / Sonnet / Haiku) overrides for Claude Code, default model for per-node mode.

Test plan

  • Debug app build on Xcode 26 / Swift 6.4: all 30 changed Swift files compile with no new warnings.
  • models.dev data shape and the API Models endpoints verified against live services.
  • Referral link format verified.
  • CI "Contribution validation" (regression scripts). Locally, run_codex_reset_cards_regression.sh cannot find the SwiftUI macro plugin for @State in the untouched CodexResetCreditsView.swift; this is a local toolchain issue.
  • Manual UI pass: Quick Setup card, sidebar sponsor spot, collapsible menu bar sections and model picker, right-click sync banner.

🤖 Generated with Claude Code

… picker

Model & price sync
- Background coordinator syncs API providers and Claude / Codex / OpenCode
  nodes every 6 hours (Settings toggle, "Sync All Now", per-node right-click
  "Update Models & Prices").
- New models: a per-node baseline of seen upstream models; only newly listed
  models are added, removed models are never re-added, nothing is deleted.
  Background first sync only records the baseline.
- Prices: fill blanks and refresh models.dev-sourced prices; manual and
  explicitly free prices are never overwritten. Linked nodes prefer the
  provider's own default price.
- Claude / Codex catalogs update without restarting the node runtime;
  fetch-then-reread avoids overwriting concurrent edits.
- models.dev catalog is parsed and indexed off the main thread, cached and
  evicted after expiry; matching is a dictionary lookup.

Editors
- "Fetch Models & Prices" replaces fetch -> match -> preview -> apply.
- Price table: O(n) filtering per render, cheaper change detection, follows
  external price writes, locale-independent number format.
- Lazy model rows in provider and OpenCode editors.

Provider presets & sponsor
- Quick Setup card when creating providers / nodes: pick a provider, the
  Base URL is filled per interface, paste the key, fetch models.
- First preset: API Models (sponsored, disclosed). Bundled logo; referral
  links carry aff + utm campaign.
- Subtle sidebar sponsor spot above the version, hideable from its context
  menu or Settings.

Menu bar
- Account Quota and Cost & Usage sections are collapsible with summaries.
- Track panels gain a model picker: hot-swap for global proxies, per-route
  overrides for Claude Code, default model for per-node mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sylearn
sylearn merged commit 435bfbd into main Nov 14, 2026
2 checks passed
@sylearn
sylearn deleted the feat/model-sync-provider-presets branch November 14, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant