call_service
Invoke an API service and automatically pay per call using USDC. Direct wallet-to-provider transfer via LemonCake proxy.
Instructions
Invoke an upstream API service through LemonCake's pay-per-call proxy. Each successful call automatically debits USDC from your wallet via the permit you signed. LemonCake never holds your USDC β the transfer is direct wallet β provider on Base.
PRECONDITIONS:
β’ LEMON_CAKE_PERMIT env var must be set for real services. Get one in ~30 seconds at
https://lemoncake.xyz/start/v2 (sign in with Google, sign 1 EIP-712 permit, copy the blob).
If missing, the tool returns a structured PERMIT_MISSING error with how-to-fix steps.
β’ DEMO MODE: any serviceId starting with demo_ works WITHOUT a permit and hits real
free upstreams (Wikipedia / httpbin / Open-Meteo / Nominatim / MyMemory / dictionaryapi /
worldtimeapi / open.er-api). 8 demos cover search / echo / fx / translate / weather /
geocode / time / dictionary β useful for Glama Inspector or new-user trial. They are
marked with mode: "demo" and incur no charge.
β’ serviceId must come from list_services.
BEHAVIOR: β’ Returns the upstream response body verbatim (JSON or text), plus the X-Charge-Id and X-Amount-Usdc headers reported by the proxy. β’ HTTP 402 Payment Required is returned as a normal result (NOT thrown) so the agent can autonomously stop spending when the daily $25 permit cap is exhausted. β’ Pass the same idempotencyKey to retry safely without double-charging. β’ This tool spends real money and contacts an external service β it is non-idempotent by default and has external side effects.
x402-COMPATIBLE INTERFACE:
β’ Successful calls include an x402Receipt field with { scheme, chain, asset, amount,
recipient, paymentIntentId, settledAt }. Same shape as on-chain x402 receipts so the
agent's payment-handling logic is portable.
β’ If upstream returns an x402 challenge (WWW-Authenticate: x402, X-402-* headers, or
body.x402), it's parsed into x402Challenge for the agent to reason about.
β’ If upstream returns 202 + Retry-After + X-Payment-Status: pending, the result is
{ status: "PAYMENT_PENDING", paymentIntentId, retryAfterMs, retryContract }.
Re-call with the same idempotencyKey to resume β no double-charge.
Returns: { status, chargeId, amountUsdc, response, x402Receipt?, x402Challenge?, hint? }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | JSON request body (only used for POST/PUT/PATCH). | |
| path | No | Sub-path on the service (e.g. "/search", "/v1/completions"). Defaults to "/". | / |
| method | No | HTTP method to use against the service. Defaults to GET. | GET |
| serviceId | Yes | ID of the service to call (obtain from list_services). | |
| idempotencyKey | No | Optional idempotency key (UUID recommended). Identical keys within the proxy's retention window return the cached result without re-charging. |