Call gpt-4o / gpt-4o-mini / DALL-E through a single spk_ key with USDC billing and unified receipts.
Letting Claude Code agents call GPT-4 as a fallback. Letting your tool fan out to multiple LLMs and bill end-users per call. Centralising OpenAI spend across multiple AI agents under one budget.
POST/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: $OPENAI_KEY' \
-H 'Content-Type: application/json' \
-d '{
"provider": "openai",
"path": "/v1/chat/completions",
"method": "POST",
"body": {
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "hello"
}
]
}
}'
import { proxy } from 'spawnpay-paywall';
const out = await proxy({
"provider": "openai",
"path": "/v1/chat/completions",
"method": "POST",
"body": {
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "hello"
}
]
},
"providerKey": process.env.OPENAI_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.