API Reference

All routes are protected by x402. Mainnet routes live at the root path. Testnet mirrors weather under /testnet. AI services are mainnet only.

GET /weather/current
mainnet $0.01 USD

Current weather conditions for a latitude and longitude.

request
curl "https://xlm402.com/weather/current?latitude=51.5072&longitude=-0.1276&timezone=auto"
  • latitude
  • longitude
  • timezone=auto
GET /testnet/weather/current
testnet $0.01 USD

Current weather conditions for a latitude and longitude.

request
curl "https://xlm402.com/weather/current?latitude=51.5072&longitude=-0.1276&timezone=auto"
  • latitude
  • longitude
  • timezone=auto
GET /weather/forecast
mainnet $0.01 USD

Forecast weather data with optional daily and hourly field selection.

request
curl "https://xlm402.com/weather/forecast?latitude=51.5072&longitude=-0.1276&daily=temperature_2m_max,temperature_2m_min,precipitation_sum&forecast_days=5&timezone=auto"
  • latitude
  • longitude
  • daily=comma,separated,fields
  • hourly=comma,separated,fields
  • forecast_days=1..16
  • timezone=auto
GET /testnet/weather/forecast
testnet $0.01 USD

Forecast weather data with optional daily and hourly field selection.

request
curl "https://xlm402.com/weather/forecast?latitude=51.5072&longitude=-0.1276&daily=temperature_2m_max,temperature_2m_min,precipitation_sum&forecast_days=5&timezone=auto"
  • latitude
  • longitude
  • daily=comma,separated,fields
  • hourly=comma,separated,fields
  • forecast_days=1..16
  • timezone=auto
GET /weather/archive
mainnet $0.01 USD

Historical archive weather data across a date range.

request
curl "https://xlm402.com/weather/archive?latitude=40.7128&longitude=-74.0060&start_date=2026-03-01&end_date=2026-03-07&daily=temperature_2m_max,temperature_2m_min,precipitation_sum&timezone=auto"
  • latitude
  • longitude
  • start_date=YYYY-MM-DD
  • end_date=YYYY-MM-DD
  • daily=comma,separated,fields
  • hourly=comma,separated,fields
  • timezone=auto
GET /testnet/weather/archive
testnet $0.01 USD

Historical archive weather data across a date range.

request
curl "https://xlm402.com/weather/archive?latitude=40.7128&longitude=-74.0060&start_date=2026-03-01&end_date=2026-03-07&daily=temperature_2m_max,temperature_2m_min,precipitation_sum&timezone=auto"
  • latitude
  • longitude
  • start_date=YYYY-MM-DD
  • end_date=YYYY-MM-DD
  • daily=comma,separated,fields
  • hourly=comma,separated,fields
  • timezone=auto
GET /weather/history-summary
mainnet $0.01 USD

Compact summary view over an archive range with hottest, coldest, and precipitation totals.

request
curl "https://xlm402.com/weather/history-summary?latitude=40.7128&longitude=-74.0060&start_date=2026-03-01&end_date=2026-03-07&timezone=auto"
  • latitude
  • longitude
  • start_date=YYYY-MM-DD
  • end_date=YYYY-MM-DD
  • timezone=auto
GET /testnet/weather/history-summary
testnet $0.01 USD

Compact summary view over an archive range with hottest, coldest, and precipitation totals.

request
curl "https://xlm402.com/weather/history-summary?latitude=40.7128&longitude=-74.0060&start_date=2026-03-01&end_date=2026-03-07&timezone=auto"
  • latitude
  • longitude
  • start_date=YYYY-MM-DD
  • end_date=YYYY-MM-DD
  • timezone=auto
POST /chat/respond
mainnet $0.05 USD

Text inference endpoint for prompts, system instructions, and output controls.

request
{
  "prompt": "Write a landing page headline for a premium weather API on Stellar.",
  "system": "Be concise and commercial.",
  "reasoning_effort": "medium"
}
  • prompt: string
  • system?: string
  • max_output_tokens?: integer 64..4096
  • reasoning_effort?: minimal | low | medium | high
  • metadata?: object<string,string>
POST /image/generate
mainnet $0.10 USD

Prompt-to-image generation that returns a base64-encoded image payload.

request
{
  "prompt": "A cinematic satellite view of a storm front above the Atlantic, premium editorial style",
  "size": "1536x1024",
  "quality": "high",
  "output_format": "jpeg"
}
  • prompt: string
  • size?: auto | 1024x1024 | 1536x1024 | 1024x1536
  • quality?: auto | low | medium | high
  • background?: auto | opaque | transparent
  • output_format?: jpeg | png | webp
  • moderation?: auto | low

Discovery & Payment Flow

  • /.well-known/x402 returns the published route list with price, network, and pay-to metadata.
  • /supported returns facilitator support by network so clients can inspect enabled schemes.
  • 402 responses include network-specific payment requirements for the route requested.
  • Chat and image services activate automatically when OPENAI_API_KEY is configured.

Configuration

  • Text model: gpt-5.4
  • Image model: gpt-image-1.5
  • Base URL: https://xlm402.com
  • AI services: Enabled