As soon as you get the H1B, you can transfer it to other companies. But suggested to work at least two pay term.
Consider if you can grow at the company and see if the company is willing to support the green card. If yes, then stay. Else I would look for companies who can support the green card.