Real variable with deflator or CPI?

Hi everyone,
For the measurement equation of inflation, most of article use real variable by dividing nominal value by the deflator of GDP.
However, real variables in my model are expressed in real terms with the CPI, can I use the CPI data to express nominal variable in real term (for example consumption, investment, wages) or this leads to misidentification?
More precisely, my model uses variety effect as in Bilbiie, Ghironi, Melitz (2005).
Best regards,

That depends on the model context. The basket of consumption goods is very different from the GDP basket (net exports, capital goods, government consumption). By using the CPI, you essentially abstract from those. In some contexts this may be desired.

Dear @jpfeifer,
Thanks for your reply.
Effectively, with investment and export in my model, this would be preferable to use GDP deflator and express my model in line with this (as in Lewis and Stevens (2015)).
Best,