0
2

 Average Cost To Upgrade Average Cost Star Level Gems Used Success Rate Delicate Gems Flawless Gems 1 1 Delicate 0.65 1.538 0 2 1 Delicate 0.6 4.231 0 3 1 Delicate 0.55 9.51 0 4 4 Delicate 0.8 16.578 0 5 4 Delicate 0.75 26.38 0 6 4 Delicate 0.7 40.547 0 7 4 Flawless 0.85 45.216 4.705 8 4 Flawless 0.8 51.244 10.881 9 4 Flawless 0.7 73.206 21.259 10 4 Flawless 0.6 122.01 42.098 11 4 Flawless 0.55 221.835 83.814 12 4 Flawless 0.5 443.671 175.628 13 4 Flawless 0.45 985.936 399.173 14 4 Flawless 0.45 2190.97 895.939 15 4 Flawless 0.45 4868.82 1999.87

note that after level 3 it is cheapest to use 4 Gems each time you are upgrading.

I Chose to recommend using flawless gems at level 7 because the ratio of flawless to delicate is more consistent with drop rates, but feel free to change this slightly as needed. I would suggest saving up 2x as many as needed to upgrade an item to level 15 and then try because this is only an average, your results may vary.

Explanation:

The average upgrade cost per level = (the cost to upgrade to previous level + Gems used) / Success Rate

So if you use 1 delicate gem to upgrade to level 1 then the average cost to get to level 1 is:
1/.65 = 1.538 Delicate Gems

level 2 is:
(1.538+1)/.6 = 4.231 Delicate Gems

Starting at level 4 it gets a little more difficult, you must do the same thing then subtract level 1 cost * fail rate:
(9.51+4)/.8 ? (1.538*.2) = 16.578 Delicate Gems
This is to account for not losing the average amount invested on that level down each time you fail

You stop doing this after level 8. Delicate and Flawless Gems must be calculated separately.