{"name":"Surplus Intelligence x402 Inference API","version":"3.0.0","description":"OpenAI-compatible inference marketplace with x402 pay-per-request access. Credit-package purchases are deprecated.","website":"https://www.surplusintelligence.ai","x402":{"version":2,"schemes":["upto","exact"],"preferredScheme":"upto","fallbackScheme":"exact","network":"eip155:8453","chainId":8453,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","assetSymbol":"USDC","payTo":"0x8581784D3E598cCa3482375CFF2409Ac9DD8c402","facilitator":"https://api.cdp.coinbase.com/platform/v2/x402","settlementContract":"0x0770d2124C0a581C28Cfc47a659817145e6Cc137","headers":{"required":"PAYMENT-REQUIRED","signature":"PAYMENT-SIGNATURE","response":"PAYMENT-RESPONSE"}},"inference":{"description":"Send a request without Authorization to receive a 402 challenge, sign the selected payment requirement, then resend with PAYMENT-SIGNATURE.","pricing":"Model-specific and market-based. The 402 challenge returns the final maximum amount in USDC micro-units. Upto settles actual usage; exact settles the estimate.","endpoints":{"chat/completions":{"path":"/x402/api/inference/v1/chat/completions","method":"POST","description":"OpenAI-compatible chat completions. Supports streaming and non-streaming responses."},"completions":{"path":"/x402/api/inference/v1/completions","method":"POST","description":"OpenAI-compatible legacy text completions."},"embeddings":{"path":"/api/inference/v1/embeddings","method":"POST","description":"OpenAI-compatible embeddings."},"images/generations":{"path":"/api/inference/v1/images/generations","method":"POST","description":"Image generation."},"audio/speech":{"path":"/api/inference/v1/audio/speech","method":"POST","description":"Text-to-speech."},"audio/transcriptions":{"path":"/api/inference/v1/audio/transcriptions","method":"POST","description":"Speech-to-text transcription."}},"models":"/x402/api/inference/v1/models","prices":"/api/inference/v1/prices","flow":["POST to an inference endpoint without Authorization.","Receive HTTP 402 with PAYMENT-REQUIRED and accepts[] payment requirements.","Prefer the upto scheme when supported; use exact as a compatibility fallback.","Sign the x402 payment and resend the same request with PAYMENT-SIGNATURE.","Receive the inference response and PAYMENT-RESPONSE settlement metadata."],"happyPath":{"endpoint":"https://www.surplusintelligence.ai/x402/api/inference/v1/chat/completions","requestBody":{"model":"llama-3.3-70b","messages":[{"role":"user","content":"Say exactly: pong"}],"max_tokens":8},"selectPaymentRequirement":"const upto = paymentRequired.accepts.find((a) => a.scheme === \"upto\")","retryHeader":"PAYMENT-SIGNATURE: base64(JSON.stringify(paymentPayload))","successSignals":["HTTP 200","PAYMENT-RESPONSE header present","OpenAI-compatible response body"]},"clientNotes":{"viemSigner":"When using @x402/evm directly with viem, pass a signer object with an explicit address. Do not pass a raw walletClient to toClientEvmSigner if walletClient.address is undefined.","permit2":"upto uses Permit2. The buyer wallet needs USDC Permit2 allowance for the x402 Upto Permit2 Proxy."}},"resources":{"description":"Non-inference paid upstream API resources. Sellers list Twitter API or Venice RPC capacity; agents discover and buy per request with x402.","endpoints":{"twitter_api":{"path":"/x402/api/twitter/v2/{...path}","method":"GET","description":"Read-only X/Twitter API v2 proxy backed by seller-supplied app-only bearer tokens. Sellers configure a discount/multiplier vs Twitter API prices. Write/action endpoints are intentionally not supported.","routeTemplates":["/x402/api/twitter/v2/tweets","/x402/api/twitter/v2/tweets/:tweetId","/x402/api/twitter/v2/tweets/search/recent","/x402/api/twitter/v2/tweets/search/all","/x402/api/twitter/v2/tweets/counts/recent","/x402/api/twitter/v2/tweets/counts/all","/x402/api/twitter/v2/tweets/:tweetId/quote_tweets","/x402/api/twitter/v2/users","/x402/api/twitter/v2/users/by/username/:username","/x402/api/twitter/v2/users/:userId","/x402/api/twitter/v2/users/:userId/tweets","/x402/api/twitter/v2/users/:userId/followers","/x402/api/twitter/v2/users/:userId/following","/x402/api/twitter/v2/trends/by/woeid/:woeid"],"examples":["/x402/api/twitter/v2/tweets?ids=123,456","/x402/api/twitter/v2/tweets/123","/x402/api/twitter/v2/tweets/search/recent?query=x402&max_results=10","/x402/api/twitter/v2/tweets/search/all?query=x402&max_results=10","/x402/api/twitter/v2/tweets/counts/recent?query=x402","/x402/api/twitter/v2/tweets/counts/all?query=x402","/x402/api/twitter/v2/tweets/123/quote_tweets?max_results=10","/x402/api/twitter/v2/users?ids=783214","/x402/api/twitter/v2/users/by/username/mac_eth","/x402/api/twitter/v2/users/783214","/x402/api/twitter/v2/users/783214/tweets?max_results=10","/x402/api/twitter/v2/users/783214/followers?max_results=100","/x402/api/twitter/v2/users/783214/following?max_results=100","/x402/api/twitter/v2/trends/by/woeid/1"]},"venice_rpc":{"path":"/x402/api/venice/crypto/rpc/{network}","method":"POST","description":"Venice crypto JSON-RPC proxy backed by seller-supplied Venice API keys. Sellers configure a proportion of Venice RPC prices.","routeTemplate":"/x402/api/venice/crypto/rpc/:network","supportedNetworks":["ethereum-mainnet","ethereum-sepolia","ethereum-holesky","base-mainnet","base-sepolia","arbitrum-mainnet","arbitrum-sepolia","optimism-mainnet","optimism-sepolia","polygon-mainnet","polygon-amoy","linea-mainnet","linea-sepolia","avalanche-mainnet","avalanche-fuji","bsc-mainnet","bsc-testnet","blast-mainnet","blast-sepolia","zksync-mainnet","zksync-sepolia","starknet-mainnet","starknet-sepolia"],"examples":["/x402/api/venice/crypto/rpc/ethereum-mainnet","/x402/api/venice/crypto/rpc/ethereum-sepolia","/x402/api/venice/crypto/rpc/ethereum-holesky","/x402/api/venice/crypto/rpc/base-mainnet","/x402/api/venice/crypto/rpc/base-sepolia","/x402/api/venice/crypto/rpc/arbitrum-mainnet","/x402/api/venice/crypto/rpc/arbitrum-sepolia","/x402/api/venice/crypto/rpc/optimism-mainnet","/x402/api/venice/crypto/rpc/optimism-sepolia","/x402/api/venice/crypto/rpc/polygon-mainnet","/x402/api/venice/crypto/rpc/polygon-amoy","/x402/api/venice/crypto/rpc/linea-mainnet","/x402/api/venice/crypto/rpc/linea-sepolia","/x402/api/venice/crypto/rpc/avalanche-mainnet","/x402/api/venice/crypto/rpc/avalanche-fuji","/x402/api/venice/crypto/rpc/bsc-mainnet","/x402/api/venice/crypto/rpc/bsc-testnet","/x402/api/venice/crypto/rpc/blast-mainnet","/x402/api/venice/crypto/rpc/blast-sepolia","/x402/api/venice/crypto/rpc/zksync-mainnet","/x402/api/venice/crypto/rpc/zksync-sepolia","/x402/api/venice/crypto/rpc/starknet-mainnet","/x402/api/venice/crypto/rpc/starknet-sepolia"]}},"markets":"/api/resource/markets","sellerOffers":"/api/resource/sellers/offers","pricing":"Twitter API pricing is derived from official per-resource costs. Venice RPC pricing is derived from Venice credit tiers. Seller multipliers/discounts are applied before the SI/x402 fee.","flow":["Call a resource endpoint without PAYMENT-SIGNATURE to receive an HTTP 402 challenge.","Sign one of the accepts[] payment requirements, preferably upto when supported.","Retry the same request with PAYMENT-SIGNATURE.","SI proxies the upstream API call through the selected seller key and settles seller payout from the operator wallet."]},"examples":{"typescriptUpto":"import { createPublicClient, createWalletClient, http, publicActions } from 'viem'\nimport { base } from 'viem/chains'\nimport { privateKeyToAccount } from 'viem/accounts'\nimport { UptoEvmScheme } from '@x402/evm'\n\nconst endpoint = 'https://www.surplusintelligence.ai/x402/api/inference/v1/chat/completions'\nconst account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`)\nconst publicClient = createPublicClient({ chain: base, transport: http() })\nconst walletClient = createWalletClient({ account, chain: base, transport: http() }).extend(publicActions)\n\n// Important: pass an explicit address. Do not rely on walletClient.address.\nconst signer = {\n  address: account.address,\n  signTypedData: (msg: any) => account.signTypedData(msg),\n  readContract: publicClient.readContract.bind(publicClient),\n  getTransactionCount: publicClient.getTransactionCount.bind(publicClient),\n  estimateFeesPerGas: publicClient.estimateFeesPerGas.bind(publicClient),\n}\n\nconst body = {\n  model: 'llama-3.3-70b',\n  messages: [{ role: 'user', content: 'Say exactly: pong' }],\n  max_tokens: 8,\n}\n\n// 1. Get the 402 challenge.\nconst challenge = await fetch(endpoint, {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/json' },\n  body: JSON.stringify(body),\n})\nconst paymentRequired = JSON.parse(\n  Buffer.from(challenge.headers.get('PAYMENT-REQUIRED')!, 'base64').toString(),\n)\nconst upto = paymentRequired.accepts.find((a: any) => a.scheme === 'upto')\n\n// 2. Sign the preferred upto payment requirement.\nconst paymentPayload = await new UptoEvmScheme(signer).createPaymentPayload(2, upto)\nconst paymentHeader = Buffer.from(JSON.stringify(paymentPayload)).toString('base64')\n\n// 3. Retry the same request with PAYMENT-SIGNATURE.\nconst paid = await fetch(endpoint, {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/json', 'PAYMENT-SIGNATURE': paymentHeader },\n  body: JSON.stringify(body),\n})\nconsole.log(paid.status, paid.headers.get('PAYMENT-RESPONSE'))\nconsole.log(await paid.json())"},"discovery":{"wellKnown":"/.well-known/x402.json","llmsTxt":"/llms.txt","robotsTxt":"/robots.txt","openapi":"/openapi.json","docs":"/api/docs/payments/x402"},"deprecations":{"/api/x402/purchase":{"status":"gone","httpStatus":410,"replacement":"/x402/api/inference/v1/chat/completions","note":"Venice credit-package purchases via x402 are deprecated and are no longer advertised for agent discovery."}}}