During the Battle of Onderon, Kalani was sent by Count Dooku to aid Separatist puppet King Sanjay Rash of Onderon in defeating the resistance movement against the Separatist occupation. However, after continued resistance, Kalani and Dooku came to the conclusion that the fighting on Onderon was not worth the time and resources required for the Confederacy to remain on the planet, and as such, Dooku ordered Kalani and his army to abandon the planet and relocate to Agamar. As he left, Kalani killed Sanjay Rash, ending his former ally's life as he tried to protest against the droid's departure and losing the support of the Separatist Alliance.
When the war came to an end, the Droid Army was given a shutdown command. However, Kalani correctly deduced that it was a Republic trick and prevented the shutdown command. For the next fifteen years, Kalani and his forces remained operational on the planet Agamar while the rest of the galaxy fell to the control and tyranny of the Galactic Empire. About two years before the Battle of Yavin, General Kalani and his forces captured the Lothal Rebels and former Captain Rex, who were in search of proton bombs. He challenged the Rebels to one last battle that would end the Clone Wars on his terms, with Zeb as the hostage they had to save.
When it looked like the Rebels had won, Kalani almost turned the table, only for Ezra to intervene and point out that this battle was irrelevant because "both" sides lost; the Empire was the only true winner of the war since Palpatine had played the two sides against each other. According to Ezra's reasoning, the shutdown order was meant to go out, the Droid Army was always meant to lose, and the clones were never meant to beat the droids, but their own Jedi commanders. Rex and Kalani were grieved by this, but the droid general could not deny Ezra's logic. Ezra asked Kalani why he fought in the war and the tactical droid concluded that the Separatists were fighting against the tyranny of the Republic. Ezra pointed out that the Republic had become the Empire, which was now openly tyrannical. In the end, Kalani agreed that they now shared a common enemy. Their base was then assaulted by Imperial forces who had been dispatched by Governor Pryce. Working together, Kalani and the Rebels conjured up a successful plan to escape the Imperials, and afterwards Kalani and his remaining Battle Droids went their separate ways from Rex, Jarrus, and Bridger, satisfied that the war was over with a victory for both the Republic and the Separatists. Despite having won the battle, Kalani also declined to join the Rebellion, as the droid calculated that they had a less than 1% chance of overthrowing the Empire. His fate is unknown after this.
- In the Rebels Recon featurette for "The Last Battle", Henry Gilroy, the Co-Executive Producer for the series, said that he thought in the near future Kalani would hire out his services as a military advisor to various groups such as the Hutt Clan - given that he doesn't think the nascent Rebellion has any realistic chance of defeating the Empire. Gilroy went on to say, however, that he thinks that the destruction of the Death Star at the Battle of Yavin (about two years after Kalani leaves Agamar) will change his mind, proving that the Empire isn't invincible and the rebellion has a real chance of winning.
- In Star Wars Rebels, Kalani received only a minor change compared to its design in Star Wars: The Clone Wars.
- Kalani was one of the only battle droids to resist the Shutdown command sent out to all Separatist units by Darth Vader at the end of the Clone Wars.