Apple Inc. is preparing to allow third-party developers to write software using its artificial intelligence models, aiming to spur the creation of new applications and make its devices more enticing.