Added option to pass an API key during setup

Also fixed getAPIKey from crashing if callback is not a function.