Polyform’s non-commercial licenses are probably the closest fit. They keep the code public but block commercial use. CC BY-NC is another option, though it’s more for content. There isn’t a perfect “no AI training” license yet, but Polyform gets you most of the way there.
People training AI models don't consider licenses, the only way to prevent them from training on your code is to block them from downloading it, and block everyone who can download it from putting it somewhere that the AI folks can download it.
Polyform’s non-commercial licenses are probably the closest fit. They keep the code public but block commercial use. CC BY-NC is another option, though it’s more for content. There isn’t a perfect “no AI training” license yet, but Polyform gets you most of the way there.
People training AI models don't consider licenses, the only way to prevent them from training on your code is to block them from downloading it, and block everyone who can download it from putting it somewhere that the AI folks can download it.