Skip to main content
Glama

volt_get_savings

Compare actual compute spending against optimal routing to identify savings achieved and missed opportunities across AI inference providers.

Instructions

Compare actual spend against optimal routing. Shows savings achieved and savings missed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
time_rangeNoTime range for the report: today, 7d (7 days), or 30d (30 days)7d

Implementation Reference

  • The handleGetSavings function executes the logic for 'volt_get_savings', retrieving the savings report from the tracker and formatting it.
    export function handleGetSavings(input: GetSavingsInput, tracker: SpendTracker) {
      const report = tracker.getSavingsReport(input.time_range);
    
      if (report.actualSpend === 0) {
        return {
          content: [
            {
              type: 'text' as const,
              text: `No spend data for ${input.time_range}. Record inference calls to see savings opportunities.`,
            },
          ],
        };
      }
    
      return {
        content: [
          {
            type: 'text' as const,
            text: formatSavingsReport(report),
          },
        ],
      };
    }
  • The getSavingsSchema defines the input validation for 'volt_get_savings', specifically the 'time_range' parameter.
    export const getSavingsSchema = z.object({
      time_range: z
        .enum(['today', '7d', '30d'])
        .default('7d')
        .describe('Time range for the report: today, 7d (7 days), or 30d (30 days)'),
    });
  • The formatSavingsReport function is a helper used to construct the text-based savings report output.
    function formatSavingsReport(r: SavingsReport): string {
      const lines: string[] = [
        `Savings Report (${r.timeRange})`,
        '─'.repeat(60),
        `Actual spend:    $${r.actualSpend.toFixed(2)}`,
        `Optimal spend:   $${r.optimalSpend.toFixed(2)}`,
        `Potential savings: ${r.savingsPercent}%`,
        '',
        `Savings achieved (followed recommendations): $${r.savingsAchieved.toFixed(2)}`,
        `Savings missed (ignored recommendations):    $${r.savingsMissed.toFixed(2)}`,
      ];
    
      if (r.savingsMissed > 0) {
        lines.push(
          '',
          `You could save $${r.savingsMissed.toFixed(2)} by following Volt routing recommendations.`,
        );
      } else if (r.savingsPercent === 0) {
        lines.push('', 'You are already using the most cost-effective providers.');
      }
    
      return lines.join('\n');
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/newageflyfish-max/volthq'

If you have feedback or need assistance with the MCP directory API, please join our Discord server