diff --git a/enterprise/app/jobs/captain/conversation/response_builder_job.rb b/enterprise/app/jobs/captain/conversation/response_builder_job.rb index 7978ae947..2a29e2e57 100644 --- a/enterprise/app/jobs/captain/conversation/response_builder_job.rb +++ b/enterprise/app/jobs/captain/conversation/response_builder_job.rb @@ -77,6 +77,10 @@ class Captain::Conversation::ResponseBuilderJob < ApplicationJob create_messages Rails.logger.info("[CAPTAIN][ResponseBuilderJob] Incrementing response usage for #{account.id}") account.increment_response_usage + # Granular usage reporting. Only assistant + copilot responses are logged for now; + # the other increment_response_usage call sites (task services, audio transcription) + # map to usage_types that are intentionally not recorded yet. + Captain::Usage.log(account: account, assistant: @assistant, usage_type: :assistant_response) end end end diff --git a/enterprise/app/services/captain/copilot/chat_service.rb b/enterprise/app/services/captain/copilot/chat_service.rb index b5b1b08f6..99e4c4c0f 100644 --- a/enterprise/app/services/captain/copilot/chat_service.rb +++ b/enterprise/app/services/captain/copilot/chat_service.rb @@ -29,6 +29,10 @@ class Captain::Copilot::ChatService < Llm::BaseAiService "#{self.class.name} Assistant: #{@assistant.id}, Incrementing response usage for account #{@account.id}" ) @account.increment_response_usage + # Granular usage reporting. Only assistant + copilot responses are logged for now; + # the other increment_response_usage call sites (task services, audio transcription) + # map to usage_types that are intentionally not recorded yet. + Captain::Usage.log(account: @account, assistant: @assistant, usage_type: :copilot_response) response end