Skip to content

feat(model-prices): support non-token billing metadata for image and video models - #520

Open
mazongYY wants to merge 1 commit into
seakee:devfrom
mazongYY:feat/model-price-media-billing
Open

feat(model-prices): support non-token billing metadata for image and video models#520
mazongYY wants to merge 1 commit into
seakee:devfrom
mazongYY:feat/model-price-media-billing

Conversation

@mazongYY

Copy link
Copy Markdown

Summary

Adds optional billing metadata (billingUnit / billingRate) to stored model prices so media models can record official non-token pricing while token cost stays at 0.

Targeted xAI media models:

  • grok-imagine-image: $0.02/image
  • grok-imagine-video: $0.05/s (480p), $0.07/s (720p)

Changes

  • model.ModelPrice and repository SQL persist billing_unit / billing_rate, including sync upsert and manual replace paths.
  • SQLite table creation and column-preservation migration include the two nullable columns; existing installs migrate in place.
  • The web editor exposes Billing unit and Billing rate inputs; price rows display the billing rate when present.
  • i18n keys added for en, zh-CN, zh-TW, and ru.
  • Tests cover repository round-trip, legacy migration preserving zero-base prices with no billing metadata, and draft round-trip / blank-metadata omission.

Validation

  • go test ./internal/repository/sqlite/...
  • go test ./internal/repository/modelprice/...
  • go test ./internal/service/modelprice/...
  • go test ./internal/model/...
  • go build ./...
  • npm run type-check
  • npm run lint
  • npx vitest run src/features/monitoring/model/modelPricesPageModel.test.ts
  • git diff --check

Fixes #519

@mazongYY
mazongYY force-pushed the feat/model-price-media-billing branch from cb7eef7 to 3c26e6a Compare August 16, 2026 15:01
@mazongYY

Copy link
Copy Markdown
Author

Hi maintainers 👋 — this PR has been rebased onto the latest dev (cdc97ce), so it should apply cleanly.

Local validation on the rebased head (3c26e6a):

  • go test ./internal/repository/sqlite/...
  • go test ./internal/repository/modelprice/... ✅ (incl. new billing-metadata round-trip)
  • go test ./internal/service/modelprice/... ./internal/model/...
  • go build ./...
  • npm run type-check ✅ / npm run lint (0 errors) ✅
  • vitest run src/features/monitoring/model/modelPricesPageModel.test.ts (12/12) ✅

Note: the PR Check workflow shows action_required — as this is a fork PR, the checks need a maintainer approval to run. Could you approve the workflow run and, if everything looks good, merge this? It closes #519. Thanks!

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