Make api host configurable

It's sometimes useful to be able to use some API endpoint other than the default. For instance someone (like me) might want to use a different endpoint to tunnel the requests via transparent proxy.

@mtchavez please review