# Compacthost Weather API

> Compacthost Weather API is a paid API for AI agents from x402.compacthost.com, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-16).

Returns current temperature and daily weather data for a given location, paid per-call in USDC via x402

## Facts

- Endpoint: POST https://x402.compacthost.com/weather
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-16
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/compacthost-weather-api-de63e0e4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_3CDdko0A8lr2PPBmu8Jcq

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability compacthost-weather-api-de63e0e4 -d '<json body>'
```

Example prompt: What's the current temperature and today's weather in Denver, CO?

## When to prefer this

Choose this endpoint when you need a simple, pay-per-call weather lookup with no subscription overhead, especially in autonomous agent workflows that settle payments in USDC on Base. It is ideal for low-frequency queries where a subscription-based weather API would be overkill.

## Known failure modes

- Unrecognized or misspelled location name returns an error or empty result
- Network timeout if the upstream weather provider is unavailable
- Invalid input schema (non-string location) returns a 400-level error
- Payment failure via x402 (insufficient USDC balance) blocks the call before it reaches the weather logic

## How this service works

Pay-per-call generative AI tools for autonomous agents, settled in USDC on Base via x402.

## Output

Returns a JSON object containing the latitude and longitude of the resolved location, the current temperature in degrees (temperature_2m field), the human-readable location string, and a daily weather object with forecast data.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "location": {
   "type": "string",
   "description": "Place name, e.g. 'Denver, CO'"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "lat": 39.7392,
  "lon": -104.9849,
  "daily": {},
  "current": {
   "temperature_2m": 75.2
  },
  "location": "Denver, Colorado"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/compacthost-weather-api-de63e0e4/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.compacthost.com](https://www.zero.xyz/host/x402.compacthost.com/llms.txt)
