Price by time? Api? Calculations?

Sample time of use (TOU) cost calculator here, that works with exported Sense data:

You could write your own in whatever language you want. Would recommend export over the informal API, since the API only gives realtime data - you have to store and manage on your own.