From the words of the “Midrash Rabba,” Parshat “Balak”: For the most part, Balaam has very little interest in his curses. He worked solely and only in exchange for money, and if the agreement assured him of a profit, he could curse anyone whom he formerly blessed and vice versa.
Balaam acts like a contemporary politician; he only does what is useful in a given moment, without any emotional involvement.
Comment: But nevertheless Balaam confronted the Creator; he could feel the “master of the house.”
Answer: Moses often confronted the Creator too. He struck the rock with a staff and asked to be taken and the people spared. Basically, he had many arguments with the Creator and so did Balaam. Both of them, both Moses and Balaam, had the possibility of turning toward the Creator with a call, with pleading, with a request, and even with a demand.