Skip to main content
This guide walks you through obtaining API keys from each service provider used by SkyCast IA.

Overview

SkyCast IA integrates with four external services:
  1. OpenWeatherMap - Weather data and maps
  2. Groq - AI-powered weather analysis and chat
  3. Google reCAPTCHA - Chat security and bot protection
  4. 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

  1. Visit https://openweathermap.org
  2. Click Sign Up in the top navigation
  3. Fill out the registration form
  4. Verify your email address

Get Your API Key

  1. Log in to your account
  2. Navigate to API keys section
  3. Your default API key will be displayed
  4. Click Generate to create a new key (optional)
  5. Copy the key
API keys may take up to 2 hours to activate after creation. If you get 401 errors initially, wait and try again.

Add to Environment

NEXT_PUBLIC_OPENWEATHER_API_KEY=your_api_key_here

Free Tier Limits

Calls per day
number
default:"1,000"
Maximum API calls per day on the free tier
Calls per minute
number
default:"60"
Rate limit for API requests
Data delay
string
default:"3 hours"
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/city
  • GET /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

  1. Visit https://console.groq.com
  2. Click Sign Up or Get Started
  3. Sign up with Google, GitHub, or email
  4. Complete the verification process

Get Your API Key

  1. Navigate to API Keys in the left sidebar
  2. Click Create API Key
  3. Name your key (e.g., “SkyCast IA Development”)
  4. Copy the key immediately (it won’t be shown again)
Store your Groq API key securely. It cannot be retrieved after creation—you’ll need to generate a new one if lost.

Add to Environment

GROQ_API_KEY=gsk_your_api_key_here

Free Tier Limits

Model
string
default:"llama-3.1-8b-instant"
The model used by SkyCast IA for fast responses
Rate limits
string
Generous free tier with rate limits based on model and usage
Tokens per request
number
default:"150"
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
Interactive Chat (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

  1. Visit https://www.google.com/recaptcha/admin
  2. Log in with your Google account
  3. Click the + button to register a new site

Configure Site Settings

Label
string
Enter a descriptive name (e.g., “SkyCast IA Chat”)
reCAPTCHA type
string
default:"v2 Checkbox"
Select reCAPTCHA v2 > “I’m not a robot” Checkbox
Domains
string[]
Add your domains:
  • localhost (for development)
  • Your production domain (e.g., skycast.vercel.app)

Get Your Keys

After registration, you’ll receive two keys:
  1. Site Key (public) - Used in the frontend
  2. Secret Key (private) - Used in the backend

Add to Environment

# Public key (exposed to browser)
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI

# Secret key (server-side only)
RECAPTCHA_SECRET_KEY=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
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
Production: Always use your own keys in production environments.

4. GNews API Key

GNews.io provides weather and environmental news articles.

Sign Up

  1. Visit https://gnews.io
  2. Click Get API Key or Sign Up
  3. Create an account with email
  4. Verify your email address

Get Your API Key

  1. Log in to your account
  2. Navigate to the Dashboard
  3. Your API key will be displayed prominently
  4. Copy the key

Add to Environment

NEWS_API_KEY=your_gnews_api_key_here

Free Tier Limits

Requests per day
number
default:"100"
Free tier allows 100 requests per day
Articles per request
number
default:"10"
Maximum articles returned per request (SkyCast uses 6)
Languages
string
SkyCast fetches Spanish-language news (default: Spanish)

Best Practices

DO:
  • Store keys in .env.local for local development
  • Use environment variables in production (Vercel, Railway, etc.)
  • Rotate keys periodically
  • Use different keys for development and production
DON’T:
  • Commit keys to Git repositories
  • Share keys in chat, email, or screenshots
  • Hardcode keys in source files
  • Use production keys in development
To avoid hitting API rate limits:
  1. Cache responses where possible
  2. Debounce user input (search, autocomplete)
  3. Monitor usage through provider dashboards
  4. Implement backoff for failed requests
  5. Upgrade plans if limits are consistently hit
When rotating API keys:
  • Generate new key from provider dashboard
  • Update .env.local file
  • 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:
npm run dev
Test checklist:
  • 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

Cause: Invalid or inactive API keySolutions:
  • Wait 2 hours for newly created keys to activate (OpenWeatherMap)
  • Check for typos in .env.local
  • Verify the key is active in the provider dashboard
  • Ensure no extra spaces or quotes in the key
Cause: Domain not whitelisted or incorrect site keySolutions:
  • Add localhost to allowed domains in reCAPTCHA admin
  • Verify NEXT_PUBLIC_RECAPTCHA_SITE_KEY is correct
  • Check browser console for errors
  • Clear browser cache
Cause: Missing or invalid Groq API keySolutions:
  • Verify GROQ_API_KEY in .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.

Build docs developers (and LLMs) love