LLM URL شارٹننگ
AI سسٹمز کے ساتھ مطابقت رکھنے والے قابل پیشگوئی URL شارٹننگ کے لیے Base64 انکوڈنگ
جائزہ
ZAGL قابل پیشگوئی، دوبارہ قابل تخلیق مختصر URLs کے لیے Base64 انکوڈنگ کا استعمال کرتے ہوئے LLM دوستانہ URL شارٹننگ فراہم کرتا ہے۔ یہ AI ایپلیکیشنز کے لیے مثالی ہے جنہیں API کیز یا پیچیدہ تصدیق کی ضرورت کے بغیر مستقل URL جنریشن کی ضرورت ہے۔
LLM مطابقت پذیر
AI سسٹمز کے لیے ڈیزائن کیا گیا
قابل پیشگوئی
ایک ہی URL ہمیشہ ایک ہی مختصر کوڈ پیدا کرتا ہے
کوئی API کیز نہیں
سادہ HTTP درخواستیں
API حوالہ
URL انکوڈ کریں
POST /api/llm/encodeدرخواست باڈی
{ "url": "https://example.com/long/url/path" }
جواب
{ "success": true, "data": { "shortUrl": "https://za.gl/e/aHR0cHM6Ly9...", "encoded": "aHR0cHM6Ly9leGFtcGxl...", "originalUrl": "https://example.com/...", "method": "base64", "expires": null, "createdAt": "2024-01-01T00:00:00Z" } }
مختصر URL تک رسائی
GET /e/{base64}مختصر URL ملاحظہ کرنے سے خود بخود اصل URL پر ری ڈائریکٹ ہو جائے گا۔ Base64 انکوڈ شدہ سٹرنگ میں اصل URL ہے اور اسے قابل پیشگوئی طریقے سے ڈی کوڈ کیا جا سکتا ہے۔
تجزیات
GET /api/llm/analytics?days=30&format=jsonLLM سے پیدا کردہ URLs کے لیے تجزیاتی ڈیٹا حاصل کریں۔ JSON اور CSV فارمیٹس کی حمایت کرتا ہے۔
استفسار کے پیرامیٹرز
days: دنوں کی تعداد (1-365، ڈیفالٹ: 30)format: جواب کی شکل (json یا csv، ڈیفالٹ: json)
حدود اور تصریحات
شرح کی حدود
- • انکوڈنگ:: 60 requests/minute
- • ری ڈائریکٹس:: 60 requests/minute
- • تجزیات:: 120 requests/minute
رکاوٹیں
- • زیادہ سے زیادہ URL لمبائی: 4KB
- • پروٹوکولز: صرف HTTP، HTTPS
- • نجی IPs: سیکیورٹی کے لیے بلاک
- • ختم ہوتا ہے: کبھی نہیں (مستقل URLs)
کوڈ کی مثالیں
Python
llm_shortener.py
import base64 import urllib.parse import requests def shorten_url_llm(url): """ Create a predictable shortened URL using Base64 encoding Compatible with ZAGL LLM functionality """ # Validate URL if len(url) > 4096: raise ValueError("URL exceeds 4KB limit") # Encode to Base64 encoded_bytes = base64.b64encode(url.encode('utf-8')) encoded_str = encoded_bytes.decode('utf-8') # Remove padding for cleaner URLs clean_encoded = encoded_str.rstrip('=') # Generate short URL short_url = f"https://yourdomain.com/e/{clean_encoded}" return { "short_url": short_url, "encoded": clean_encoded, "original_url": url } def decode_llm_url(encoded_url): """ Decode a Base64 encoded URL """ # Add padding back if needed padding_needed = 4 - (len(encoded_url) % 4) if padding_needed != 4: encoded_url += '=' * padding_needed # Decode decoded_bytes = base64.b64decode(encoded_url) return decoded_bytes.decode('utf-8') # Example usage original_url = "https://example.com/very/long/url/path" result = shorten_url_llm(original_url) print(f"Short URL: {result['short_url']}") print(f"Encoded: {result['encoded']}")
JavaScript/Node.js
llm_shortener.js
// JavaScript/Node.js implementation function shortenUrlLLM(url) { // Validate URL if (url.length > 4096) { throw new Error("URL exceeds 4KB limit"); } // Validate URL format try { new URL(url); } catch { throw new Error("Invalid URL format"); } // Encode to Base64 const base64 = Buffer.from(url, 'utf-8').toString('base64'); // Remove padding for cleaner URLs const cleanBase64 = base64.replace(/=/g, ''); // Generate short URL const shortUrl = `https://yourdomain.com/e/${cleanBase64}`; return { shortUrl, encoded: cleanBase64, originalUrl: url }; } function decodeLLMUrl(encodedUrl) { // Add padding back if needed let paddedBase64 = encodedUrl; while (paddedBase64.length % 4) { paddedBase64 += '='; } // Decode from Base64 return Buffer.from(paddedBase64, 'base64').toString('utf-8'); } // Example usage const originalUrl = "https://example.com/very/long/url/path"; const result = shortenUrlLLM(originalUrl); console.log(`Short URL: ${result.shortUrl}`); console.log(`Encoded: ${result.encoded}`);
Terminal / cURL
terminal
# Encode a URL curl -X POST https://za.gl/api/llm/encode \ -H "Content-Type: application/json" \ -d '{"url": "https://example.com/very/long/url/path"}' # Get analytics curl "https://za.gl/api/llm/analytics?days=7&format=json" # Get analytics as CSV curl "https://za.gl/api/llm/analytics?days=30&format=csv" \ -o analytics.csv
استعمال کے معاملات
LLM ایپلیکیشنز
- • ChatGPT پلگ انز اور انٹیگریشنز
- • Claude Code اور AI ڈیویلپمنٹ ٹولز
- • خودکار مواد کی تخلیق
- • AI سے چلنے والی لنک شیئرنگ
آٹومیشن اور سکرپٹنگ
- • CI/CD پائپ لائنز
- • Webhook انٹیگریشنز
- • بیچ URL پروسیسنگ
- • دستاویزات جنریٹرز
کے ساتھ مطابقت رکھتا ہے za.gl/llm-docs تصریح
آخری تازہ کاری: 12/3/2025