aibank
API ReferenceGateway

Gateway Proxy

Proxy requests to upstream AI and data providers through a unified gateway.

Gateway Proxy

The gateway proxies requests to upstream providers, handling authentication, billing, and usage logging transparently. All gateway routes are under /v1/gateway/.

Authentication

Accepts either X-API-Key header or x402 payment (see x402 Payments).

Supported providers

ProviderGateway pathUpstream base URL
Anthropic/v1/gateway/anthropic/*https://api.anthropic.com
OpenAI/v1/gateway/openai/*https://api.openai.com
DeepSeek/v1/gateway/deepseek/*https://api.deepseek.com
Groq/v1/gateway/groq/*https://api.groq.com/openai
GetBlock/v1/gateway/getblock/:chainhttps://go.getblock.io
CoinGecko/v1/gateway/coingecko/*https://api.coingecko.com
Serper/v1/gateway/serper/*https://google.serper.dev

How it works

  1. You send a request to http://localhost:4000/v1/gateway/<provider>/<path>
  2. The gateway strips the prefix and forwards to the upstream provider
  3. Provider API keys are injected server-side (from environment variables)
  4. The response is returned as-is
  5. Usage is logged and credits deducted

Examples

Anthropic (Claude)

curl -X POST http://localhost:4000/v1/gateway/anthropic/v1/messages \
  -H "X-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-20250514",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'

OpenAI

curl -X POST http://localhost:4000/v1/gateway/openai/v1/chat/completions \
  -H "X-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

GetBlock (blockchain RPC)

curl -X POST http://localhost:4000/v1/gateway/getblock/eth \
  -H "X-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1}'

CoinGecko

curl http://localhost:4000/v1/gateway/coingecko/api/v3/simple/price?ids=bitcoin&vs_currencies=usd \
  -H "X-API-Key: ak_your_key"
curl -X POST http://localhost:4000/v1/gateway/serper/search \
  -H "X-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{"q": "aibank crypto payments"}'

Browser Shopping

The gateway also includes a browser automation endpoint for automated purchases:

curl -X POST http://localhost:4000/v1/gateway/shopping/buy \
  -H "X-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.saucedemo.com/inventory-item.html?id=4",
    "credentials": {"username": "standard_user", "password": "secret_sauce"},
    "shippingAddress": {"name": "John Doe", "zip": "12345"}
  }'

Errors

StatusCodeDescription
401UNAUTHORIZEDMissing or invalid API key (and no x402 payment)
402INSUFFICIENT_CREDITSNo credits remaining
402PAYMENT_REQUIREDx402 payment needed
503PROVIDER_NOT_CONFIGUREDProvider API key not set in environment

On this page