[api] Make autocast API constistant, closes #248554 [applied]