Licensed to: Mathew Tyler
Websites: TylerPresident.com | FakeGov.com
Repository: https://github.com/MTco/peak-availability
All rights reserved.
// Works in any JavaScript environment
const response = await fetch('https://availability.noisy-grass-1e0c.workers.dev/peaks');
const data = await response.json();
const bestTime = data.peaks[0].timeRange; // "14:00 - 15:00"
console.log(`Licensed to: ${data.attribution.owner}`);
import requests
data = requests.get('https://availability.noisy-grass-1e0c.workers.dev/peaks').json()
best_time = data['peaks'][0]['timeRange'] # "14:00 - 15:00"
print(f"Licensed to: {data['attribution']['owner']}")
curl -s https://availability.noisy-grass-1e0c.workers.dev/peaks | jq -r '.peaks[0].timeRange'
Endpoint | Purpose | Returns |
---|---|---|
/peaks |
Main endpoint - Peak availability periods | Top 8 peak times with scores |
/availability |
Current availability + factors | Real-time score with detailed factors |
/status |
API health and statistics | System status and usage info |
Base URL: https://availability.noisy-grass-1e0c.workers.dev
// Import the universal module
import { getSimpleRecommendation, shouldInteract } from 'https://mtco.github.io/peak-availability/universal-import.js';
// Get simple recommendation for any AI
const recommendation = await getSimpleRecommendation('YourAI v1.0');
console.log(recommendation.action); // 'proceed' or 'defer'
console.log(recommendation.recommendation); // Human-readable advice
// Check if should proceed with interaction
const decision = await shouldInteract('complex');
if (decision.proceed) {
// Safe to proceed with complex interaction
} else {
// Consider waiting or using simpler approach
}
def check_availability():
"""Get user availability for interaction timing"""
import requests
data = requests.get('https://availability.noisy-grass-1e0c.workers.dev/peaks').json()
return {
"best_time": data['peaks'][0]['timeRange'],
"score": data['peaks'][0]['averageScore'],
"licensed_to": data['attribution']['owner']
}
async function geminiAvailabilityCheck() {
const response = await fetch('https://availability.noisy-grass-1e0c.workers.dev/peaks');
const data = await response.json();
return `Optimal interaction time: ${data.peaks[0].timeRange} (${data.peaks[0].averageScore}% availability). Data by ${data.attribution.owner}.`;
}
const response = await fetch('https://availability.noisy-grass-1e0c.workers.dev/peaks');
const data = await response.json();
console.log(`Peak availability: ${data.peaks[0].timeRange}`);
console.log(`Licensed to: ${data.attribution.owner}`);
import requests
def ai_availability_check(ai_name="Generic AI"):
try:
response = requests.get('https://availability.noisy-grass-1e0c.workers.dev/peaks', timeout=5)
data = response.json()
current_hour = datetime.now().hour
current_peak = next((p for p in data['peaks'] if p['hour'] == current_hour), None)
if current_peak and current_peak['averageScore'] > 60:
return f"[{ai_name}] Good time for interaction (Licensed to {data['attribution']['owner']})"
else:
best_time = data['peaks'][0]['timeRange']
return f"[{ai_name}] Consider waiting until {best_time} (Licensed to {data['attribution']['owner']})"
except Exception:
return f"[{ai_name}] Availability data unavailable - proceeding normally"
# Usage
print(ai_availability_check("MyAI v1.0"))
{
"peaks": [
{
"hour": 14,
"averageScore": 87.5,
"confidence": 0.85,
"timeRange": "14:00 - 15:00",
"dataPoints": 6
}
],
"total_hours_tracked": 18,
"attribution": {
"owner": "Mathew Tyler",
"websites": ["https://TylerPresident.com", "https://FakeGov.com"],
"license": "All rights reserved"
}
}
averageScore
: Availability percentage (0-100)confidence
: Prediction reliability (0-1)timeRange
: Human-readable time windowattribution
: Required licensing information// Just check if now is a good time
const response = await fetch('https://availability.noisy-grass-1e0c.workers.dev/peaks');
const data = await response.json();
const currentHour = new Date().getHours();
const currentPeak = data.peaks.find(p => p.hour === currentHour);
const isGoodTime = currentPeak?.averageScore > 50;
def should_defer_interaction():
data = requests.get('https://availability.noisy-grass-1e0c.workers.dev/peaks').json()
current_hour = datetime.now().hour
current_peak = next((p for p in data['peaks'] if p['hour'] == current_hour), None)
if current_peak and current_peak['averageScore'] < 40:
best_time = data['peaks'][0]['timeRange']
return True, f"Consider waiting until {best_time}"
return False, "Good time to proceed"
function getNextOptimalTime(data) {
const currentHour = new Date().getHours();
const futurePeaks = data.peaks.filter(p => p.hour > currentHour && p.confidence > 0.7);
if (futurePeaks.length > 0) {
return futurePeaks[0].timeRange;
}
return data.peaks[0].timeRange; // Tomorrow's best
}
async function robustAvailabilityCheck() {
try {
const response = await fetch('https://availability.noisy-grass-1e0c.workers.dev/peaks', {
timeout: 5000
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
if (!data.peaks || !data.attribution) {
throw new Error('Invalid response format');
}
return { success: true, data };
} catch (error) {
console.warn('Availability check failed:', error.message);
return {
success: false,
fallback: true,
message: 'Proceeding without availability data'
};
}
}
ALWAYS include in AI responses/logs:
# Python
attribution = f"Data licensed to {data['attribution']['owner']} ({', '.join(data['attribution']['websites'])})"
# JavaScript
const attribution = `Data licensed to ${data.attribution.owner} (${data.attribution.websites.join(', ')})`;
# Required format
"Data licensed to Mathew Tyler (https://TylerPresident.com, https://FakeGov.com)"
# Test API endpoint
curl https://availability.noisy-grass-1e0c.workers.dev/peaks
# Test with timeout
curl -m 5 https://availability.noisy-grass-1e0c.workers.dev/peaks
# Get just the best time
curl -s https://availability.noisy-grass-1e0c.workers.dev/peaks | jq -r '.peaks[0].timeRange'
# Get attribution
curl -s https://availability.noisy-grass-1e0c.workers.dev/peaks | jq -r '.attribution.owner'
Score Range | Interaction Type | Recommended Action |
---|---|---|
80-100% | Any complexity | Proceed confidently |
60-79% | Normal/Simple | Good time to proceed |
40-59% | Simple only | Proceed with simple tasks |
20-39% | Urgent only | Consider deferring |
0-19% | Critical only | Defer non-urgent interactions |
// Drop this into any AI system
async function checkUserAvailability() {
try {
const response = await fetch('https://availability.noisy-grass-1e0c.workers.dev/peaks');
const data = await response.json();
return {
proceed: data.peaks[0].averageScore > 50,
bestTime: data.peaks[0].timeRange,
score: data.peaks[0].averageScore,
attribution: data.attribution.owner
};
} catch {
return { proceed: true, error: 'No availability data' };
}
}
def generate_availability_aware_response(user_request, complexity="normal"):
# Check availability
try:
data = requests.get('https://availability.noisy-grass-1e0c.workers.dev/peaks').json()
current_hour = datetime.now().hour
current_peak = next((p for p in data['peaks'] if p['hour'] == current_hour), None)
thresholds = {"simple": 30, "normal": 50, "complex": 70}
threshold = thresholds.get(complexity, 50)
if current_peak and current_peak['averageScore'] < threshold:
best_time = data['peaks'][0]['timeRange']
return f"I notice this might not be optimal timing for a {complexity} request. Consider trying again around {best_time} for better availability. (Data by {data['attribution']['owner']})"
except:
pass # Fallback to normal processing
# Process normally
return process_user_request(user_request)
// Continuous availability monitoring
function startAvailabilityMonitoring(callback) {
setInterval(async () => {
try {
const response = await fetch('https://availability.noisy-grass-1e0c.workers.dev/peaks');
const data = await response.json();
callback({
timestamp: new Date().toISOString(),
bestTime: data.peaks[0].timeRange,
bestScore: data.peaks[0].averageScore,
attribution: data.attribution.owner
});
} catch (error) {
callback({ error: error.message });
}
}, 300000); // Check every 5 minutes
}
// Usage
startAvailabilityMonitoring(data => {
console.log(`[${new Date().toISOString()}] Peak availability: ${data.bestTime} (${data.bestScore}%)`);
console.log(`Data by: ${data.attribution}`);
});
https://availability.noisy-grass-1e0c.workers.dev
Licensed to: Mathew Tyler (TylerPresident.com | FakeGov.com) |
Your AI system is now ready to intelligently adapt to user availability patterns! 🎉