Some time ago I have read book where main protagonists were helped by AI, that was real smart ass I do remember couple parts of the books so here they are:
1) AI is found while main protagonist is hold hostage in interrogation facility it allows main protagonist to escape confinement in to near by storage where the main character finds something resembling a tin can that is an actual AI. the AI helps him to ultimately orchestrate escape for main character and all his friends the AI is low on power and needs to be recharged so its rescue for both AI and main character
2) later in the story we find out that the AI is in reality massive construct in different dimension while the "tin-can" is only small part that shows in normal space time.
3) the series is with AI main character and small crew that completes different tasks one of them being attack on "carrier ship" that transports enemy sub light combat ships through FTL. They 1st capture one of the enemy parasite ships and then capture entire carrier. the main "crew" is supplemented by earth special forces
4) the AI cheats and manipulates ppl on Earth in order to get advantage to him self and main hero, that AI consider friend. AI is also running gambling scams on Earth betting on baseball league