It's my understanding that the Defense Production Act can prevent them from cancelling the contract.
Someone can correct me if I'm wrong, but as far as I know Hegseth's Henchmen can tell them to do stuff and they have to do it. There's no opt-out.
You are wrong.
Under the DPA, the Government can require a person/business to provide their product or service to the government. The government can even claim priority -they get all of their units before you can sell any to anyone else. The government can grant the right to produce your product (even if you hold a patent) to others to produce what they need (typically because you cannot reliably produce enough to meet their needs).
The government cannot mandate that you make things for them that you do not otherwise make. They can only buy what you sell.
The government can always offer to pay you to do something new for them, but you are free to say "no."
In this case, it is a little murky. Under the DPA, Anthropic can be forced to sell licenses to the government, but it raises the question:
-is allowing their AI to be used for "prohibited purposes" creating a new product (as custom coding would be required to bypass the restrictions) ?
-or would it just be the DoD using the off-the-shelf product in a way that Anthropic does not approve of ?