Selam. I need you to reply this question as if it doesn't contain a single mistake or unclarity in its description. If someone makes the intention of imagining the sentence < The almighty has a child> and he imagines that sentence as if he is seeing it in a book or letter. He imagines that sentence word by word. He doesn't imagine sounds or voices. He simply imagines that sentence. Level of sin? The only intention he has is imagining that sentence. < Yzeir is the son of God> Idols are intermediatery to God > In other words imagining those blasphemous sayings in the manner I described above.
Wa alaikumu As-Salamu wa Rahmatullahi wa Barakatuh.
What matters is your heart; as long as you don't believe in it, in shaa Allah it's fine.
I advice you to avoid such thoughts and make Dhikr (Subhanallah (Pure and Perfect is Allah, for He has no error whatsoever), Al-Hamdulilah (All praise is due to Allah, for all the blessings, such as the sight, the hearing and the mind, that He has given us), Allahu Akbar (Allah is the Greatest, and there's no one that can challenge Him in power, if all mankind and Jinn were to commit Kufr as much as the most mischievous of His slaves, that would not harm Him, and if all mankind and Jinn were to have Iman like that of the most righteous one of His slaves, that would not raise Him higher), and others)
Also read more Qur'an and make more voluntary deeds, for these in shaa Allah help strengthen your Iman, and remember:
Indeed, Allah is with the patient
Brother if you have any question you may ask, may Allah reward you with good
Brother, thoughts, and acknowledging them are two similar yet different things.
Let me elaborate,
A thought is what comes to the mind, in this case, the possible "Allah has a son" (Ma'adAllah), THIS is a thought, thoughts may be generated by Shaitan. This is something that came to your mind with or without reason, BUT, YOU didn't acknowledge and agree to it. When you ACKNOWLEDGE and BELIEVE this thought that just came to your mind, that is when you commit Shirk.
The human mind can with or without reason get any sort of thoughts, but getting thoughts and believing them are two different things. In Islam, having bad thoughts is not a sin as it is human nature to get random thoughts, BUT IF YOU BELIEVE ON THAT EVIL THOUGHT, It is then when you are sinful.
In this case
You did not acknowledge/admit/believe that Allah has a son, this thought came to your mind from Shaitan, simply ignore it and keep fearing Allah and seek Allah's refuge from such evil thoughts.
I don't know how to type Arabic but check Qur'an chapter 23 verse no. 97-98.
"My Lord! I seek refuge with You from the whisperings of the Shayatin (devils). And I seek refuge with You, My Lord! lest they should come near me." (Surah Al Mominun, Chapter 23, verse no. 97-98)
As brother, Qataada, mentioned in his answer, "what matters is your heart". Do you acknowledge and believe on such evil thoughts? If no, then you are not sinful.
And Allah knows the best.