Setup
- Using @faremeter/rides
- Advanced Setup
Set up your payment handler in just 3 lines:
@faremeter/rides automatically detects your network, looks up USDC, and sets up payments using your existing wallet.
All examples below use payer.fetch().Example: Chat Completion with GPT-5
Call the RedPill chat completions endpoint with GPT-5:- Using @faremeter/rides
- Advanced Setup
- id: Unique identifier for this completion
- model: The model used for the completion
- choices: Array of completion choices (usually one)
- message: The assistant’s response with role and content
- usage: Token usage statistics for billing and monitoring
Payment Flow
When you make a request, the following happens automatically:- Initial Request: Client sends chat completion request
- 402 Response: Proxy returns payment requirements
- Payment: Payment handler processes USDC transfer (0.10 USDC)
- Success: Proxy fulfills original request with 200 OK
payer.fetch() or fetchWithPayer!