Just because he gets killed doesn't mean he isn't an anti-hero. And Walter White did the EXACT same thing to Jesse hat Alonzo did to Jake like hurting him just to save himself/money, but he's still an anti-hero.
It's been a while since I've seen it, but, Alonzo didn't even attempt to try and hide it like Walter did. He was the main antagonist to Jake. The devil, sitting on his shoulder, trying to break his moral compass and force (literally) him to abandon his principals: to bring him to the dark side. Unlike Walter, he wasn't written to try and pull the wool over people's eyes. The ending did a great job showcasing how nobody in the hood thought he was anything other than a crooked ass cop, taking advantage for personal gain. They dealt with him, because they had too. Nah, Alonzo was more akin to Hannibal trying to get Will Graham to bask in darkness, or Jake in Nightcrawler.
Edit: The more I think about it, the more ridiculous it is that Walter ever got the pass that he got. All he had to yell (lie) was, "I'm doing this for my family

" and people turned a blind eye. Dude was a virus to everyone in that show.
Dexter gave more of a fukk. lol.