There are two permits you need to get. One specific to the trekking area, and another one called the Trekkers Information Management System (TIMS).
The TIMS permit can be purchased in Kathmandu or Pokhora. The line in the office may or may not take a few hours, so plan to go the day before your start date. It costs $20 and you need your passport and two passport size photos. I didn’t need proof of insurance, but if you go with an agency, they may require it. This is a general trekking permit that allows the government to track the number of trekkers.
Some treks are in a protected area. And the different treks have different fees . Take a look at that link to determine how much your permit is for a specific trek. If going to these protected areas, a guide is required which will add another cost to your trip. The fees from this goes towards the conservation of these areas, (or so they claim).