Class: Ace::Support::Models::CLI::Commands::ModelsSubcommands::Cost
- Inherits:
-
Cli::Command
- Object
- Cli::Command
- Ace::Support::Models::CLI::Commands::ModelsSubcommands::Cost
- Includes:
- Cli::Base
- Defined in:
- lib/ace/support/models/cli/commands/models/cost.rb
Overview
Show pricing for a model
Instance Method Summary collapse
Instance Method Details
#call(model_id:, **options) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ace/support/models/cli/commands/models/cost.rb', line 29 def call(model_id:, **) calculator = Molecules::CostCalculator.new result = calculator.calculate( model_id, input_tokens: [:input], output_tokens: [:output], reasoning_tokens: [:reasoning] ) if [:json] puts JSON.pretty_generate(result) else puts calculator.format(result) end rescue ProviderNotFoundError, ModelNotFoundError => e raise Ace::Support::Cli::Error.new(e.) rescue CacheError => e raise Ace::Support::Cli::Error.new(e.) end |