Replicate Nextcloud's CODE AI integration on OnlyOffice or LibreOffice

In Nextcloud, you can use AI features via LocalAI, something that is not well supported in natively run office suites outside of one-off, bare-minimum plugins. How can I replicate this functionality in either OnlyOffice or LibreOffice?