In this paper, we demonstrate an all-optical spin-exchange relaxation-free atomic magnetometer based on optical-fiber coupling, which simultaneously transmits orthogonally coupled pump and probe beam to an alkali vapor cell through a single polarization-maintaining fiber. The extinction ratios of the two pump–probe beams propagating along the fast- and slow-axis of the polarization-maintaining fiber were measured experimentally. To achieve the best sensitivity of the magnetometer, we theoretically analyze and experimentally optimize the triaxial magnetic compensation and optical parameters. Based on this scheme, it is proved that the compensation of the background magnetic field and the acquisition of three-axis magnetic field information can be achieved using only a pair of pump–probe beams. By optimizing the bias magnetic field Bx, Bz and optical parameters, we achieved bandwidths of 85 Hz, 42 Hz, and 48 Hz and magnetometer sensitivities of 18 fT/Hz1/2, 12 fT/Hz1/2, and 26 fT/Hz1/2 in the x-, y-, and z-axis, respectively. The proposed miniaturized configuration will be beneficial to developing magnetocardiography and magnetoencephalography instrumentation based on atomic magnetometers.