Full-potential linearized augmented plane-wave method with the generalized gradient approximation for the exchange-correlation potential has been applied for the comparative study of structural, elastic, and electronic properties of the synthesized non-oxide anti-perovskites: superconducting $\mathrm{Cd}\mathrm{C}{\mathrm{Ni}}_{3}$ and magnetic $\mathrm{In}\mathrm{C}{\mathrm{Ni}}_{3}$. The optimized lattice parameters, independent elastic constants (${C}_{11}$, ${C}_{12}$, and ${C}_{44}$), bulk modules $B$, compressibility $\ensuremath{\beta}$, shear modules $G$, and tetragonal shear modules ${G}^{\ensuremath{'}}$ are evaluated. The numerical estimates of the elastic parameters of the polycrystalline $\mathrm{In}\mathrm{C}{\mathrm{Ni}}_{3}$ and $\mathrm{Cd}\mathrm{C}{\mathrm{Ni}}_{3}$ ceramics are performed. The band structures, total and site-projected $l$-decomposed densities of states, the shapes of the Fermi surfaces, the Sommerfeld coefficients, and the molar Pauli paramagnetic susceptibility for these anti-perovskites are obtained and analyzed in comparison with the available theoretical and experimental data. From our calculations, the stoichiometric $\mathrm{Cd}\mathrm{C}{\mathrm{Ni}}_{3}$ and $\mathrm{In}\mathrm{C}{\mathrm{N}}_{3}$ are very much alike in both structural and elastic properties but differ in electronic properties. For $\mathrm{In}\mathrm{C}{\mathrm{Ni}}_{3}$, the defect-induced magnetism associated with the indium vacancies or Ni atoms substituting for In was found.