-
Notifications
You must be signed in to change notification settings - Fork 433
feat(api-nodes): add pricing for seedream4.5 #7189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughUpdated ByteDanceSeedreamNode pricing logic to calculate price per image based on model variant selection. Pricing varies by model (0.04 for seedream-4-5-251128, 0.03 for others), with dynamic formatting for single and multi-image generation scenarios accounting for sequential mode and max_images configuration. Changes
Possibly related PRs✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 12/05/2025, 06:49:59 PM UTC 🔗 Links🎉 Your Storybook is ready for review! |
🎭 Playwright Test Results⏰ Completed at: 12/05/2025, 06:59:30 PM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
Bundle Size ReportSummary
Category Glance Per-category breakdownApp Entry Points — 3.2 MB (baseline 3.2 MB) • ⚪ 0 BMain entry bundles and manifests
Status: 3 added / 3 removed Graph Workspace — 975 kB (baseline 975 kB) • 🔴 +583 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 6.54 kB (baseline 6.54 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 1 added / 1 removed Panels & Settings — 298 kB (baseline 298 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 6 added / 6 removed UI Components — 173 kB (baseline 173 kB) • ⚪ 0 BReusable component library chunks
Status: 6 added / 6 removed Data & Services — 12.5 kB (baseline 12.5 kB) • ⚪ 0 BStores, services, APIs, and repositories
Status: 2 added / 2 removed Utilities & Hooks — 2.94 kB (baseline 2.94 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 1 added / 1 removed Vendor & Third-Party — 8.56 MB (baseline 8.56 MB) • ⚪ 0 BExternal libraries and shared vendor chunks
Other — 3.81 MB (baseline 3.81 MB) • ⚪ 0 BBundles that do not match a named category
Status: 17 added / 17 removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/composables/node/useNodePricing.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (14)
**/*.{vue,ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{vue,ts,tsx}: Leverage VueUse functions for performance-enhancing utilities
Use vue-i18n in Composition API for any string literals and place new translation entries in src/locales/en/main.json
Files:
src/composables/node/useNodePricing.ts
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursorrules)
Use es-toolkit for utility functions
Files:
src/composables/node/useNodePricing.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
Use TypeScript for type safety
**/*.{ts,tsx}: Never useanytype - use proper TypeScript types
Never useas anytype assertions - fix the underlying type issue
Files:
src/composables/node/useNodePricing.ts
**/*.{ts,tsx,js,vue}
📄 CodeRabbit inference engine (.cursorrules)
Implement proper error handling in components and services
**/*.{ts,tsx,js,vue}: Use 2-space indentation, single quotes, no semicolons, and maintain 80-character line width as configured in.prettierrc
Organize imports by sorting and grouping by plugin, and runpnpm formatbefore committing
Files:
src/composables/node/useNodePricing.ts
src/**/*.{vue,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{vue,ts}: Leverage VueUse functions for performance-enhancing styles
Implement proper error handling
Use vue-i18n in composition API for any string literals. Place new translation entries in src/locales/en/main.json
Files:
src/composables/node/useNodePricing.ts
src/**/*.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.ts: Use es-toolkit for utility functions
Use TypeScript for type safety
Files:
src/composables/node/useNodePricing.ts
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Use camelCase for variable and setting names in TypeScript/Vue files
Files:
src/composables/node/useNodePricing.ts
**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,vue}: Useconst settingStore = useSettingStore()andsettingStore.get('Comfy.SomeSetting')to retrieve settings in TypeScript/Vue files
Useawait settingStore.set('Comfy.SomeSetting', newValue)to update settings in TypeScript/Vue files
Check server capabilities usingapi.serverSupportsFeature('feature_name')before using enhanced features
Useapi.getServerFeature('config_name', defaultValue)to retrieve server feature configurationEnforce ESLint rules for Vue + TypeScript including: no floating promises, no unused imports, and i18n raw text restrictions in templates
Files:
src/composables/node/useNodePricing.ts
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Define dynamic setting defaults using runtime context with functions in settings configuration
UsedefaultsByInstallVersionproperty for gradual feature rollout based on version in settings configuration
Files:
src/composables/node/useNodePricing.ts
src/**/{services,composables}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (src/CLAUDE.md)
src/**/{services,composables}/**/*.{ts,tsx}: Useapi.apiURL()for backend endpoints instead of constructing URLs directly
Useapi.fileURL()for static file access instead of constructing URLs directly
Files:
src/composables/node/useNodePricing.ts
src/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
src/**/*.{ts,tsx,vue}: Sanitize HTML with DOMPurify to prevent XSS attacks
Avoid using @ts-expect-error; use proper TypeScript types instead
Use es-toolkit for utility functions instead of other utility libraries
Implement proper TypeScript types throughout the codebase
Files:
src/composables/node/useNodePricing.ts
src/**/{composables,components}/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Clean up subscriptions in state management to prevent memory leaks
Files:
src/composables/node/useNodePricing.ts
src/**/*.{vue,ts,tsx}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Follow Vue 3 composition API style guide
Files:
src/composables/node/useNodePricing.ts
src/**/{components,composables}/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Use vue-i18n for ALL user-facing strings by adding them to
src/locales/en/main.json
Files:
src/composables/node/useNodePricing.ts
🧬 Code graph analysis (1)
src/composables/node/useNodePricing.ts (1)
src/lib/litegraph/src/types/widgets.ts (1)
IComboWidget(128-136)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: deploy-and-comment
- GitHub Check: lint-and-format
- GitHub Check: setup
- GitHub Check: collect
- GitHub Check: test
🔇 Additional comments (3)
src/composables/node/useNodePricing.ts (3)
1771-1773: LGTM: Model widget retrieval follows established pattern.The modelWidget retrieval is consistent with other widget lookups in this file and properly typed.
1781-1787: Pricing logic correctly implements the 25% increase for seedream-4.5.The model-based pricing is implemented correctly, with seedream-4-5-251128 at $0.04 representing a 25% increase from the $0.03 baseline, matching the PR objectives.
1798-1805: Robust handling of max_images with proper validation.The code properly validates the max_images value with
Number.isFinite()and provides safe defaults. The pricing display for multiple images clearly shows both the total cost and per-image breakdown, which is excellent for user transparency.
| if (!sequentialGenerationWidget || !maxImagesWidget) { | ||
| return `$${pricePerImage}/Run ($${pricePerImage} for one output image)` | ||
| } | ||
|
|
||
| const maxImages = Number(maxImagesWidget.value) | ||
| const seqMode = String(sequentialGenerationWidget.value).toLowerCase() | ||
| if (seqMode === 'disabled') { | ||
| return `$${pricePerImage}/Run` | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Good defensive handling for missing widgets and disabled mode.
The code appropriately handles cases where widgets are missing or sequential generation is disabled, providing clear pricing information to users.
For consistency with line 1804, consider using .toFixed(2) when displaying prices:
if (!sequentialGenerationWidget || !maxImagesWidget) {
- return `$${pricePerImage}/Run ($${pricePerImage} for one output image)`
+ return `$${pricePerImage.toFixed(2)}/Run ($${pricePerImage.toFixed(2)} for one output image)`
}
const seqMode = String(sequentialGenerationWidget.value).toLowerCase()
if (seqMode === 'disabled') {
- return `$${pricePerImage}/Run`
+ return `$${pricePerImage.toFixed(2)}/Run`
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (!sequentialGenerationWidget || !maxImagesWidget) { | |
| return `$${pricePerImage}/Run ($${pricePerImage} for one output image)` | |
| } | |
| const maxImages = Number(maxImagesWidget.value) | |
| const seqMode = String(sequentialGenerationWidget.value).toLowerCase() | |
| if (seqMode === 'disabled') { | |
| return `$${pricePerImage}/Run` | |
| } | |
| if (!sequentialGenerationWidget || !maxImagesWidget) { | |
| return `$${pricePerImage.toFixed(2)}/Run ($${pricePerImage.toFixed(2)} for one output image)` | |
| } | |
| const seqMode = String(sequentialGenerationWidget.value).toLowerCase() | |
| if (seqMode === 'disabled') { | |
| return `$${pricePerImage.toFixed(2)}/Run` | |
| } |
🤖 Prompt for AI Agents
In src/composables/node/useNodePricing.ts around lines 1789 to 1796, the price
strings currently interpolate pricePerImage raw; update both return paths to
format the numeric price with two decimals for consistency (use
pricePerImage.toFixed(2) or Number(pricePerImage).toFixed(2) if pricePerImage
might be non-number) so the outputs become `$${formatted}/Run ($${formatted} for
one output image)` and `$${formatted}/Run`.
Summary
The same logic, with price increased by 25% compared to previous version of this model.
Screenshots (if applicable)
┆Issue is synchronized with this Notion page by Unito