The Gemara (Megilla 31b) says: "[In reading] the curses that are in Deuteronomy one may pause [it may be broken up into several aliyot]. Why? Those [that are in Leviticus, which must be read in one aliya] are said in the plural, Moses relaying them from mouth of the Almighty; and these [in Deuteronomy] are in the singular, said by Moses himself."
Rashi comments there: "Moses spoke them in the name of G-d and became a messenger to say," thus said the Holy One blessed be He", for they are worded (in first person singular): and I will give ... and I will place ... and I will send, referring to the One who has the power to act; but in Mishneh Torah it is written: The Lord will strike you... The Lord will afflict you, MOSES SPOKE THESE WORDS ON HIS OWN INITIATIVE - if you transgress His commandments He will punish you".
In contrast, Rashi comments on Sanhedrin 56b (ד"ה כאשר צוך) "Moshe did not teach his own ideas in the book of Devarim..rather he informed them What HE HAD RECEIVED FROM G-D".
On Deuteronomy 28:23 RASHI brings the above mentioned Gemara and the Sifsei chachomim there explains "These curses Moshe articulated himself, etc. Meaning that Moshe asked the Holy One for permission to curse them this way, and the Holy One granted him permission. This resolves the Gemara's statement (Sanhedrin 99a) that Moshe did not innovate even one letter [in the Torah] on his own i.e., without permission from the Holy One. And when Rashi explains that Moshe “articulated himself,” he means that he first asked the Holy One [for permission].
Tosefos in Chapter Bnei Ha'ir (Megilla 31b), [commenting on the Gemora there] write, “Moshe articulated himself, and through Divine Inspiration.”
My question is that in Rashi's comment to Megilla 31b it seems like he actually holds Moshe said the curses on his own accord in contrast to what he writes in Sanhedrin?