My plugin is essentially a chat bot (albeit purely for entertainment) and serves as an example of doing it entirely within Discourse:
The advantage of creating it as a plugin is you have less infrastructure to maintain and you have less authentication to worry about.
Then again, if you are using a third party AI you are going to need to make a lot of external calls and manage those things anyway, so its 6 of one and half of the other …