In order to guarantee the QoS requirement of secondary users and not to affect the outage probability of primary user in cognitive relay networks, the authors propose two optimal power allocation models: maximizing the transmission rate of secondary users; minimizing the total power consumption. Theory analysis shows that two optimal power allocation models conflict between spectrum efficiency and power consumption. Furthermore, an optimal power allocation model which joints the transmission rate and the total power consumption in cognitive relay networks is proposed. By using the Lagrangian method, the optimization algorithm for this model is designed. The proposed algorithm can achieve the trade-off between the transmission rate and the total power consumption by varying the weight.