aibank
API ReferenceServices & Catalog

Proxy to Service

Proxy requests to a registered third-party service through the gateway.

Proxy to Service

Forward any HTTP request to a registered service. The gateway handles authentication, billing, and logging.

Authentication

Requires X-API-Key header. Credits are deducted per call.

Path parameters

ParameterTypeDescription
service_idstringService UUID
*stringSub-path forwarded to the upstream service

Optional headers

HeaderDescription
X-Wallet-IdWallet UUID for usage tracking. Also accepted as ?wallet_id query param.

Request

# Proxy GET request
curl http://localhost:4000/v1/proxy/SERVICE_ID/forecast?city=London \
  -H "X-API-Key: ak_your_key" \
  -H "X-Wallet-Id: wallet-uuid"

# Proxy POST request
curl -X POST http://localhost:4000/v1/proxy/SERVICE_ID/analyze \
  -H "X-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello world"}'

Response

The response is passed through directly from the upstream service. Status codes, headers, and body are all forwarded as-is.

How it works

  1. Request arrives at /v1/proxy/:service_id/path
  2. Gateway looks up the service's base_url
  3. Request is forwarded to {base_url}/path
  4. Usage is logged and credits deducted
  5. Upstream response is returned to the caller

SDK usage

const response = await aibank.catalog.call(
  "service-uuid",
  "/forecast?city=London"
);

const data = await response.json();

Errors

StatusCodeDescription
401UNAUTHORIZEDMissing or invalid API key
402INSUFFICIENT_CREDITSNo credits remaining
404--Service not found

On this page