Melissa Leo figures she knows when she's struck gold.

Or, in the case of her character in Showtime's new Jim Carrey-produced dramedy, I'm Dying Up Here, Goldie.

Goldie Herschlag owns a comedy club on the Sunset Strip in the 1970s-set series, which premieres at 10 p.m. Sunday. The whip-cracking ringmaster in a circus of insecure clowns, she's not easily identified as either a villain or a mother figure, which is how Leo, who won an Oscar for playing a very particular mother in The Fighter, likes it.

Watch: Melissa Leo's memorable [bleeped] Oscar acceptance speech

"I've played a lot of characters in television shows, and … they just shuffle me off to the side eventually, because they don't know what to do with me," Leo said in an interview a few months ago. "Because I'm not one thing or another – I'm whole people all the time. I finally found a team who will let me be a whole human being. Even though I have a vagina. It's a miracle."

Inspired by William Knoedelseder's nonfiction book I'm Dying Up Here: Heartbreak and High Times in Stand-Up Comedy's Golden Era, as well as by some of Carrey's early career experiences, the Showtime series is written by veteran TV writer (and former stand-up comic) David Flebotte. Dylan Baker guest-stars as Johnny Carson, whose Tonight Show could ignite careers, Brandon Ford Green turns up in a later episode as comedian Richard Pryor, and the cast of fictional comedians includes several actors — Al Madrigal and Andrew Santino among them —  who have stand-up experience.

As for Goldie, "there is a woman in that book who owns a club unlike any other club in the world at that time. I don't play that woman. I play someone like her. Which there wasn't," Leo said. "Does that make sense?"

Carrey, speaking to reporters at the Television Critics Association's winter meetings, spelled it out. "Melissa Leo, at the center of it, is unbelievable. … She's not playing [Comedy Store founder] Mitzi Shore, but she is a tribute to women like Mitzi, who were pioneers."

And, like Shore, whose belief in not paying most of her comedians in anything but exposure triggered a 1979 job action (with a picket line that included David Letterman and Jay Leno), Goldie's a piece of work, "a marriage of commerce and creativity," Flebotte said.

"She loves comics," he told reporters, "and it's also her bread and butter."

Which doesn't mean she's above exploiting their eagerness for her approval. RJ Cyler (Me and Earl and the Dying Girl) plays Adam, a young African American comic who finds  Goldie may be  more interested in his carpentry skills than his comedy chops.

Asked about a scene in which she's offering advice to a comedian named Cassie (Ari Graynor) about being funny while female — advice that might not necessarily be in Cassie's best interest — Leo seemed reluctant to pinpoint her character's motives.

Melissa Leo as Goldie and RJ Cyler as Adam in Showtime's "I'm Dying Up Here," premiering June 4 (JUSTINA MINTZ/Showtime)
JUSTINA MINTZ/Showtime
Melissa Leo as Goldie and RJ Cyler as Adam in Showtime's "I'm Dying Up Here," premiering June 4 (JUSTINA MINTZ/Showtime)

"The questions that you're asking me – I want you to think for a moment of people who you know really well. Because when you see the characters in a TV show, you get to know them better than you know acquaintances, right? So this is why you'd ask these questions. Because now you know her actually better than you'd know an acquaintance. You know her more like somebody you hold as an intimate," she said.

"And any one of those intimates that you can think of, in this moment, right now – is anybody perfect? Does anybody always make the right choices? Does any one of those people live with such virtue that they never make a mistake? Do they always see the mistakes when they make a mistake? And what Flebotte and [fellow executive producer Michael] Aguilar managed to do with this incredible ensemble cast is to write a story that has a continuity of character, but not by pigeonholing the characters. So she will be frustrating. Just like your best friends are. Because she's not one thing or another. She's a human being."

And although Goldie's neither an agent nor a manager, "what she finds herself engaged in is a little bit of managing, a little bit of mothering, a little bit of agenting," Leo said.

She's not getting a cut, but "what she gets is she gets her life. She gets that life. The exchange that's made is she gets this life, she runs this club, she's Goldie. She has her reputation, her place to be, a sense of belonging. And what they get is they get a chance in hell that their comedy will be seen one day."

Like Goldie, Leo knows where she belongs, and it's not on stage in front of an open mic, working for laughs.

"My first experience in a comedy club, I was invited in to an improv class when I was in my 20s in New York, at the Improv. I couldn't even make it through the class. What I do as an actor, it's so different than that on-purpose, knowing what's funny, and making the delivery of it … an art form," she said.

"I did have an opportunity more than once to work with Robin Williams." She played his wife in The Angriest Man in Brooklyn and, in a part that ultimately was cut from Lee Daniels' The Butler, was Mamie to Williams'  Dwight Eisenhower. "I've been around other comics, as well, Richard Belzer when I was on Homicide. Stand-up comedy is a … hard job."

And, she believes, an important one.

"I always think of the courts in the days of old, with the kings and queens having a court jester or a fool, and that role was not just to make people laugh. It was to tell the truth when nobody else could. 'Cause then the jester can say, 'Just a joke!' Right? So if you are the bearers of the truth, well, that's a heavy responsibility in society today. And that was changing in the '70s. Vastly. Entertainment was no longer just entertainment," she said.

But then, "the players have always wanted to catch the conscience of the king."