Skip to content

feat: add Synthetic subscription usage provider - #33

Open
Kunde21 wants to merge 1 commit into
TopiCsarno:mainfrom
Kunde21:feat/synthetic-provider
Open

Kunde21 wants to merge 1 commit into
TopiCsarno:mainfrom
Kunde21:feat/synthetic-provider

Conversation

@Kunde21

@Kunde21 Kunde21 commented Sep 17, 2026

Copy link
Copy Markdown

What

Adds Synthetic — a flat subscription to open-source LLMs (Kimi-K3, GLM-5.2, Qwen3.6, …) behind OpenAI/Anthropic-compatible APIs — as a twelfth provider, following the existing API-key account pattern (Kimi/Minimax/Z.AI/OpenCode Go): managed API-key accounts, reauthentication, optional OpenCode auth.json prefill (provider id synthetic), and no host Active badge.

Usage source

GET https://api.synthetic.new/v2/quotas (free call, does not count against limits; documented at dev.synthetic.new). The response exposes:

  • rollingFiveHourLimit (remaining/max, nextTickAt) → the 5-hour request window; subscription serves as a fallback shape
  • weeklyTokenLimit (percentRemaining, $ maxCredits/remainingCredits, nextRegenAt) → the weekly credit window plus a remaining-credits display
  • search.hourly → a 1-hour search window; freeToolCalls is skipped when its limit is 0

Refill semantics

Synthetic quotas regenerate a partial amount on a fixed tick schedule (5h window: +5% every 15 min; weekly credits: +2% every 202 min) rather than resetting wholesale. Two display adaptations:

  • Window rows use refill wording ("Refills in 38m", "Refilled") instead of "Resets in", in both relative and absolute reset-time formats.
  • The meter omits the linear pace marker (it assumes a full reset) and its tooltip schedules the full-regeneration estimate on the tick grid: ticks needed = ceil(used / tick fraction), anchored on the next tick, so it counts down between ticks and drops one tick interval when a tick lands. Windows without a known tick schedule fall back to a linear estimate.

Notes for review

  • Config schema version bumps 600 → 700; new fields are #[serde(default)] so existing installations migrate cleanly.
  • Adds RegenerationTick to the model and regeneration_tick_for/refill_meter/full_regeneration_label in the display layer; tick parameters live in the provider module.
  • English + Polish localization, demo state, provider icons derived from Synthetic's favicon, README/CHANGELOG/AGENTS.md updates.
  • This branch does not include fix: keep multiple Codex accounts from overwriting each other #32; both touch src/config.rs/src/app/tests.rs in different regions and should rebase trivially if that merges first.

All 792 tests pass, cargo fmt and just check are clean.

Adds Synthetic (synthetic.new) as an API-key provider modeled on the
existing managed-key accounts. Quota fetches hit GET /v2/quotas and
normalize the regenerating five-hour request window, the weekly credit
window with a remaining-credits display, the hourly search window, and
a subscription fallback when the rolling window is absent.

Synthetic quotas refill a partial amount on a fixed tick schedule
instead of resetting wholesale, so its window rows use refill wording
("Refills in 38m") and the meter tooltip schedules the full-regeneration
estimate on the tick grid: the ticks needed to drain the used quota,
anchored on the next tick, counting down between ticks. The linear pace
marker is omitted for these windows since it assumes a full reset.

Includes multi-account management, optional OpenCode key prefill, demo
state, provider icons, and English/Polish localization. Bumps the
config schema version to 700 with defaults for existing installations.
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