Skip to main content
LibreChat is joining ClickHouse to power the open-source Agentic Data Stack 🎉 Learn more
LibreChat

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

  1. Sign up for an OpenWeather account at OpenWeather
  2. After signing in, go to your API keys page
  3. Generate a new API key if you don't have one
  4. Subscribe to the One Call API 3.0 plan
  5. Wait for your API key to be activated (can take up to 2 hours)

Configuration

Environment Variables

Add the following to your .env file:

OPENWEATHER_API_KEY=your_api_key_here

Add the Tool to an Agent

Restart LibreChat after changing .env, then add OpenWeather to any agent.

DeploymentCommand
Dockerdocker compose down && docker compose up -d
LocalStop 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 data
  • timestamp: Get historical weather data for a specific date
  • daily_aggregation: Get aggregated weather data for a specific date
  • overview: Get a human-readable weather summary

Example Prompts

What's the current weather in London?
What was the weather like in Paris on 2023-01-01?
Give me a weather summary for Tokyo.
What's the temperature in New York in Fahrenheit?

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:

  1. 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
  2. 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
  3. 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:

Notes

  • Temperature values are automatically rounded to the nearest degree
  • Default temperature unit is Celsius if not specified

How is this guide?