agentsvc.io

services / weather

dataoperational · 43 ms

Weather Data

Real-time weather + 3-day forecast. Returns current (temp_c, feels_like_c, humidity_pct, wind_kph, weather_code) and forecast_3d array. Pass location as city name ('Berlin') or GPS string ('52.52,13.41'). WMO codes: 0=clear, 1-3=cloudy, 45-48=fog, 51-67=rain, 71-77=snow, 95-99=thunderstorm.

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

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
    }
  ]
}