Anthropic via Spawnpay

Route Claude Opus, Sonnet, and Haiku through Spawnpay with the same billing pipeline as every other paid tool.

BYOK $0.001 / 2xx No reselling — your upstream relationship stays exactly as it is.

Why route through Spawnpay

Building agents that fall back from local Claude Code → hosted Claude API. Multi-tenant tools that bill per token-equivalent in USDC. A unified receipt log so finance can reconcile across providers.

Endpoint

Method
POST
Upstream path
/v1/messages
Upstream auth
x-api-key
Auth note
X-Provider-Key is forwarded as the raw x-api-key header upstream. anthropic-version=2023-06-01 is injected automatically.
Routing fee
$0.001 USDC per upstream 2xx (4xx is free)
Provider docs

curl

curl -X POST https://spawnpay.ai/api/proxy \
  -H 'Authorization: Bearer spk_live_…' \
  -H 'X-Provider-Key: $ANTHROPIC_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "provider": "anthropic",
  "path": "/v1/messages",
  "method": "POST",
  "body": {
    "model": "claude-haiku-4-5-20251001",
    "max_tokens": 256,
    "messages": [
      {
        "role": "user",
        "content": "hello"
      }
    ]
  }
}'

Node (spawnpay-paywall)

import { proxy } from 'spawnpay-paywall';

const out = await proxy({
  "provider": "anthropic",
  "path": "/v1/messages",
  "method": "POST",
  "body": {
    "model": "claude-haiku-4-5-20251001",
    "max_tokens": 256,
    "messages": [
      {
        "role": "user",
        "content": "hello"
      }
    ]
  },
  "providerKey": process.env.ANTHROPIC_KEY
});

console.log(out.status, out.body);
console.log('charged', out.charged); // txHash + $0.001 USDC receipt

What you get back

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.

▶ Try Anthropic live → 60-sec quickstart All providers