Both work, they're all just sending digital versions of notes! You can find one for every perceivable amount of buttons you might need.
My hobby is electronic music, so I tilt towards grids over tiny pianos (though I own both). The smallest one I own is AKAI LPD8, which gives me 8 buttons, 8 knobs, and a couple of modifier keys for less than half the price of a Stream Deck.
It's not that Stream Deck is particularly expensive ($150), but I just can't justify it to myself when I'm aware of all the MIDI controller marvels you could get for like $100.
Some project in this space https://github.com/michd/mmpd