# Weather Forecast API for AI Agents: Hourly & Daily (MET Norway) (`emttn/weather-forecast`) Actor

Weather API for AI agents: give it coordinates and get the current weather, an hourly forecast and daily highs, lows and rain for each one, no weather API key needed, with MET Norway's attribution. Charged per location delivered; failed locations are free.

- **URL**: https://apify.com/emttn/weather-forecast.md
- **Developed by:** [Frameskim Tools](https://apify.com/emttn) (community)
- **Categories:** AI, Agents, Developer tools
- **Features:** Limited permissions, Multi-tenant, Server interface
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 location forecast delivereds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Weather Forecast for AI Agents

Give it coordinates and get, for each location and for AI agents, one clean item with the current weather, an hourly forecast and daily summaries: temperature, feels-like, humidity, wind and gusts, cloud cover, pressure, UV, precipitation and its probability, and a weather symbol. Built for AI agents and their tools: no account or key with the weather service, and every item carries its source and attribution. It is also an MCP server (`/mcp`) and HTTP API (`/forecast`) that returns one location's forecast per call, charged per location, without starting a run in your account (see Server interface below).

### How it works

- The forecast comes from [MET Norway](https://api.met.no)'s Locationforecast 2.0 (open data, CC BY 4.0 and NLOD 2.0), which covers the whole world.
- Coordinates are truncated to 4 decimals (about 10 m). Place names are not looked up: give `"lat,lon"`.
- `current` is the first point of the forecast (the current hour); `hourly` the next hours; `daily` each UTC day's low, high, total precipitation and highest chance of precipitation, from its four 6-hour blocks (`complete: false` when only part of the day is in the forecast, as today usually is).
- Times are UTC. `updatedAt` is when MET Norway made the forecast; `retrievedAt` is when this actor read it.
- Some values are only forecast for parts of the world (gusts and precipitation probability, mostly in Europe); elsewhere they are `null`.
- As MET Norway's terms ask, answers are cached in a key-value store named `weather-forecast-cache` in your own Apify account: a later run that asks for a location again before its forecast expires (at most a day later) is served from it, and an older one is checked for changes. Runs that overlap, or a run that cannot open, read or write that store, ask api.met.no directly. You can delete that store at any time; the actor creates it again when needed.

### What you get

```json
{
  "input": "59.9139,10.7522",
  "latitude": 59.9139,
  "longitude": 10.7522,
  "elevation": 8,
  "updatedAt": "2026-11-02T09:41:12Z",
  "retrievedAt": "2026-11-02T09:52:03Z",
  "units": {"temperature": "celsius", "precipitation": "mm", "windSpeed": "m/s", "windDirection": "degrees", "pressure": "hPa", "humidity": "%", "cloudCover": "%", "probability": "%", "uvIndex": "index"},
  "current": {"time": "2026-11-02T09:00:00Z", "temperature": 4.1, "feelsLike": 1.8, "humidity": 82.5, "dewPoint": 1.6, "cloudCover": 100, "pressure": 1009.4, "windSpeed": 3.2, "windGust": 7.9, "windDirection": 205.1, "uvIndexClearSky": 0.4, "precipitation": 0.3, "precipitationProbability": 54, "thunderProbability": 0, "symbol": "lightrain"},
  "hourly": [
    {"time": "2026-11-02T10:00:00Z", "temperature": 4.4, "feelsLike": 2.1, "humidity": 80.1, "dewPoint": 1.5, "cloudCover": 98.4, "pressure": 1009.1, "windSpeed": 3.4, "windGust": 8.2, "windDirection": 207.5, "uvIndexClearSky": 0.6, "precipitation": 0.1, "precipitationProbability": 41, "thunderProbability": 0, "symbol": "cloudy"}
  ],
  "daily": [
    {"date": "2026-11-02", "minTemperature": 2.9, "maxTemperature": 5.6, "precipitation": 1.4, "precipitationProbability": 60, "complete": false}
  ],
  "source": "MET Norway Locationforecast 2.0 (api.met.no)",
  "attribution": "Data from MET Norway (https://api.met.no), licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) and NLOD 2.0 (https://data.norge.no/nlod/en/2.0). Changed by Frameskim: reshaped into current, hourly and daily values. Not endorsed by MET Norway."
}
```

- A missing value is `null`. Units are in `units`; times are UTC.
- A location that could not be delivered has `input` and `error`, with the reason, and is not charged.
- The run's status message says how many locations were delivered and failed, and why the run stopped early, if it did.
- If nothing is delivered, the run still ends as succeeded: each location that failed is in the dataset with its `error`, the status message gives the first reason, and nothing was charged.

### Input

| Field | What it does |
|---|---|
| `locations` | From 1 to 100 coordinates, `"lat,lon"` in decimal degrees. |
| `hours` | From 0 to 48 (default 24): hourly points for each location. |
| `days` | From 0 to 10 (default 7): daily summaries for each location. |

### Limits

- 4 locations at a time. A run spaces its requests to the weather service, as its terms ask.
- Set a maximum charge per run to cap spending: the run stops before a location that would pass it.

### Pricing

This actor bills one event, nothing else:

- `forecast`: one per location delivered.

Locations that fail are not charged.

### Attribution

Data from MET Norway, licensed under CC BY 4.0 and NLOD 2.0, reshaped by this actor. Keep the item's `attribution` when you show or share the data. Weather Forecast for AI Agents is operated by Emttn LLC and is not affiliated with, endorsed by or sponsored by MET Norway (the Norwegian Meteorological Institute), Yr or NRK. Forecasts can be wrong; do not rely on them for safety decisions. Questions: support@frameskim.dev.

### Server interface (HTTP and MCP)

The actor is also a multi-tenant Server Actor: send a request to its server URL (on the Server tab) with your Apify API token in `Authorization: Bearer <token>` and get one location's forecast back at once, without starting a run. You pay only the `forecast` event of each location delivered; no run starts in your account.

- `GET /forecast?location=59.9139,10.7522` (optionally `&hours=24&days=7`) or `POST /forecast` with `{"location": "59.9139,10.7522", "hours": 24, "days": 7}`: `200` with the same item a run writes to its dataset. A location that cannot be delivered comes back as `422` with its `error`, and bad coordinates as `400`; neither is charged.
- `POST /mcp`: an MCP server (streamable HTTP, stateless) with one tool, `weather_forecast`, that takes `location`, `hours` and `days`. Add the MCP URL from the Server tab to your agent with your token as the bearer.
- Up to 6 seconds per request. When many server requests are reading api.met.no at once, or MET Norway asked to slow down, a request gets `422` and is not charged; retry in a few seconds or a minute. If your requests cost far more than the locations they deliver, they get `429` for a while; if the forecast cache cannot be reached, `503`. None of these is charged.
- As MET Norway's terms ask, server requests share a cache of MET Norway's answers in the actor owner's account (key-value stores `weather-forecast-server-cache-` and the date): each entry holds the coordinates asked (truncated to 4 decimals), MET Norway's answer and when it was read, which comes back as `retrievedAt`; never who asked. Each day's store is deleted shortly after the next day ends. The server's log has only the method, route and status of each request and short status and error lines, never the coordinates or who asked.

### Terms and privacy

You are responsible for keeping that attribution and for complying with CC BY 4.0 and NLOD 2.0 when you show, share or reuse the data. The coordinates you give are sent to api.met.no, truncated to 4 decimals, with no data about you; in a run, the cache and the items stay in your own Apify account, where you can delete them (the server interface keeps its cache as described above). Terms: https://frameskim.dev/terms. Privacy: https://frameskim.dev/privacy.

# Actor input Schema

## `locations` (type: `array`):

Coordinates as "lat,lon" in decimal degrees (for example "-34.6037,-58.3816"), from 1 to 100. They are truncated to 4 decimals (about 10 m); place names are not looked up.

## `hours` (type: `integer`):

How many hourly points each location gets, from 0 to 48.

## `days` (type: `integer`):

How many daily summaries (UTC days) each location gets, from 0 to 10.

## `failWhenEmpty` (type: `boolean`):

Internal: the run ends as failed, instead of succeeded with error items, when no forecast is delivered. Used by health checks.

## Actor input object example

```json
{
  "locations": [
    "40.7128,-74.0060",
    "-34.6037,-58.3816"
  ],
  "hours": 24,
  "days": 7,
  "failWhenEmpty": false
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items: input, latitude, longitude, elevation, updatedAt, retrievedAt, units, current, hourly, daily, source and attribution; locations that could not be delivered carry an error and are not charged.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "locations": [
        "40.7128,-74.0060",
        "-34.6037,-58.3816"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("emttn/weather-forecast").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "locations": [
        "40.7128,-74.0060",
        "-34.6037,-58.3816",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("emttn/weather-forecast").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "locations": [
    "40.7128,-74.0060",
    "-34.6037,-58.3816"
  ]
}' |
apify call emttn/weather-forecast --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,emttn/weather-forecast"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/RHqTMRU6DxoCmGryl/builds/K8rLVGdE7G4fRY8fE/openapi.json
