Livy himself was exquisitely aware of the dangers of too much candor extolling the virtues of republicanism but he managed it anyway - during his lifetime even Augustus had to bow to the popular preference for the ancient Republic and pretend that his government was not imperial. Understand, though, that this form of Republic was not a popularly-elected government.
For a fuller sense of Machiavelli's actual views on government it is also helpful to read his Florentine Histories. He was certainly no academic or dilettante, but a practical politician whose own theory was hardened by experience.
“The Prince” is perhaps best understood as a “resume” or “demo reel”. Machiavelli was a decent man personally, but he was a political functionary and lived for the “game” of politics. He had backed the losing side in a war, and had been exiled from Florence to his rural estate, which for him was a stultifying nightmare. In writing “The Prince” and “Discourses on Livy”, he was trying to show to the new power brokers in Florence that he understood the game of politics well, and could be of use to them. Unfortunately for him (or fortunately, perhaps) they did not take him up on his offer.