I know that modern historians consider Octavian to be the first emperor but he was a princep of Rome and the Roman republic still existed for some time after that but with a de-facto emperor. So my question is when did Rome become a legal official empire where they actually called themselves “Imperator” or “Emperor”
The Roman Empire never had a constitution or a different sort of defining document that determined what kind of governmental system it had, so there is no real way to say that Empire became a 'real' or 'official' Empire at any one point. It is better to think in terms of changes over a long period of time.
The title of Imperator was used during the Republic for a magistrate who had imperium, which was the authority to command troops. The title was given to Augustus once he assumed absolute power (edit: he may very well have had the title earlier than 27 BCE, which was when Octavian was granted the name Augustus), and it then became restricted mostly to the emperors, although they could grant the title to others if they wished. So from the very beginning, the emperors had that title. But as you are aware, the early emperors portrayed their rule in terms of saving the res publica from crisis; as protecting the Republic from those who wanted to bring chaos. This meant the emperors allowed the public face of the Republic to continue even though they ruled absolutely, ie. new emperors were granted their powers by the Senate, but in reality, the Senate had no ability to refuse to grant those powers.
This changed after the Empire suffered a major series of crises in the third century. The Empire nearly collapsed during this period and was only saved by a series of strong soldier-emperors from the area of Illyria. These emperors ruled in a much stronger and more forceful manner and did away with the Republican pretense of the early Empire, preferring to strengthen their legitimacy by clearly showing themselves as absolute rulers. For example, some emperors would summon their soldiers, rather than the Senate, to make declarations. Some historians do not like the use of such titles, but this period became known as the Dominate, while the early imperial period is known as the Principate.