Forecast doesn’t currently have a public API. If you’re comfortable using an undocumented API, there are some third-party libraries available:

Please note that since the Forecast API is currently not publicly released or documented, we are unable to provide support for using it, and the API may change in a non-backwards compatible way at any time without notice.