call_service
Invoke any registered API service through a pay-per-call proxy. Each call auto-charges USDC from your Pay Token and returns the upstream response with charge details.
Instructions
Invoke an upstream API service through LemonCake's pay-per-call proxy. Each successful call automatically charges USDC against your configured Pay Token.
PRECONDITIONS: • LEMON_CAKE_PAY_TOKEN env var must be set. If missing, the tool returns a structured CREDENTIAL_MISSING error (not a thrown exception) with how-to-fix steps. • 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 Pay Token's limitUsdc 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.
Returns: { status, chargeId, amountUsdc, response }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serviceId | Yes | ID of the service to call (obtain from list_services). | |
| 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 |
| body | No | JSON request body (only used for POST/PUT/PATCH). | |
| idempotencyKey | No | Optional idempotency key (UUID recommended). Identical keys within the proxy's retention window return the cached result without re-charging. |