Checkout https://github.com/rany2/edge-tts , which exposes it as a Python library and a CLI tool.