Skip to content

Conversation

@feitianbubu
Copy link
Contributor

@feitianbubu feitianbubu commented Jan 25, 2026

vidu视频使用返回的积分做为token计费

Summary by CodeRabbit

Release Notes

Bug Fixes

  • Fixed billing system accuracy by correcting model name identification in charge calculations, ensuring costs are properly attributed to the appropriate video generation model
  • Enhanced token usage reporting for task completions by ensuring completion and total token counts are properly calculated from applied credits, providing accurate consumption metrics

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 25, 2026

Walkthrough

Refactored model name sourcing for billing calculations in video tasks from task.Data unmarshaling to task.Properties.OriginModelName. Enhanced Vidu task result parsing to populate CompletionTokens and TotalTokens from credits upon successful task completion.

Changes

Cohort / File(s) Summary
Video Task Billing
controller/task_video.go
Changed model name retrieval from unmarshaled task.Data to task.Properties.OriginModelName when calculating billing for successful total tokens scenario
Vidu Task Result Parsing
relay/channel/task/vidu/adaptor.go
Added conditional population of CompletionTokens and TotalTokens from credits value when task state is "success"

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Hopping through properties, no more marshaling haste,
The model name finds its rightful place,
Tokens now flow from credits with grace,
Video tasks billing at a swifter pace! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: vidu use credits as total_tokens' accurately describes the main change: modifying vidu video billing to use credits as the total_tokens metric.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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