Openweather API
On this page
The OpenWeather API returns current conditions, forecasts, and historical weather for a location through HTTP endpoints, and every request needs an API key. An AI agent can use it once those endpoints are exposed as MCP tools, so the model can request weather data without custom glue code. This guide covers the endpoint types, a first request, and how to choose between a direct integration and an MCP gateway.
What the OpenWeather API covers
OpenWeather documents its weather products at https://openweathermap.org/api. The core endpoints fall into three groups.
- Current weather for a location.
- Forecast data for upcoming hours and days.
- Historical observations for past dates.
Each endpoint accepts a location as a city name, a latitude and longitude pair, or another location identifier. The endpoint then returns a JSON object. The fields and their names differ by endpoint, so read the documentation for each one before you parse it.
Temperature units depend on a units parameter. Set it on every request. Otherwise the response uses the default unit, and your agent may misreport the temperature.
Make a first request
Create an API key in your OpenWeather account. Store the key in an environment variable or a secrets manager, and keep it out of source control.
Send the key in the appid parameter. The following request asks for current weather in London in Celsius. The key appears as a placeholder.
curl 'https://api.openweathermap.org/data/2.5/weather?q=London&units=metric&appid=YOUR_API_KEY'
The response is a JSON object. Fields such as main.temp and weather hold the values most agents need. Parse the fields your workflow uses and discard the rest. The model then receives a short, relevant result.
Why agents need a tool layer
A language model cannot send an HTTP request on its own. The host application runs the request and returns the result to the model.
The Model Context Protocol standardizes that handoff. An MCP server describes each tool with a name, a description, and an input schema. The model reads that description, chooses a tool, and passes arguments that match the schema.
Without a tool layer, each team writes its own wrapper. The wrapper handles the key, the units parameter, error responses, and retries. Each wrapper then needs updates when the upstream API changes, and the copies drift apart over time.
Direct integration or an MCP gateway
A direct integration gives you full control. You own the key, the cache, and the error handling. This route suits one service that calls weather data in one place.
An MCP gateway puts upstream endpoints behind a tool interface that any MCP-compatible client can call. The gateway holds the credentials and returns results in a shape the model can read. This route suits agents that combine weather with other data sources.
Compare the two routes on three points.
- Key handling: a direct integration stores the key in your code, while a gateway stores it on the server side.
- Caching and rate limits: a direct integration enforces its own cache, while a gateway applies its limits to every client that shares the tool.
- Error handling: a direct integration needs your own retry logic, while a gateway can return a consistent error shape to the model.
Where APIbase fits
APIbase is an MCP gateway with a large and growing catalog of tools across many categories, and weather is one of them. Each tool wraps an upstream API, so an agent calls it through MCP without a separate integration for each provider.
APIbase plans range from 0 to 29.99 USD. Check the current plan details before you commit. The upstream OpenWeather plan limits still apply to the requests the gateway forwards.
Caveats before you build
Plan on three constraints before you ship an agent that calls weather data.
- Rate limits depend on your OpenWeather plan. Read the plan terms on the OpenWeather site before you size request volume.
- Current and forecast data update on the provider's schedule. Cache responses for a short period instead of calling the endpoint on every model turn.
- Historical data may require a different plan or endpoint. Confirm access for the exact dates your agent needs.
Test the units parameter with the real client before launch. A mismatch between Celsius and Fahrenheit causes errors that look like correct output.
Live pricing — weather
Data source: live tool catalog snapshot, fetched 2026-11-01.
Chart data as a table
| Tool | Price per call | Cache-hit price |
|---|---|---|
| Current AQI by Coordinate (AirNow) | $0.001 | $0.0001 |
| Current AQI by ZIP (AirNow) | $0.001 | $0.0001 |
| Aviation Weather — METAR Observation | $0.001 | $0.0001 |
| Aviation Weather — Pilot Reports (PIREPs) | $0.001 | $0.0001 |
| Aviation Weather — Station Lookup | $0.001 | $0.0001 |
| Aviation Weather — TAF Forecast | $0.001 | $0.0001 |
| Aviation METAR Weather Report | $0.001 | $0.0001 |
| Bright Sky — DWD Severe Weather Alerts for Germany | $0.001 | $0.0001 |
| Bright Sky — Current Weather in Germany | $0.001 | $0.0001 |
| Bright Sky — Find Nearby DWD Weather Stations | $0.001 | $0.0001 |
| CheckWX Station Information | $0.001 | $0.0001 |
| NOAA CO-OPS — Marine Meteorological Conditions | $0.001 | $0.0001 |
| Tool | Provider | Price/call | Cache-hit |
|---|---|---|---|
| Current AQI by Coordinate (AirNow) | airnow | $0.001 | $0.0001 |
| Current AQI by ZIP (AirNow) | airnow | $0.001 | $0.0001 |
| Aviation Weather — METAR Observation | aviationweather | $0.001 | $0.0001 |
| Aviation Weather — Pilot Reports (PIREPs) | aviationweather | $0.001 | $0.0001 |
| Aviation Weather — Station Lookup | aviationweather | $0.001 | $0.0001 |
| Aviation Weather — TAF Forecast | aviationweather | $0.001 | $0.0001 |
| Aviation METAR Weather Report | awc | $0.001 | $0.0001 |
| Bright Sky — DWD Severe Weather Alerts for Germany | brightsky | $0.001 | $0.0001 |
| Bright Sky — Current Weather in Germany | brightsky | $0.001 | $0.0001 |
| Bright Sky — Find Nearby DWD Weather Stations | brightsky | $0.001 | $0.0001 |
| CheckWX Station Information | checkwx | $0.001 | $0.0001 |
| NOAA CO-OPS — Marine Meteorological Conditions | coops | $0.001 | $0.0001 |
Connect via MCP
$ curl -X POST https://apibase.pro/api/v1/tools/airnow.current_latlng/call \
-H "Content-Type: application/json" -d '{"params": {}}'FAQ
Is the OpenWeather API free to use?
OpenWeather offers a free access tier alongside paid plans. Check https://openweathermap.org/api for current terms, because tier limits and included endpoints change over time.
Do I need an API key for OpenWeather?
Yes. Every request to the OpenWeather endpoints must include an API key in the appid parameter.
Can an AI agent call OpenWeather directly?
Not on its own. The host application sends the HTTP request and passes the result back to the model. An MCP tool layer handles that handoff.
What does an MCP route add over a direct call?
It gives the agent a named tool with an input schema, so the model can request weather lookups without custom prompt code. The gateway also keeps the API key on the server side.
Which units should I request?
Pass units=metric for Celsius and metres per second. Pass units=imperial for Fahrenheit and miles per hour. If you omit the parameter, the response uses Kelvin.
Recommended next step
- STEP 1/2 Connect your MCP client
- STEP 2/2 Browse the full catalog
Related guides
Published: 2026-11-01Source: live apibase.pro catalog snapshot