The API I am using to access the usage data from the Monowall firewall is intended for use on the web admin interface but can be used for anything. Unlike the rest of the interface that is written in PHP, this is written in C to make it more efficient.
The actual call is simple if you know about. Just type http://firewall.ip.address/stats.cgi?interface in to your browser replacing the interface with the WAN name from https://firewall.ip.address/interfaces_assign.php .
This will return 3 numbers. The first is the time of the request, second is the data downloaded, and the third is the data uploaded. You will need to use the last reading and the current one to calculate the actual throughput.