The Cincinnati Reds have agreed to a two-year, $26 million deal with right-hander Nick Martinez, according to sources.

The pact includes an opt-out after the first season.

Martinez, 33, opted out of the final two years of his contract with the San Diego Padres. He pitched 54 games out of the bullpen but thrived over nine starts, posting a 2.32 ERA in 42 2/3 innings.

The contract will pay Martinez $14 million next season and $12 million in 2025 if he opts into the second year.