← The Tickd Guide

Inspiration

How to build a custom fantasy weather forecaster using Claude and Python

Transform boring meteorological data into a daily, narrative roleplaying adventure. Build a Python script that turns your local weather feed into lore-rich fantasy chronicles.

Updated 9/2/2026

Slaying the Dullness of Everyday Weather Feeds

Let us be honest: checking the weather is an incredibly mundane task. You pull out your phone, squint at a minimalist blue interface, and discover that it is going to be 11°C and drizzling in Leeds. Again. There is no magic to it, no drama, and certainly no narrative scope.

But what if, instead of "light rain and moderate wind," your morning update informed you that "the weeping mists of the Obsidian Peaks descend upon your hearth, carrying whispers of ancient gales from the north"?

With a simple Python script, a free weather API, and the creative muscle of an LLM, you can transform boring local meteorological data into a daily, customized fantasy chronicle. It is the perfect weekend project to add a little worldbuilding and whimsy to your morning routine, keeping your command line ticking over nicely.

The Architecture: How It Works

This project does not require an over-engineered database or an expensive server. The workflow is wonderfully straightforward:

  1. A Python script fetches the real-time weather data for your postcode using a free, public API.
  2. The script parses this raw data (temperature, wind speed, precipitation, humidity) into a clean, readable string.
  3. The data is piped into an LLM via API, accompanied by a carefully structured system prompt that maps real-world conditions to fantasy equivalents.
  4. The model outputs a beautifully formatted lore update, which can be printed directly to your terminal, emailed to you, or read aloud by an audio agent.

To make this run as cost-effectively as possible, you can use Gemini 1.5 Flash or Claude 3.5 Haiku, both of which offer incredibly fast response times and low API costs for text-generation tasks. You can dive deeper into the terminology of these API agents in our AI Glossary.

Step 1: Getting Your Weather API Key

First, you need a reliable source of raw weather data. We recommend using OpenWeatherMap or WeatherAPI. Both have robust free tiers that allow thousands of calls per day—far more than you will ever need for a personal project.

Sign up, grab your API key, and store it safely in your environment variables.

Step 2: The Python Skeleton

Here is a simple, robust Python script to fetch your local weather data. This script uses the standard requests library to grab the data and prepare it for our LLM.

`python import os import requests

def get_local_weather(api_key, city): url = f"http://api.weatherapi.com/v1/current.json?key={api_key}&q={city}&aqi=no" response = requests.get(url) if response.status_code != 200: raise Exception("Failed to retrieve mortal weather records.") data = response.json() # Extracting the raw values we want to translate into lore weather_payload = { "temp_c": data["current"]["temp_c"], "condition": data["current"]["condition"]["text"], "wind_kph": data["current"]["wind_kph"], "humidity": data["current"]["humidity"], "cloud_cover": data["current"]["cloud"] } return weather_payload `

Step 3: Writing the Lore Translation Prompt

This is where the magic happens. The quality of your fantasy forecast relies entirely on the parameters of your system prompt. You must instruct the model to map specific real-world metrics to fantasy concepts. For example, high humidity becomes "ambient mana thickness," and a thunderstorm is "an ancient elemental feud."

Here is a highly effective system prompt that you can tweak or generate variants of using our custom prompt engineering tools:

`markdown You are a weary, half-mad royal cartographer and wizard residing in a high-fantasy medieval realm. Your task is to translate raw, modern meteorological data into an evocative, lore-rich morning dispatch for local adventurers.

Here is the mapping guide you must follow: - Temperature (C): Under 5C is 'The Frost-Giants' Breath'. 5C-15C is 'Chilly Mist-Shrouded Dawn'. 15C-25C is 'The Sun-God's Favor'. Above 25C is 'The Fire-Drake's Sigh'. - Wind Speed (kph): Low wind is 'Dormant Gales'. Wind over 20kph is 'Gwythaint Wings stirring'. Wind over 40kph is 'A Dragon's Wrath'. - Precipitation/Condition: Rain is 'Weeping Skies/Elven Tears'. Thunder is 'Dwarven Forge-smoke'. Clear is 'The Great Beacon of Amon-Din'.

Write a 150-word daily dispatch. It must sound epic, slightly ominous, and contain one piece of practical advice for an adventurer setting out today (e.g., if it is raining, suggest oiling their leather armour to prevent rot).

Do not mention modern words like 'degrees Celsius', 'kilometres per hour', 'API', or 'weather forecasts'. Speak purely in-character. `

Step 4: Hooking up the Claude API

Now, we integrate our Python weather payload with the Anthropic SDK. First, ensure you have the library installed (pip install anthropic).

`python from anthropic import Anthropic

def generate_fantasy_forecast(weather_data): # Initialize the client. Make sure your ANTHROPIC_API_KEY environment variable is set. client = Anthropic() raw_weather_summary = ( f"Current Conditions: {weather_data['condition']}. " f"Temperature: {weather_data['temp_c']} degrees Celsius. " f"Wind Speed: {weather_data['wind_kph']} kph. " f"Humidity: {weather_data['humidity']}%. " f"Cloud Cover: {weather_data['cloud_cover']}%." ) system_prompt = "[Insert the System Prompt from Step 3 here]" response = client.messages.create( model="claude-3-5-haiku-20241022", max_tokens=300, temperature=0.8, system=system_prompt, messages=[ {"role": "user", "content": f"Translate this raw weather data: {raw_weather_summary}"} ] ) return response.content[0].text `

If you run into rate-limiting issues or authentication errors while configuring your client, the official Claude API Support Forum offers quick, direct solutions to keep your scripts running smoothly.

Step 5: Automating Your Fantasy Morning Dispatch

To make this a seamless part of your daily routine, you can set this script to run automatically every morning using a simple cron job on macOS/Linux or Task Scheduler on Windows.

For a true command-line wizard aesthetic, you can append the output of this Python script to your terminal’s shell startup file (such as .bashrc or .zshrc). Every single time you open a terminal to start your work day, you will be greeted by a custom fantasy dispatch warning you of incoming elven tears and advising you to sharpen your blade.

Who says utility tools have to be boring? With just a few lines of code and some creative prompting, you can turn the daily grind into an epic saga.

pythonclaudecreative scriptingrpgautomation

Keep going

Build something with the prompt generator, decode the jargon in the glossary, or compare the tools on our platform deep-dives.