The 21-year-old most recently played in the Russian Premier League with Anzhi Makhachkala.
He also spent time on loan at Portsmouth, Brighton, Charlton prior to his move to Russia.
Razak made his debut for City when he was 18, but found first-team opportunities limited with the arrival of higher-profile players.
At international level, Razak has been capped five times by Ivory Coast since making his senior debut in a 3-0 friendly win in Austria in November 2012.
"West Ham United are pleased to announce the signing of Ivory Coast international Abdul Razak on a short-term contract," a West Ham statement read.