https://github.com/charmbracelet/vhs is a really good utility for automatically making these gifs.
svg-term --command 'cowsay hey there'
But that has the aforementioned issues about not pausing enough, so I usually just record with asciinema first and then invoke svg-term.