Class: RubynCode::CLI::Commands::Cost

Inherits:
Base
  • Object
show all
Defined in:
lib/rubyn_code/cli/commands/cost.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

aliases, all_names, hidden?

Class Method Details

.command_nameObject



7
# File 'lib/rubyn_code/cli/commands/cost.rb', line 7

def self.command_name = '/cost'

.descriptionObject



8
# File 'lib/rubyn_code/cli/commands/cost.rb', line 8

def self.description = 'Show token usage and costs'

Instance Method Details

#execute(_args, ctx) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/rubyn_code/cli/commands/cost.rb', line 10

def execute(_args, ctx)
  ctx.renderer.cost_summary(
    session_cost: ctx.budget_enforcer.session_cost,
    daily_cost: ctx.budget_enforcer.daily_cost,
    tokens: {
      input: ctx.context_manager.total_input_tokens,
      output: ctx.context_manager.total_output_tokens
    }
  )
end