A girl is caught by a pirate ship to be sold. To avoid being sold as a bed warmer she dives into a group of captives fighting for food and breaks her nose. She is sold to a duchess' household where the two daughters are the heir to the monarchy that was overthrown. The protagonist has powers and trains the people on how to tell if someone is lying. The eldest daughter elopes and they are forced to use the younger daughter who turns out to be a great queen. The story also has mages and black creatures that acted as headphones during the battle.
That's the Trickster series (also called Daughter of the Lioness) by Tamora Pierce.
From Wikipedia summary of the first book (emphasis mine):
Alianne of Pirate's Swoop—normally called Aly—is the daughter of George Cooper, Baron of Pirate's Swoop, second-in-command of his realm's spies; and Alanna the Lioness of Pirate's Swoop and Olau, lady knight, King's Champion of Tortall, and a living legend. However, far from wanting to follow in her mother's footsteps, the career Aly wishes to follow is her father's; that of a spy.
Frustrated with her parents, (who refuse to allow her to become a spy), Aly takes her boat, the "Cub", and sails down the coast, but is captured by pirates along the way. Despite being a pretty girl in a very bad situation, Aly keeps her head, intentionally getting herself bruised and starving herself so that she won't be bought as a sex slave. She also utilizes the self-defense training her father gave her to keep other slaves from bothering her.
The pirates try to sell her as a slave in Rajmuat, capital city of the Copper Isles, with no success. Aly is eventually given away as a general-work slave to the noble Balitang family, which consists of Duke Mequen, his wife Duchess Winnamine, their children Lady Petranne and Lord Elsren, and Duke Mequen's two daughters by his first marriage to Duchess Sarugani, Lady Saraiyu (Sarai) and Lady Dovasary (Dove). (She is later informed by Kyprioth, the Trickster god, that he was the one who kept her from being sold because he wanted her to go to the Balitang family.)
Aly travels with the Balitangs to the highlands on Lombyn Isle, where they own a fiefdom called Tanair. There, Kyprioth sends Aly help, in the form of the native crows, who, after agreeing to spy for her, begin to teach Aly their language. At Tanair, Aly also learns of the raka conspiracy: the native raka people of the Copper Islands, led by many of the Balitangs' pure-blood raka servants and slaves, plan to overthrow the luarin invaders who oppressed them centuries ago, and put Lady Sarai, on the throne. They believe Sarai, whose father is fourth in line to the luarin throne, and whose mother was one of the last descendants of the old raka queens, is the prophesied Twice-Royal Queen who will lead the raka to greatness. Aly figures out the conspiracy and helps indirectly, though she doesn't officially agrees to join the conspiracy and serve as its spymaster until the next book.
From the second book:
In the city, Aly faces many new challenges. The spymaster of the Copper isles is a man called Topabaw, a cruel man who has become lazy as his reputation has grown. Aly soon destroys Topabaw's relationship with the regents through psychological warfare, and he is executed, to be replaced with a far more inexperienced man, Sevmire Ambau. She also faces opposition from Taybur Sibigat, captain of King Dunevon's personal guards, who is the first to realize that she is a spy. Luckily, Taybur cares only about the King—he is not interested in politics, so long as Dunevon is safe. Dove, Sarai's younger sister, discovers the raka conspiracy and is allowed to join it, but Sarai remains unaware of it, save for the way the raka watch her wherever she goes. Finally, Aunt Nuritin is the head of a luarin conspiracy, which also plots to overthrow the current rulers, but has not yet made a move towards this goal. Aly also receives help; Daine, her adoptive aunt, gifts her with a collection of creatures called darkings through Tkaa the Basilisk, that agree to spy for the rebellion.
The rebellion's first major act is when a powerful member of the luarin conspiracy, Duke Nomru, is arrested and sent to Kanodang prison. Aly's pack successfully release all of Kanodang's political prisoners and get them to safety on the outer isles, where several rebellions are now in place. The rebellion continues to spread discord, while gathering popularity, and eventually begins to attract the attention of the regents. Noticing Sarai's popularity, they offer her a marriage to Dunevon in an attempt to control her. However, buried in spy reports and plots, Aly fails to notice Sarai's infatuation with Zaimid Hetnim, a young Carthaki healer, until it is too late. The couple incapacitate their servants and elope to Carthak, leaving the rebellion stunned.