@@ -6,6 +6,7 @@ import { Button } from '@/components/ui/button'
66import { CopyButton } from '@/components/ui/copy-button'
77import { ScrollArea } from '@/components/ui/scroll-area'
88import { Tooltip , TooltipContent , TooltipProvider , TooltipTrigger } from '@/components/ui/tooltip'
9+ import { BASE_EXECUTION_CHARGE } from '@/lib/billing/constants'
910import { redactApiKeys } from '@/lib/utils'
1011import { FrozenCanvasModal } from '@/app/workspace/[workspaceId]/logs/components/frozen-canvas/frozen-canvas-modal'
1112import LogMarkdownRenderer from '@/app/workspace/[workspaceId]/logs/components/sidebar/components/markdown-renderer'
@@ -254,14 +255,10 @@ export function Sidebar({
254255 } , [ log ] )
255256
256257 // Helper to determine if we have cost information to display
258+ // All workflow executions now have cost info (base charge + any model costs)
257259 const hasCostInfo = useMemo ( ( ) => {
258- return ! ! (
259- log ?. metadata ?. cost &&
260- ( ( log . metadata . cost . input && log . metadata . cost . input > 0 ) ||
261- ( log . metadata . cost . output && log . metadata . cost . output > 0 ) ||
262- ( log . metadata . cost . total && log . metadata . cost . total > 0 ) )
263- )
264- } , [ log ] )
260+ return isWorkflowExecutionLog && log ?. metadata ?. cost
261+ } , [ log , isWorkflowExecutionLog ] )
265262
266263 const isWorkflowWithCost = useMemo ( ( ) => {
267264 return isWorkflowExecutionLog && hasCostInfo
@@ -492,49 +489,6 @@ export function Sidebar({
492489 </ div >
493490 ) }
494491
495- { /* Enhanced Cost - only show for enhanced logs with actual cost data */ }
496- { log . metadata ?. enhanced && hasCostInfo && (
497- < div >
498- < h3 className = 'mb-1 font-medium text-muted-foreground text-xs' >
499- Cost Breakdown
500- </ h3 >
501- < div className = 'space-y-1 text-sm' >
502- { ( log . metadata ?. cost ?. total ?? 0 ) > 0 && (
503- < div className = 'flex justify-between' >
504- < span > Total Cost:</ span >
505- < span className = 'font-medium' >
506- ${ log . metadata ?. cost ?. total ?. toFixed ( 4 ) }
507- </ span >
508- </ div >
509- ) }
510- { ( log . metadata ?. cost ?. input ?? 0 ) > 0 && (
511- < div className = 'flex justify-between' >
512- < span > Input Cost:</ span >
513- < span className = 'text-muted-foreground' >
514- ${ log . metadata ?. cost ?. input ?. toFixed ( 4 ) }
515- </ span >
516- </ div >
517- ) }
518- { ( log . metadata ?. cost ?. output ?? 0 ) > 0 && (
519- < div className = 'flex justify-between' >
520- < span > Output Cost:</ span >
521- < span className = 'text-muted-foreground' >
522- ${ log . metadata ?. cost ?. output ?. toFixed ( 4 ) }
523- </ span >
524- </ div >
525- ) }
526- { ( log . metadata ?. cost ?. tokens ?. total ?? 0 ) > 0 && (
527- < div className = 'flex justify-between' >
528- < span > Total Tokens:</ span >
529- < span className = 'text-muted-foreground' >
530- { log . metadata ?. cost ?. tokens ?. total ?. toLocaleString ( ) }
531- </ span >
532- </ div >
533- ) }
534- </ div >
535- </ div >
536- ) }
537-
538492 { /* Frozen Canvas Button - only show for workflow execution logs with execution ID */ }
539493 { isWorkflowExecutionLog && log . executionId && (
540494 < div >
@@ -588,17 +542,23 @@ export function Sidebar({
588542 { /* Cost Information (moved to bottom) */ }
589543 { hasCostInfo && (
590544 < div >
591- < h3 className = 'mb-1 font-medium text-muted-foreground text-xs' > Models</ h3 >
545+ < h3 className = 'mb-1 font-medium text-muted-foreground text-xs' >
546+ Cost Breakdown
547+ </ h3 >
592548 < div className = 'overflow-hidden rounded-md border' >
593549 < div className = 'space-y-2 p-3' >
594550 < div className = 'flex items-center justify-between' >
595- < span className = 'text-muted-foreground text-sm' > Input:</ span >
551+ < span className = 'text-muted-foreground text-sm' > Base Execution:</ span >
552+ < span className = 'text-sm' > { formatCost ( BASE_EXECUTION_CHARGE ) } </ span >
553+ </ div >
554+ < div className = 'flex items-center justify-between' >
555+ < span className = 'text-muted-foreground text-sm' > Model Input:</ span >
596556 < span className = 'text-sm' >
597557 { formatCost ( log . metadata ?. cost ?. input || 0 ) }
598558 </ span >
599559 </ div >
600560 < div className = 'flex items-center justify-between' >
601- < span className = 'text-muted-foreground text-sm' > Output:</ span >
561+ < span className = 'text-muted-foreground text-sm' > Model Output:</ span >
602562 < span className = 'text-sm' >
603563 { formatCost ( log . metadata ?. cost ?. output || 0 ) }
604564 </ span >
@@ -677,8 +637,8 @@ export function Sidebar({
677637 { isWorkflowWithCost && (
678638 < div className = 'border-t bg-muted p-3 text-muted-foreground text-xs' >
679639 < p >
680- This is the total cost for all LLM-based blocks in this workflow
681- execution .
640+ Total cost includes a base execution charge of { ' ' }
641+ { formatCost ( BASE_EXECUTION_CHARGE ) } plus any model usage costs .
682642 </ p >
683643 </ div >
684644 ) }
0 commit comments