To be exact, OKC had $2,056,512 of cap space (assuming reported salaries are accurate).
They could give that amount to Perk this year, bringing his base salary this year to $6,696,720. He would be eligible for annual raises of $703,155.60.
So, total contract value could look like this:
Year 0: $2,056,512 raise
Year 1: $7,399,875.60
Year 2: $8,103,031.20
Year 3: $8,806,186.80
Year 4: $9,509,342.40
--------------------------
Total: $33,818,436 + $2,056,512 raise = $35,874,948
So, the extension should be a max of 4 years, $35.87 million