It sounds to me as if you need closure with your husband. You have children together, which means you're going to have to deal with each other, so perhaps it's a good idea to work through things with him. Apologize to him. He might not forgive you, which is what you seem to need most, but at least you would be taking a step toward reparations.
I don't think you can forgive yourself until you work things out with your husband. And by "work things out" I mean "clear the air" and have a discussion or series of discussions with him about what happened and why without once putting any of the blame on him. Be sure he knows how sorry you are and how bad you feel. He may need to vent on you, which is all right. Let him have his say.
I'm sure that there were things going on in your marriage before the affair that we're not privy to, and I don't care to know, but those things didn't just disappear because you had the affair and aren't together any more. So perhaps those things should be worked out too for the sake of the children so that custody doesn't become a nightmare and you guys can learn to co-exist with each other for the future.
If you don't think that you can do this all civilly, or are afraid to do this alone with him, then for the sake of the children I would suggest having a family counseling session with him before you attend counseling for yourself and/or the children. That way you can have neutral ground for both of you to air things out.