Hi there,
Thanks for writing in! It depends on how instant WordPress sets up a local server. If you are able to access it via localhost in the web-browser, you can generate an API key using localhost, and it should work. We can’t guarantee it will work though depending on your setup. But that is they way it is done the usual way.
Hope this helps – thanks!