Get pay-as-you-go access to 200+ models (Llama 3, Mistral, Claude, GPT-4, …) under one spk_ key.
A single Spawnpay key gating every OpenRouter model. Cross-model A/B testing with one consolidated bill. Letting downstream agents pick the cheapest model that meets the latency target without separate billing relationships.
POST/api/v1/chat/completionsAuthorization$0.001 USDC per upstream 2xx (4xx is free)curl -X POST https://spawnpay.ai/api/proxy \
-H 'Authorization: Bearer spk_live_…' \
-H 'X-Provider-Key: $OPENROUTER_KEY' \
-H 'Content-Type: application/json' \
-d '{
"provider": "openrouter",
"path": "/api/v1/chat/completions",
"method": "POST",
"body": {
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "hello"
}
]
}
}'
import { proxy } from 'spawnpay-paywall';
const out = await proxy({
"provider": "openrouter",
"path": "/api/v1/chat/completions",
"method": "POST",
"body": {
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "hello"
}
]
},
"providerKey": process.env.OPENROUTER_KEY
});
console.log(out.status, out.body);
console.log('charged', out.charged); // txHash + $0.001 USDC receipt
The full upstream JSON body, the upstream status code, the upstream response headers, plus a charged field with the USDC receipt (tx hash) when the call succeeded.