OpenAI is in talks to raise up to $40 billion in a funding round that would lift the artificial intelligence company’s valuation to as high as $340 billion, CNBC has confirmed.