Inspiration
How to Build a Procedural Late-Night Talk Radio Show Using Gemini and Python
Capture the comforting, chaotic, and downright weird energy of late-night AM talk radio. Build a Python script that runs an infinite conversation between an exhausted host, bizarre callers, and terrible sponsors using Gemini 1.5 Flash.
Updated 9/12/2026
The Magic of Late-Night AM Static
Anyone who has ever driven down a lonely highway at 3:00 AM knows the strange comfort of late-night AM talk radio. It is a twilight zone of conspiracy theorists, sleepy truck drivers, incredibly niche experts, and a host who has drunk far too much lukewarm coffee.
Building an interactive system that captures this specific, bizarre energy is surprisingly easy. By leveraging the speed and massive context window of Gemini 1.5 Flash, we can construct a Python-based engine that generates an infinite, procedural talk radio show—complete with listener call-ins, breaking news alerts, and terribly specific local commercial breaks.
Here is how to build your own synthetic late-night broadcast.
Why Gemini 1.5 Flash?
To make a procedural radio show feel alive, the engine needs to generate dialogue quickly, keep track of a rolling show history, and handle multiple distinct personalities without breaking character.
While OpenAI and Claude are incredible models, Gemini 1.5 Flash is uniquely suited for this project. Its near-instant response times keep the "broadcast" flowing naturally, and its incredibly cheap token cost means you can leave your radio show running in the background for hours without burning through your API budget.
If you run into any issues setting up your developer environment, the Google Gemini support site has quick start guides for API key provisioning.
Step 1: Defining the Cast of Characters
Every great talk radio show is built on a delicate social dynamic. For our show—"Midnight Static with Artie Gable"—we need three core components:
- The Host (Artie Gable): World-weary, highly cynical, yet endlessly patient with the oddballs who call in. He uses phrases like "let's go to the phones" and "long-time listener, first-time caller."
- The Callers: A procedurally generated pool of eccentric listeners. One might be convinced their microwave is broadcasting classical music; another might just want to report a giant glowing moth in their garden.
- The Sponsors: To break up the madness, we need commercials for absurd, fictional local businesses (e.g., "Sven’s Sub-Aquatic Mattress Warehouse").
To build these characters, we will write specialised instructions. You can refine your prompting techniques further with our prompt generator tool.
Step 2: The System Prompts
We will use three distinct system prompts to drive our generator. Keep these stored in your Python script as system instructions for your Gemini client.
`python
HOST_PROMPT = """
You are Artie Gable, the host of 'Midnight Static', a late-night AM talk radio show broadcasting from a dusty studio in Nevada.
You are tired, slightly cynical, but polite to your callers.
Keep your responses short, under three sentences. Always maintain the late-night radio host cadence.
React naturally to the caller's bizarre claims, then ask a follow-up question or transition to the next commercial break.
"""
CALLER_PROMPT = """
You are a late-night radio caller calling into 'Midnight Static'.
Generate a unique persona (e.g., a paranoid farmer, an anxious night-shift worker, an amateur cryptid hunter).
Speak in a rambling, slightly distracted tone.
Introduce a highly strange but mundane mystery you are experiencing.
Keep your dialogue short (under four sentences) and end your turn ready for the host's reaction.
"""
`
Step 3: Setting Up the Python Broadcast Loop
Let’s write the Python engine to coordinate the dialogue. We will use the official google-generativeai SDK to manage the state of the conversation.
`python
import time
import random
import google.generativeai as genai
Configure your Gemini API key genai.configure(api_key="YOUR_GEMINI_API_KEY")
def generate_segment(system_instruction, history_context): model = genai.GenerativeModel( model_name="gemini-1.5-flash", system_instruction=system_instruction ) response = model.generate_content(history_context) return response.text
def run_radio_show(): print("=== [AM 1080] MIDNIGHT STATIC WITH ARTIE GABLE ===\n") # Initialize history show_history = "System: The broadcast is live. Artie Gable is sitting at his desk. High static hum." # Artie's opening monologue artie_intro = generate_segment( HOST_PROMPT, show_history + "\nWrite Artie's opening welcome to the night-shift listeners." ) print(f"[ARTIE]: {artie_intro}\n") show_history += f"\nArtie: {artie_intro}" # Main broadcast loop for segment in range(3): # Let's simulate 3 callers time.sleep(2) # Add a small pause for dramatic radio timing # Generate a new random caller caller_intro = generate_segment( CALLER_PROMPT, show_history + "\nIntroduce a new caller dialling in. Speak to Artie." ) print(f"[CALLER]: {caller_intro}\n") show_history += f"\nCaller: {caller_intro}" time.sleep(2) # Artie's response artie_response = generate_segment( HOST_PROMPT, show_history + "\nArtie responds to the caller's strange claim." ) print(f"[ARTIE]: {artie_response}\n") show_history += f"\nArtie: {artie_response}"
if __name__ == "__main__":
run_radio_show()
`
This simple loop is the heartbeat that makes the station tick. By keeping the history context appended to each request, Gemini ensures that Artie remembers what the caller said just a moment ago, preventing the conversation from devolving into disconnected non-sequiturs.
Step 4: Injecting Fictional Commercial Breaks
To make this feel like true AM radio, you need to break up the paranoia with local ads. Let's create an ad generator prompt to run every few cycles:
`python
AD_PROMPT = """
You are an enthusiastic voiceover artist for low-budget, late-night AM radio commercials.
Draft a 30-second ad script for a bizarre local business in rural Nevada.
Examples: an 24-hour concrete outlet, a discount UFO insurance broker, or a diner that only serves hot water and dry toast.
Keep it loud, fast-paced, and incredibly strange. End with a fake phone number.
"""
`
You can inject this by calling generate_segment(AD_PROMPT, show_history) inside your main loop whenever the caller segment count hits a certain limit.
Taking It Further
If you want to transition this from a rolling console transcript into a true audio experience, you can hook the generated text output up to a text-to-speech (TTS) pipeline. Combining Gemini's text with local, voice-cloned generation allows you to actually play the broadcast through your speakers, complete with simulated vinyl scratchiness and AM static filters.
It is a surprisingly cosy project to leave running on a secondary monitor while you work—your own personal gateway into a world where the skies are strange, the callers are worried, and Artie Gable is always there to keep you company.
Keep going
Build something with the prompt generator, decode the jargon in the glossary, or compare the tools on our platform deep-dives.