She sounds pretty angry about something, and unable to talk about it for whatever reason. If she didn't know that she was being disrespectful, she wouldn't throw in the little haha, joking comments after being rude. So, she's either incapable of not being rude and trying to blow it off once she realizes what she's said, or she's fully capable of not being rude and choosing to be rude. It sounds like it's most likely the latter, since I'd expect a more OMG, did I just say that?! reaction if it was the former. So, if it's on purpose she's probably either testing you to see if you'll throw her away like the worthless thing she's been told she is; working out her anger at her mom/family on a 'safe' target; or resentful that she's having to live at your place, either because it wasn't her choice to be there, or she didn't have the choices she wanted. From how she's railing on you, I suspect she's conflicted about her own mom, like many kids are when they get a step parent - they go through a phase of being mean to the step parent to make sure that no one thinks they're giving up on their 'real' parent; or maybe by pointing out how bad a parent she thinks you are, she's trying to justify her mom's actions somehow because everybody is a bad parent. Who knows.
No matter which of these, or which combination of these, not giving her firm & loving limits isn't helping her at all. She will probably hate it if you sit her down and tell her how it's going to be, but it may also be the first sign she's had in a good long time that someone cares about her and what she's doing, and not just for their own convenience either. Saying something like, " I care about you and I really want this to work out. You seem really angry to me, and it worries me. I'd like for our house to be a safe place for you, and I'd like to think of you as part of our family, but this isn't going to work if you are insulting my kids and being disrespectful to me and my husband all the time. What can we do to make this work?" might work; I doubt anyone has put the ball in her court for a while. I'd probably ask some questions if she was anything other than hostile to that opening, like " From how you are acting, it seems like you don't want to be here. Is that true?" .
I'd also make a point of helping personalize a space for her if you haven't already, so it feels to her like you have some level of commitment to her being there and being happy there.
I agree with what Jen Muise is saying. I bolded that sentence about being incapable of not being rude because that's what came to mind for me. I remember being a teenager and saying some nasty stuff without meaning it, but not knowing how to take it back or when was an okay time to share things.