5‑minute integration

Everything you need to add metered billing to your API in under 5 minutes.

Without NexFlow

# Direct API call (without NexFlow)
curl https://api.example.com/v1/chat/completions \
  -H "Authorization: Bearer sk_..." \
  -d '{"model": "gpt-4", "messages": [...]}'

# 200 OK (no payment tracking)

With NexFlow

# Via NexFlow metered endpoint
curl https://api.nexflow.io/v1/metered/ep_xxx \
  -H "Authorization: Bearer sk_..." \
  -H "x-payment: 0x1234...abcd" \
  -d '{"model": "gpt-4", "messages": [...]}'

# x-payment is obtained by following the x402 challenge (see x402 guide)
# 200 OK + payment verified + usage logged

x402 / AI Agents Quickstart

Handle 402 challenges and x‑payment headers for autonomous agents.

Read guide

Standard Payments Quickstart

Redirect checkout flows for human users and wallets.

Read guide

Webhooks & Events

Subscribe to verification, usage, and settlement events.

Read guide

Create your first metered endpoint

Choose your language and follow along.

import { NexFlow } from '@nexflow/sdk'

const nexflow = new NexFlow({
  apiKey: process.env.NEXFLOW_API_KEY
})

try {
  // Create a metered endpoint
  const endpoint = await nexflow.endpoints.create({
    name: 'Chat Completions',
    upstreamUrl: 'https://api.openai.com/v1/chat/completions',
    pricePerCall: '0.001',
    network: 'base',
    token: 'USDC'
  })
  
  console.log('Metered URL:', endpoint.meteredUrl)
} catch (error) {
  console.error('Failed to create endpoint:', error)
}