I want to have a program I'm writing interact with the Internet exclusively through Tor. After perusing the Tor project's documentation it appears that they do not specify the API anywhere i.e. how a program can talk to Vidalia to access the Internet through Tor. This is much talk about proxies but I don't care about that approach. I don't want to have the option of using the Internet without Tor. I only want to use Tor. Where is the API? Thanks.
To have your program use the Internet through Tor, just teach it to use Tor as a SOCKS4a or a SOCKS5 proxy.
The Wikipedia page on SOCKS should have the information you need.
While nickm's answer of "Use SOCKS, that's what it's there for" is correct, I think you might be asking the wrong question. If you want to get information about other aspects of Tor, but don't want to perform queries, implement SOCKS, etc. yourself, you can always use one of the existing libraries. In Python, for instance, you can use Stem.
If you're wanting to control Tor yourself, you can read up on the control protocol.
I've marked this answer CW; if anyone knows other API's designed for interacting with Tor please list them below: