Overview
SkyCast IA integrates with four external services:- OpenWeatherMap - Weather data and maps
- Groq - AI-powered weather analysis and chat
- Google reCAPTCHA - Chat security and bot protection
- GNews.io - Weather-related news articles
All services offer free tiers suitable for development and small-scale production use.
1. OpenWeatherMap API Key
OpenWeatherMap provides real-time weather data, forecasts, and map layers.Sign Up
- Visit https://openweathermap.org
- Click Sign Up in the top navigation
- Fill out the registration form
- Verify your email address
Get Your API Key
- Log in to your account
- Navigate to API keys section
- Your default API key will be displayed
- Click Generate to create a new key (optional)
- Copy the key
Add to Environment
Free Tier Limits
Maximum API calls per day on the free tier
Rate limit for API requests
Historical data is delayed by 3 hours on free tier
API Endpoints Used
SkyCast IA uses these OpenWeatherMap endpoints:GET /data/2.5/weather- Current weather by coordinates/cityGET /data/2.5/forecast- 5-day forecast (3-hour intervals)- Map tiles for weather layers (temperature, precipitation, clouds)
2. Groq API Key
Groq provides ultra-fast AI inference using the LLaMA 3.1 model for weather analysis and chat.Sign Up
- Visit https://console.groq.com
- Click Sign Up or Get Started
- Sign up with Google, GitHub, or email
- Complete the verification process
Get Your API Key
- Navigate to API Keys in the left sidebar
- Click Create API Key
- Name your key (e.g., “SkyCast IA Development”)
- Copy the key immediately (it won’t be shown again)
Add to Environment
Free Tier Limits
The model used by SkyCast IA for fast responses
Generous free tier with rate limits based on model and usage
SkyCast uses up to 150 tokens per chat response
Usage in SkyCast
AI Weather Analysis (src/lib/api/mistral.ts):
- Provides clothing/activity recommendations
- Analyzes weather conditions automatically
- Appears in the blue card on the main page
src/app/api/chat/route.ts):
- Answers user questions about weather
- Provides contextual advice based on real-time data
- Uses reCAPTCHA for security
3. Google reCAPTCHA Keys
reCAPTCHA v2 protects the chat feature from bots and abuse.Register Your Site
- Visit https://www.google.com/recaptcha/admin
- Log in with your Google account
- Click the + button to register a new site
Configure Site Settings
Enter a descriptive name (e.g., “SkyCast IA Chat”)
Select reCAPTCHA v2 > “I’m not a robot” Checkbox
Add your domains:
localhost(for development)- Your production domain (e.g.,
skycast.vercel.app)
Get Your Keys
After registration, you’ll receive two keys:- Site Key (public) - Used in the frontend
- Secret Key (private) - Used in the backend
Add to Environment
The example keys above are Google’s test keys. They always pass validation but should only be used for testing.
Testing reCAPTCHA
Test Keys (Development Only):- Site key:
6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI - Secret key:
6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
4. GNews API Key
GNews.io provides weather and environmental news articles.Sign Up
- Visit https://gnews.io
- Click Get API Key or Sign Up
- Create an account with email
- Verify your email address
Get Your API Key
- Log in to your account
- Navigate to the Dashboard
- Your API key will be displayed prominently
- Copy the key
Add to Environment
Free Tier Limits
Free tier allows 100 requests per day
Maximum articles returned per request (SkyCast uses 6)
SkyCast fetches Spanish-language news (default: Spanish)
Best Practices
API Key Security
API Key Security
DO:
- Store keys in
.env.localfor local development - Use environment variables in production (Vercel, Railway, etc.)
- Rotate keys periodically
- Use different keys for development and production
- Commit keys to Git repositories
- Share keys in chat, email, or screenshots
- Hardcode keys in source files
- Use production keys in development
Rate Limiting Strategy
Rate Limiting Strategy
To avoid hitting API rate limits:
- Cache responses where possible
- Debounce user input (search, autocomplete)
- Monitor usage through provider dashboards
- Implement backoff for failed requests
- Upgrade plans if limits are consistently hit
Key Rotation Checklist
Key Rotation Checklist
When rotating API keys:
- Generate new key from provider dashboard
- Update
.env.localfile - Test application locally
- Update production environment variables
- Deploy changes
- Verify production is working
- Revoke old key
- Document the change
Testing Your Setup
After configuring all API keys, verify they work:- Weather data loads for your location
- City search returns autocomplete results
- Weather map displays correctly
- AI analysis appears in the blue card
- reCAPTCHA widget loads in the chat
- Chat responds to questions
- News articles display (if available for your city)
Troubleshooting
401 Unauthorized Errors
401 Unauthorized Errors
reCAPTCHA Not Loading
reCAPTCHA Not Loading
Cause: Domain not whitelisted or incorrect site keySolutions:
- Add
localhostto allowed domains in reCAPTCHA admin - Verify
NEXT_PUBLIC_RECAPTCHA_SITE_KEYis correct - Check browser console for errors
- Clear browser cache
AI Analysis Not Appearing
AI Analysis Not Appearing
Cause: Missing or invalid Groq API keySolutions:
- Verify
GROQ_API_KEYin.env.local - Check server console for error messages
- Ensure the key has not been revoked
- Generate a new key if necessary
Next Steps
Environment Variables Reference
See the complete list of environment variables and their usage.
Deploy to Production
Learn how to deploy SkyCast IA with your API keys to Vercel.
