The new Karlsruhe Optimized and Precise Radiative transfer algorithm (KOPRA) is a line-by-line model for use in retrieval processors for atmospheric observations. It simulates IR spectra by taking into account physical properties of the atmospheric observations. It simulates IR spectra by taking into account physical properties of the atmosphere and of the instrument. Besides spectrum calculation, KOPRA has the capability to determine the derivatives of the spectrum with respect to many retrieval parameters. Comparisons between analytical and numerical derivatives, which are generally within a few percent, demonstrate that approximates due to run time optimized implementations are small. Furthermore, a flexible scheme is presented for handling various parameterizations of atmospheric profiles as implemented in the code in order to support different retrieval approaches.