Optimal design of multisite randomized trials leverages sampling costs to optimize sampling ratios and ultimately identify more efficient and powerful designs. Past implementations of the optimal design framework have assumed that costs of sampling units are equal across treatment conditions. In this study, we developed a more flexible optimal design framework by introducing additional optimal design parameters that track sampling cost variation across levels and treatment conditions. The proposed framework can frequently suggest more powerful and efficient designs than those identified by conventional frameworks. Additionally, the more flexible framework allows researchers to place constraints for practical considerations. The proposed method has been implemented in the R package odr.