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
| Provider | Gateway path | Upstream 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/:chain | https://go.getblock.io |
| CoinGecko | /v1/gateway/coingecko/* | https://api.coingecko.com |
| Serper | /v1/gateway/serper/* | https://google.serper.dev |
How it works
- You send a request to
http://localhost:4000/v1/gateway/<provider>/<path> - The gateway strips the prefix and forwards to the upstream provider
- Provider API keys are injected server-side (from environment variables)
- The response is returned as-is
- 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"Serper (Google Search)
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
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid API key (and no x402 payment) |
| 402 | INSUFFICIENT_CREDITS | No credits remaining |
| 402 | PAYMENT_REQUIRED | x402 payment needed |
| 503 | PROVIDER_NOT_CONFIGURED | Provider API key not set in environment |