agentsvc.io

services / weather

dataoperational · 41 ms

Weather Data

Current weather plus daily forecast up to 16 days and optional hourly forecast up to 48 hours, worldwide. Current: temperature, feels like, humidity, wind and gusts, precipitation, cloud cover, pressure, conditions text. Daily: min/max, conditions, precipitation sum and probability, max wind, UV index, sunrise/sunset. Params: location (city name like 'Berlin' or 'lat,lon'), days (1 to 16, default 3), hours (0 to 48 hourly steps, default 0), units ('metric' default or 'imperial'). forecast_3d is kept for older clients.

Run free trial ↗3 free calls per day with the example input. Paid: $0.002 USDC, no limit.

Call it

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agentsvc.io/api/v1/proxy/weather", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"location":"Berlin"}),
});
const { data, payment } = await res.json();  // payment.transaction = on-chain receipt

Input

FieldTypeDescription
location *string = "Berlin"City name (e.g. 'Berlin'), or lat,lon string (e.g. '52.52,13.41'). Default: Berlin
daysinteger = 3Days of daily forecast
hoursinteger = 0Hourly forecast steps (0 = none)
unitsmetric | imperial = "metric"

Output

FieldTypeDescription
locationobject
currentobject
forecast_3darray3-day daily forecast

Example response (data)

{
  "location": {
    "name": "Berlin",
    "lat": 52.52,
    "lon": 13.41
  },
  "current": {
    "temp_c": 12.5,
    "feels_like_c": 10.2,
    "humidity_pct": 71,
    "wind_kph": 14.8,
    "weather_code": 3
  },
  "forecast_3d": [
    {
      "date": "2026-04-07",
      "temp_max_c": 14,
      "temp_min_c": 8.2,
      "weather_code": 1
    },
    {
      "date": "2026-04-08",
      "temp_max_c": 16.5,
      "temp_min_c": 9,
      "weather_code": 2
    },
    {
      "date": "2026-04-09",
      "temp_max_c": 13,
      "temp_min_c": 7.8,
      "weather_code": 61
    }
  ]
}