CHICAGO — Onstage at the Hideout, a small Chicago music club, two performers read passages from Civil War love letters. “Oh darling wife of the war,” one begins, “I shall always be a husband to you and the children and all the folks in our neighborhood.” He goes on to complain that “the boys from the army have taken my breakfast.” The news is worse back home. “Our horses are sadly on fire,” his wife laments. But they’re ever reunited, she promises, “I would kiss you as many times as there are stitches in the children.”

Rest assured, every word from these letters is authentic. It’s just that the words have been scrambled up by a computer algorithm and pieced back together, one by one, by writers with an ear for the absurd. At its funniest, this 21st century form of techno-Dadaism is a sublime collaboration ­between humans and machines, merging the creativity of one with the robotic uncanniness of the other into an original comic voice. No human would write “I would kiss you as many times as there are stitches in the children,” but the line is nonetheless flush with romantic longing and the hardships and violence of the period. It’s grounded in truth.

Welcome to the world of Botnik Studios, a digital company that specializes in artificial intelligence-assisted interactive comedy. Here’s how the Botnik works, according to its co-founder and CEO, Jamie Brew: “You know that predictive text bar on your phone? You know how it offers you words that are likely words that it thinks you might type next? We make technology that does the same thing, but it’s asking, ‘What might J.K. Rowling type next?’ or ‘What might the average Yelp reviewer type next?’ What comes out of it is absurd and feels like a kind of comedy writing.”

Founded in October 2016 by Brew, a former editor for the Onion’s sister comedy site Clickhole, and Bob Mankoff, who served as cartoon editor at the New Yorker for two decades, Botnik has created several viral moments out of its surreal text collages. Scraping the text of all the Harry Potter books yielded a lost chapter of a Rowling bestseller called “Harry Potter and the Portrait of What Looked Like a Large Pile of Ash” that got over 46,000 retweets and inspired fan art and T-shirts. Botnik also struck a chord with a fake Coachella lineup composed of bands coughed up by a computer after it analyzed actual names (Fanch, One of Pig, and Lil Hack are the headliners) and deranged new scripts for sitcoms like “Scrubs” and “Seinfeld.”

But here on the Monday night, before a standing-room-only crowd of friends and cult-comedy aficionados, Brew is behind a microphone in the back of the room, emceeing, appropriately, in a voice that’s half-human and half-robot, distorted by sound effects. He starts the Botnik Live! show by inviting the audience to create their own predictive-text sentence based on Yelp! reviews of the Hideout. Then come a series of sketches: An airline stewardess reading through mangled safety instructions, a dinner date featuring a character composited from the quirky love interests in “Garden State” and “500 Days of Summer,” an episode of “Ebert & Roeper” (“not even suffering tropical children will enjoy it,” goes one pan), and a jaunty singalong that combines classic sea shanties with the lyrics of Bjork and Blue Oyster Cult.

Finally, Brew climbs onstage with a full band, performing an original song that’s in the style of The Smiths but fuses Morrissey’s melancholy, world-weary lyrics with the pumped-up rhetoric of Amazon reviews for the P90X home fitness system. “And I think it’s fair to saaaaaay,” the chorus goes, “I’ve gotten bored with this desire to get ripped.”

The rhythms of Botnik take some getting used to, because they have no rhythm at all. The texts from a source — such as the Harry Potter books — are fed into a program called Voicebox, which determines the high-frequency words and incorporates them into a “predictive writer” that resembles the text message screen on a phone. There, users can compose sentences one word at a time, selecting each word from a list of nine or more possibilities that the computer thinks could come next.

Brew and his team of writers and editors use this program to compose their ideas and then pitch them to each other during “jam” sessions on the company’s Slack chat rooms. For instance, for the Coachella poster, they considered and then rejected Chaos Innards and Mormen Azyra Stove Jazz, but they did pick Project Mayor and Horse Choir.

The process is not that dissimilar to the meetings at the Onion, where writers have been pitching satirical news headlines since 1988. Yet the tone of Botnik isn’t satirical but silly, and for Mankoff, that encourages a positive shift in our relationship to technology. “We’re already collaborating constantly with machines,” Mankoff says. “How might we do so in ways that are playful, creative and joyful?”

To that end, users are free to visit the Botnik website and fiddle around with the app themselves, drawing from dozens of source texts, including the lyrics of Bob Dylan, David Bowie and Beyoncé, scripts for “Seinfeld,” “Scrubs” and “The West Wing,” poetry by Wordsworth and Coleridge, and miscellaneous keyboards, like one that combines “Beowulf” and Maya Angelou with a forklift manual.

Botnik isn’t alone in trying to find the intersection between comedy and AI. In 2016, director Oscar Sharp and Ross Goodwin, an AI researcher at New York University, created an original science-fiction short called “Sunspring,” starring Thomas Middleditch (“Silicon Valley”) — a computer program analyzed dozens of sci-fi movie movies and spit out a script that was hilarious nonsense. Six years before that, Northwestern professor Kristian Hammond tried to create software that generated humor, to see how a computer could mimic human thought, and Sen. John McCain (R-Ariz.) dinged a $700,000 stimulus grant for the “joke machine.” What’s unique about Botnik, though, is the level of interactivity. This isn’t a computer telling jokes, but a collaboration.

So how is this a business?

Hunched over beer and popcorn at the Bucktown Pub, Brew and Mankoff make for a peculiar team — one a 27-year-old weaned on Internet comedy, the other a 73-year-old who worked for the most storied institution in the magazine world. Yet Mankoff, who calls himself a comedy “futurist,” helped usher the New Yorker’s popular cartoon caption contest into the digital age.

Driven by a mutual interest in comedy and AI, Mankoff and Brew connected through Colin Stokes, who freelanced for Brew while he worked as Mankoff’s editorial assistant. Brew had been tinkering with his predictive-text algorithm on a Tumblr blog called Object Dreams, and Mankoff had the connections to incorporate Botnik and help it get off the ground. Now, Brew is the full-time CEO, working with a team of about 30 writers and 20 developers on a freelance or contract basis; Mankoff’s day job is cartoon and humor editor at Esquire, though the two are in frequent contact.

While it’s those viral comedy bits that spread Botnik’s name, the company makes money by selling content to corporations. In mid-2017, it scored a three-month, $100,000 contract to work on Amazon’s Alexa Accelerator program, which essentially asked them to use their digital comedy tools to help humanize the voice-based Amazon Echo device. Brew called the experience “a crash course in entrepreneurship,” and Botnik has since forged partnerships with CollegeHumor, Funny Or Die and the Onion, with which it’s collaborating on a summer ad campaign for Coors. But Brew worries AI-derived comedy writing may be a commercial fad, so he’s eying a more ambitious business model, too.

“The next thing we want to try out is to make Botnik a Minecraft for text,” he says, referring to the popular computer game that’s like virtual Legos. “The idea is that [Botnik] is a platform where you can write with any voice, combine multiple voices, save the ones you combine, and share your voices with other people,” who might buy them from you.

The Minecraft analogy is a compelling hook, because it’s both ­user-friendly and expansive. As Brew says, in Minecraft, “you carve out blocks from a hill and you use the blocks to make these structures. From those very simple mechanics, infinite possibilities arise.” Botnik’s founders believe the company will succeed if users are inspired to turn simple mechanics into infinite possibilities, too, and give themselves over to a happier, more creative relationship with machines.

“The flour disappears into the batter until you rotate your hands and let it rise like a soufflé.” This sentence — never uttered in human history, much less written in a cookbook — was created by me from recipes for cinnamon pancakes.