AkashiDocs

Run

POST /v1/run/{provider}/{endpoint} runs one tool with its input as the JSON body. Paid per call over x402; settled only on success.

POST /v1/run/{provider}/{endpoint}
content-type: application/json

The body is the tool's input, exactly as its input schema describes (inspect returns it). There is no wrapper object.

# returns 402 until paid
curl -si -X POST https://api.useakashi.xyz/v1/run/openweather/current \
  -H 'content-type: application/json' -d '{"city": "Lagos"}'

Payment flow

StepRequestResponse
1The input, no payment header402 with PAYMENT-REQUIRED: x402 v2, scheme exact, network eip155:84532, asset USDC (0x036CbD53842c5426634e7929541eC2318f3dCF7e), the exact amount and payTo 0x8164dabAfc824322221654ED421715FdaA66948D
2The same request with PAYMENT-SIGNATUREThe gateway verifies the signature, then runs the tool
3200: the run envelope, and PAYMENT-RESPONSE with the settlement on Base Sepolia
3Any other status: an error or a not-found envelope. The payment is not settled.

Use an x402 client for steps 1 and 2: @x402/fetch (From code (HTTP)), the CLI or the MCP server.

The gateway checks the input after it verifies the payment. A run with a bad input costs nothing, but it still takes a signature: inspect first.

Responses

StatusBodyCharged
200The run envelope, found: trueyes
402{}; the price is in PAYMENT-REQUIREDno
404The run envelope with found: false (the thing does not exist), or an unknown_endpoint errorno
400, 413, 422An error: invalid_json, payload_too_large, invalid_inputno
429, 502, 503, 504An error: provider_rate_limited, provider_error, output_contract, relay_failed, tool_unavailable, deadline_exceededno

An id that is not in the catalog answers 404 unknown_endpoint straight away, without a 402.

Response headers

HeaderValue
PAYMENT-RESPONSEOn a settled run: base64 JSON with success, transaction (the Base Sepolia hash), network and payer
X-Akashi-Viapocket when the run went through a Pocket relay, direct when the gateway called the backend itself
X-Akashi-EndpointThe tool id that ran, e.g. openweather/current

Example

node akashi.mjs run wikipedia/summary --input '{"title": "Alan Turing"}'

The body of that run:

{
  "service": "tool-router",
  "endpoint": "wikipedia/summary",
  "provider": "wikipedia",
  "status": "ok",
  "found": true,
  "billable": true,
  "cached": false,
  "as_of": "2026-10-07T12:07:17+00:00",
  "elapsed_ms": 1418,
  "price": { "usd": "0.001", "atomic": "1000", "tier": "local", "network": "eip155:84532" },
  "render": "page",
  "notes": [],
  "sources": [{ "name": "wikipedia", "status": "ok", "url": "https://en.wikipedia.org/api/rest_v1/page/summary/Alan_Turing", "licence": "CC BY-SA 4.0" }],
  "data": {
    "title": "Alan Turing",
    "description": "English computer scientist (1912–1954)",
    "markdown": "Alan Mathison Turing was an English mathematician and logician…",
    "url": "https://en.wikipedia.org/wiki/Alan_Turing",
    "wikidata_id": "Q7251",
    "lang": "en"
  }
}

Good practice

  • Inspect before the first run of a tool, and copy its example.
  • Split multi-source jobs into several small runs; run independent ones in parallel.
  • Retry only errors with retryable: true, after a pause.
  • Tell the user what a run cost when it matters (price.usd).

On this page