calculateStack (calculate.ts)

voice-cost · voice, pricing-calculator, cost-estimation, voice-pricing

Calculates pricing estimates for voice call stacks by summing platform, carrier, recording, STT, LLM, and TTS costs based on scenario configuration.

import {
  carriers,
  llmModels,
  platforms,
  type RealtimeScenario,
  realtimeModels,
  recordingOptions,
  type Scenario,
  sttModels,
  ttsModels,
} from "../data/pricing";

type StackBreakdown = {
  readonly platform: number;
  readonly models: number;
  readonly stt: number;
  readonly llm: number;
  readonly tts: number;
  readonly carrier: number;
  readonly recording: number;
};

export type StackEstimate = {
  readonly monthly: number;
  readonly perMinute: number;
  readonly perCall: number;
  readonly breakdown: StackBreakdown;
};

export class PricingConfigurationError extends Error {
  readonly field: string;
  readonly value: string;

  constructor(field: string, value: string) {
    super(`Unknown pricing configuration for ${field}: ${value}`);
    this.name = "PricingCon

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key