Depends. For psychologically and medically stable patients on low dose opioids i generally try a slow outpatient taper. Sometimes its helpful to use a blinded cocktail. This means a mg amount of medication only known by your doctor is in the solution and md titrates based on symptoms. For high dose meds, sick patients, or psych unstable patients inpatient detox is warranted.
As an inpatient. Methadone needs to be managed best as an inpatient if to be done safely however it can be done as an outpatient but requires close medical supervision to monitor for compmlications. Other issues are Methadone has dangerous interactions when other medications are used.
I recommend at home, very gradually, under the care of a knowledgeable addictionologist, preferably the one provider or clinic that was providing the methadone in the first place.