While artificial intelligence is likely to be a revolutionary technology, not all AI companies are created equal. Paying too high a price for an AI stock that shows a lot of promise can lead to poor results, even if the company does well in the long run.

One AI stock that looks like a great deal is cloud computing provider DigitalOcean (DOCN 3.30%). On the other hand, Cloudflare (NET 1.44%) stock appears far too expensive to take seriously, even though the company has plenty of AI potential.

Buy DigitalOcean

Until recently, cloud computing provider DigitalOcean was entirely absent from the AI computing market. Training advanced AI models requires AI accelerators like GPUs, and DigitalOcean's platform doesn't offer that option. The company purposely keeps its product catalog simple, resisting the urge to pile on services that make its platform harder to use.

This simplicity is DigitalOcean's biggest strength and one reason why the company is popular among developers and small businesses looking to avoid the hassle and complexity of a larger cloud platform. But the AI opportunity is too big for DigitalOcean to ignore, and by not offering AI services, the company risks losing customers to more fully featured platforms.

DigitalOcean is rectifying this situation with the acquisition of AI start-up Paperspace. Paperspace provides a GPU-accelerated infrastructure platform aimed at making training and deploying AI models dead simple. Developers can build proofs of concept, train and fine-tune AI models, and deploy those models to API endpoints without worrying about infrastructure. This focus on simplicity meshes well with DigitalOcean's core strategy.

DigitalOcean's AI push is going to eat up some cash as the company invests in expanding Paperspace. While the company expects to generate strong free cash flow this year, buying pricey GPUs for the AI business will reduce free cash flow by as much as $20 million. Even with that investment factored in, DigitalOcean expects to convert between 21% and 22% of revenue into free cash flow in 2023. Paperspace will continue to act as a headwind to free cash flow in the longer run, at least until it becomes big enough to offset the heavy investments required to scale the business.

Shares of DigitalOcean sank after the company reported its second-quarter results earlier this month, largely because of a weak outlook. The slowdown in the cloud computing market is widespread, so DigitalOcean is far from the only provider seeing customers pull back. In the long run, the company's focus on simplicity still looks like a winning strategy. With a market capitalization hovering around $2.9 billion, DigitalOcean stock trades for less than 20 times free cash flow guidance.

Given the company's solid free cash flow generation despite a revenue slowdown, what looks like a reasonable valuation, and the long-term potential of its acquired AI business, DigitalOcean is an AI stock to buy for long-term investors.

Avoid Cloudflare

Cloudflare is a great company. The edge computing leader started out focused on content delivery and basic security, then leveraged its global network to launch a wide array of other products and services. Its generous free tier creates a massive pipeline of potential paying customers, and the company is winning enterprise customers at a rapid pace. Cloudflare now has over 2,350 customers shelling out at least $100,000 on its platform annually.

Cloudflare's long-term growth opportunities are vast. Beyond its core CDN and security businesses, the company is a player in the Zero Trust market. Zero Trust, which enables employees to securely connect to resources and applications, is expected to grow into a $60 billion market by 2027. That's an enormous opportunity for Cloudflare.

The company has also aggressively expanded its serverless computing business. Cloudflare's Workers platform allows customers to run code on its global network, bringing applications closer to users. Over the past few years, Cloudflare has added additional services including object storage, a full-fledged database, and a message queue service. With each new product, Cloudflare has made its platform a more viable alternative to the big cloud platforms like Amazon Web Services.

Cloudflare expects its total addressable market to grow to $204 billion by 2026, and AI could push that number even higher. The company is aiming to make its platform a leading option for AI inference. The company already uses AI across its various products to detect malicious traffic and perform other tasks, and now Cloudflare is testing out a product that allows customers to deploy pre-trained AI models on the Workers platform. Cloudflare believes the AI inference market will be "substantially larger" than the AI training market in the long run.

While Cloudflare's AI opportunity is vast, there are two big problems with the stock. First, Cloudflare is not even close to turning a real profit. The company posted a net loss of $94 million on $308 million of revenue in the second quarter, and the situation is not improving.

Second, Cloudflare stock is priced for perfection. With the company guiding for full-year revenue as high as $1.287 billion, the stock trades at a forward price-to-sales ratio of 15. Given that growth is slowing, the result of a tough macroeconomic backdrop and some execution issues, that valuation looks tough to justify.

Cloudflare has the potential to be an AI leader, but until the stock price makes sense relative to the company's results, Cloudflare stock is one to avoid.