Inter Milan have bolstered their squad with the signing of Croatia international Marcelo Brozovic.
The 21-year-old Ivory Coast international came through the ranks at City after originally starting out at Crystal Palace but found first-team opportunities limited at the Etihad Stadium.
Razak has spent time on loan at Portsmouth, Brighton, Charlton and most recently Russian outfit Anzhi Makhachkala, who signed him on a permanent deal in October.
But now the midfielder will be looking to make a more lasting impression on the Barclays Premier League as he links up with the Hammers, who face Swansea on Saturday as they look to move out of the relegation zone.
Razak is manager Sam Allardyce's fourth signing of the January transfer window after loan deals for Wolves defender Roger Johnson and Italy internationals Antonio Nocerino and Marco Borriello.