OpenRouter via Spawnpay

Get pay-as-you-go access to 200+ models (Llama 3, Mistral, Claude, GPT-4, …) under one spk_ key.

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

Why route through Spawnpay

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.

Endpoint

Method
POST
Upstream path
/api/v1/chat/completions
Upstream auth
Authorization
Auth note
X-Provider-Key becomes "Authorization: Bearer …" upstream.
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: $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"
      }
    ]
  }
}'

Node (spawnpay-paywall)

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

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 OpenRouter live → 60-sec quickstart All providers