Take all the blame, distribute all the praise.
Here is the thing, being a consultant is a thankless job, and it needs to be. If a project does not go as planned, the success does not happen. Take the blame. You are an external, it does not matter. They got you into the company to improve the state of the client, to improve them. If it does not happen, you are to blame. And they need someone to blame, so just take it.
If you succeed, spread the praise. You worked with them, it was the right decision that they hired you, so they did great. And you just humble helped them to unlock the potential they already had.
Thing is, in scenario 1, if you deflect blame, they will not hire you again. And they will badmouth you if somebody asks. You you take the blame, they might not hire you again, but they will respect you when somebody asks about you.
In scenario 2, if you take all the praise, they will not feel good about themselves, and will not WOM (word of mouth) you. If you spread the praise, they will feel good about themselves, talk about their success and will so WOM you.
A thankless job. I love it.