The Bible is a collection of different types of literature. This is a fact.
Parables, allegory, didactic passages, prose, poetry, historical records, epistles, ancient biographies, apocalyptic literature, prophesies, and so on and so forth.
Whether or not we interpret something recorded in scripture as actually having happened depends on the context in which the author provides it. Obviously I do not think the events described in Jesus' parables took place, for they are parables, for example.
The event in question recorded in Numbers is not to be taken metaphorically or figuratively. It is recorded as an historical event which the author intends for his readers to view as something actually having taken place. I have good reasons to think it actually took place and therefore, I believe God actually caused a voice to come from the mouth of the donkey on which Balaam was riding. I believe God created the universe and all therein ex nihilo. Him causing a voice to come from a donkey would have been well within His power.