Three token types, three prices. Input is what you sent, output is what came back, and cached input is what the provider had already seen and charges a fraction for. Most rough estimates treat all three as input, which on a long-running agent that re-sends the same context hundreds of times overstates the cost by an order of magnitude.
The arithmetic is tokens divided by a million, times the published price per million, summed across models, and rounded once at the end so a call made of several cheap parts is not rounded up three separate times.
Then the part that matters: against what you billed. Spend on its own cannot tell you whether the work paid for itself. A month where AI cost four hundred dollars is excellent or terrible depending entirely on a number that is not on your provider's dashboard.