OpenWeather
Configure the OpenWeather tool for LibreChat
The OpenWeather tool lets agents get weather data including current conditions, forecasts, historical data, and daily summaries using OpenWeather's One Call API 3.0.
Prerequisites
- An OpenWeather account
- An OpenWeather API key (specifically for the One Call API 3.0)
Getting an API Key
- Sign up for an OpenWeather account at OpenWeather
- After signing in, go to your API keys page
- Generate a new API key if you don't have one
- Subscribe to the One Call API 3.0 plan
- Wait for your API key to be activated (can take up to 2 hours)
Configuration
Environment Variables
Add the following to your .env file:
Add the Tool to an Agent
Restart LibreChat after changing .env, then add OpenWeather to any agent.
| Deployment | Command |
|---|---|
| Docker | docker compose down && docker compose up -d |
| Local | Stop the server, then run npm run backend again |
In LibreChat, select Agents, create or edit an agent, open the agent's Tools list, select OpenWeather, and save the agent.
Usage
The OpenWeather tool supports the following actions:
current_forecast: Get current weather and forecast datatimestamp: Get historical weather data for a specific datedaily_aggregation: Get aggregated weather data for a specific dateoverview: Get a human-readable weather summary
Example Prompts
Parameters
city: Name of the city (if lat/lon not provided)lat: Latitude coordinate (optional if city provided)lon: Longitude coordinate (optional if city provided)units: Temperature units ("Celsius", "Kelvin", or "Fahrenheit")lang: Language code for weather descriptions (e.g., "en", "fr", "es")date: Date in YYYY-MM-DD format (required for timestamp and daily_aggregation actions)tz: Timezone (optional, for daily_aggregation action)
Troubleshooting
Common issues and solutions:
-
403 Unauthorized Error
- Verify your API key is correct
- Check if your API key has been activated (wait 2 hours after creation)
- Ensure you have subscribed to the One Call API 3.0
-
City Not Found
- Check the spelling of the city name
- Try adding the country code (e.g., "London,UK")
- Use latitude and longitude coordinates instead
-
Invalid Date Format
- Ensure dates are in YYYY-MM-DD format
- Historical data is only available from 1979-01-01
- Future data is limited to 1.5 years ahead
API Limits
- Check your OpenWeather subscription for your specific limits
- Consider implementing rate limiting in high-traffic environments
Support
For issues with the tool:
- You may open an issue at https://github.com/jmaddington/LibreChat/issues or
- Check the LibreChat Issues
- Review OpenWeather's API documentation
- Contact OpenWeather support for API-specific issues
Notes
- Temperature values are automatically rounded to the nearest degree
- Default temperature unit is Celsius if not specified
How is this guide?