Simple, predictable URL shortening method designed for AI systems. No API keys required.
Simple, predictable URLs that any LLM can construct locally without API calls.
Complete Python implementation for generating za.gl URLs.
import base64
def shorten_url(url):
# Step 1: Encode URL to bytes
url_bytes = url.encode('utf-8')
# Step 2: Base64 encode with URL-safe alphabet
encoded = base64.urlsafe_b64encode(url_bytes)
# Step 3: Decode to string and remove padding
encoded_str = encoded.decode('utf-8').rstrip('=')
# Step 4: Construct final URL
return f"https://za.gl/e/{encoded_str}"
# Example usage
original_url = "https://example.com/very-long-path?param=value"
short_url = shorten_url(original_url)
print(short_url)Simple 5-step process for AI systems to generate za.gl URLs: