/ commands / cost / cost.ts
cost.ts
 1  import { formatTotalCost } from '../../cost-tracker.js'
 2  import { currentLimits } from '../../services/claudeAiLimits.js'
 3  import type { LocalCommandCall } from '../../types/command.js'
 4  import { isClaudeAISubscriber } from '../../utils/auth.js'
 5  
 6  export const call: LocalCommandCall = async () => {
 7    if (isClaudeAISubscriber()) {
 8      let value: string
 9  
10      if (currentLimits.isUsingOverage) {
11        value =
12          'You are currently using your overages to power your Claude Code usage. We will automatically switch you back to your subscription rate limits when they reset'
13      } else {
14        value =
15          'You are currently using your subscription to power your Claude Code usage'
16      }
17  
18      if (process.env.USER_TYPE === 'ant') {
19        value += `\n\n[ANT-ONLY] Showing cost anyway:\n ${formatTotalCost()}`
20      }
21      return { type: 'text', value }
22    }
23    return { type: 'text', value: formatTotalCost() }
24  }