This paper develops models aimed at more accurate estimation of the medical cost function based on the individual cost data. In our proposed models, the cost data are assumed to be dependent on the whole clinical evolution via Markov transition probabilities, and the accumulative rate of cost in a time period (sojourn) has a semiparametric structure. The medical costs are recurrent at different time points with different states under informative censoring, and the cost incurred in a sojourn at a state is correlated with that sojourn. A copula is used to model the relationship between a sojourn and its associated cost. The multivariate local likelihood method is employed to estimate model parameters and the asymptotic properties of the estimators are established as well. Our methods can be easily extended to model the total cost and to analyze the cost-effectiveness of the model. Simulations are performed to assess the proposed models and methodology, and comparisons with certain existing models are discussed.