Repository navigation
feat(#71): token math per model - #72
Merged
Merged
Conversation
…imates Add optional model_weights array to subscriptions to enable per-model token math. Implement schema changes, validator rules, and build logic to compute estimates_by_model. For Z.AI GLM plans, populate weights for GLM-5.3 (6.9/1.7/24) and GLM-5.3-Flash (2.3/0.56/8) from https://docs.z.ai/devpack/overview. Build computes per-model estimates showing Flash yields 3x more tokens/month at 1/3 the cost per token. - Schema: Add model_weights[], default_model, estimates_by_model to subscriptions - Validator: Enforce that every weight's model is in models_included - Build: Compute estimates_by_model using STANDARD profile and per-model credit conversions - Tests: Verify GLM-5.3 estimate matches top-level; Flash yields more tokens at lower cost - API: Worker does not yet serve subscription data (skipped per #71 scope) Co-authored-by: Colonizer Settlers <331648616+colonizer-settlers@users.noreply.github.com>
ParallelEntrepreneur
added a commit
that referenced
this pull request
Oct 10, 2026
…hness stamping Resolve conflicts from rebasing #73 onto origin/main (#72 merge). Integrated freshness stamping (annotate) into the build process while preserving USD conversions, per-model estimates, and CSV exports. Added argument validation for --as-of and unknown arguments. Co-authored-by: Colonizer Settlers <331648616+colonizer-settlers@users.noreply.github.com>
ParallelEntrepreneur
added a commit
that referenced
this pull request
Oct 17, 2026
…e staleness check (#18) (#73) * feat(data): freshness SLAs, stale flags in the build and a Worker-side staleness check (#18) Refs #18 Co-Authored-By: Colonizer Settlers <331648616+colonizer-settlers@users.noreply.github.com> * fix: rebase conflict resolution - merge build USD/estimates with freshness stamping Resolve conflicts from rebasing #73 onto origin/main (#72 merge). Integrated freshness stamping (annotate) into the build process while preserving USD conversions, per-model estimates, and CSV exports. Added argument validation for --as-of and unknown arguments. Co-authored-by: Colonizer Settlers <331648616+colonizer-settlers@users.noreply.github.com> --------- Co-authored-by: Colonizer Settlers <331648616+colonizer-settlers@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements GitHub issue #71: Token math per model. Adds optional
model_weightsarray to subscription records for plans whose quota costs depend on the model (e.g., GLM-5.3 vs GLM-5.3-Flash).model_weights[],default_model, andestimates_by_modelto subscriptionsmodels_includedTechnical Details
Z.AI GLM-5.3-Flash multipliers (published)
Fetched from https://docs.z.ai/devpack/overview:
Per-model estimates for zai/lite:
Build logic: For each model with weights, computes credits_per_call = ((input_tokens - cached) × input_multiplier + cached × cached_multiplier + output × output_multiplier) / 10000, then runs estimateForPlan with that conversion factor.
Skipped
API: The tokker-worker does not yet serve subscription data, so the new fields are not exposed via API at this time (per #71 scope).
Closes #71
🤖 Generated with Claude Code