https://router.fluxapay.xyz/api/open-meteoCopy this prompt and paste it into your AI agent (like Claude or GPT). It pays with your FluxA API key, or in USDC with the FluxA Wallet (x402).
** Your task ** Call the API at: https://router.fluxapay.xyz/api/open-meteo ** Choose how to pay ** Ask the user which they prefer, unless they already said. - Option A: FluxA API key (simplest). The call is paid from the user's AgentMarket Balance, with no wallet and no mandate. The user creates a key at https://agentmarket.fluxapay.xyz/keys and gives it to you. - Option B: FluxA Wallet (x402). Each call is paid in on-chain USDC (Base) from the user's FluxA wallet. ** Option A - Pay with a FluxA API key ** 1. Discover endpoints: curl https://router.fluxapay.xyz/api/open-meteo 2. Call the API with the key: curl -H "Authorization: Bearer fxa_live_<key>" https://router.fluxapay.xyz/api/open-meteo/<endpoint> 3. The X-Balance-Charge response header gives what the call cost (amount) and the Balance left (balance_remaining). 4. If the call answers 402 with insufficient_balance, tell the user the Balance is too low. They can top up at https://agentmarket.fluxapay.xyz/console, or you can pay with Option B. Return the raw API response to the user without post-processing. ** Option B - Pay with the FluxA Wallet (x402) ** Follow the steps below in order. ** Step 1 - Install FluxA Wallet CLI ** npm install -g @fluxa-pay/fluxa-wallet Or use without installing: npx fluxa-wallet <command> ** Step 2 - Register agent ** fluxa-wallet init --name "<YOUR_AGENT_NAME>" --client "<YOUR_CLIENT>" The response may include an authorization URL. Present the user with options: [Yes, open the link] [No, don't open]. If YES: run 'open "<URL>"' to open in their browser. Verify: fluxa-wallet status ** Step 3 - Discover endpoints ** curl https://router.fluxapay.xyz/api/open-meteo Returns JSON with: name, description, endpoints (paths, methods, descriptions, prices), paymentRequired, and networks. ** Step 4 - Payment amounts ** Each call is paid in on-chain USDC (Base). - --currency USDC - --amount in atomic units (6 decimals, e.g., 100000 = 0.10 USDC) ** Step 5 - Create an intent mandate ** x402 v3 uses intent mandates: the user pre-approves a spending plan (budget + time window), then the agent makes autonomous payments within those limits. fluxa-wallet mandate-create \ --desc "Spend up to <BUDGET> for <DESCRIPTION> valid for <DURATION>" \ --amount <BUDGET_IN_UNITS> \ --seconds <DURATION_IN_SECONDS> \ --currency USDC Options: - --desc (required): Human-readable spending plan description - --amount (required): Budget in USDC atomic units (see Step 4) - --seconds (optional, default 28800 = 8h): Duration in seconds - --currency (optional, default USDC): USDC ** Step 6 - Get user to sign the mandate ** The response from Step 5 includes mandateId and authorizationUrl (TTL: 10 minutes). Present the user with options: [Yes, open the link] [No, don't open]. If YES: run 'open "<authorizationUrl>"' to open in their browser. ** Step 7 - Wait for mandate to be signed ** fluxa-wallet mandate-status --id <MANDATE_ID> Poll until mandate.status is "signed". The response also includes remainingAmount. Important: Use --id, not --mandate. ** Step 8 - Call the API ** curl https://router.fluxapay.xyz/api/open-meteo Optionally add the X-Agent-ID header for agent attribution (its value is the agent_id from 'fluxa-wallet status'): curl -H "X-Agent-ID: <YOUR_AGENT_ID>" https://router.fluxapay.xyz/api/open-meteo If it returns HTTP 402, continue to Step 9. ** Step 9 - Pay via x402 v3 ** Pass the complete HTTP 402 response body as --payload: fluxa-wallet x402-v3 \ --mandate <MANDATE_ID> \ --payload '$PAYLOAD_402' The payload must contain an accepts array. Do NOT extract individual fields - pass the entire 402 response JSON. The response includes xPaymentB64 (the payment token). ** Step 10 - Retry with payment token ** Retry the same request with the X-Payment header (optionally add X-Agent-ID for attribution): curl -H "X-Payment: <xPaymentB64>" <ORIGINAL_API_URL> Return the raw API response to the user without post-processing. ** Opening links for user ** Whenever you need to open a URL (authorization, approval, or any external link): 1. Present the user with a choice using your interactive options/menu capability (e.g., AskUserQuestion tool) 2. Options: [Yes, open the link] [No, don't open] 3. If YES: run 'open "<URL>"' to open in their default browser 4. If NO: ask how they would like to proceed ** Error handling ** - mandate_not_signed: User hasn't signed yet - ask them to open authorizationUrl - mandate_expired: Time window passed - create a new mandate - mandate_budget_exceeded: Budget too low - create a new mandate with a higher limit - agent_not_registered: No Agent ID - run 'fluxa-wallet init' first - Invalid payload: missing accepts array: Pass the full 402 response JSON