While the size of the four-bar linkage is the basis of kinematic performance analysis in a beam pumping unit, there is still a lack of effective and direct measurement of it. Since the motor input power and the polished rod position are commonly used production data, a size identification algorithm of the four-bar linkage based on the motor input power and the polished rod position is proposed in this paper. Firstly, the kinematic model of a beam pumping unit, the speed model of a motor, the initial value, and the state space model are established. Secondly, a Cubature Kalman filter with nonlinear constraints is designed and the size identification algorithm is worked out. Lastly, the model and the size identification algorithm are validated based on the simulated and measured data, and the characteristics of identification with different measurement covariance are studied. The results demonstrate that both the model and the algorithm are feasible. The maximum relative error between the identified and the real size increases from 0.23% to 9.37% when the covariance increases from 10−6 to 10−1. With the measured covariance of the polished rod velocity, the maximum relative error is 7.09%. A comparison of several current identification methods demonstrates that the proposed algorithm is more accurate.