{"id":"4780e6ab-c2f0-4c88-9129-4d7f742677fc","entityType":"agent","slug":"clawhub-ivaavimusic-x402-layer","name":"x402 Singularity Layer","canonicalUrl":"https://www.xpersona.co/agent/clawhub-ivaavimusic-x402-layer","canonicalPath":"/agent/clawhub-ivaavimusic-x402-layer","generatedAt":"2026-10-09T14:46:33.371Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"description":"This skill should be used when the user asks to \"create x402 endpoint\", \"deploy monetized API\", \"pay for API with USDC\", \"check x402 credits\", \"consume API c...","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.7K downloads reported by the source. Last updated 4/15/2026.","installCommand":"clawhub skill install kn73xndw522wt8y06avyd39a8h7ztbeh:x402-layer","sourceUrl":"https://clawhub.ai/ivaavimusic/x402-layer","homepage":"https://clawhub.ai/ivaavimusic/x402-layer","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/ivaavimusic/x402-layer","kind":"source"}],"safetyScore":84,"overallRank":62,"popularityScore":64,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"x402 Singularity Layer technical dossier on Xpersona with agent coverage, OPENCLEW support, and live trust metadata."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"stars":null,"forks":null,"downloads":1665,"packageName":null,"latestVersion":"1.2.1","tractionLabel":"1.7K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-02-28T20:46:03.876Z","emptyReason":null},"lastUpdatedAt":"2026-04-15T00:45:39.800Z","lastCrawledAt":"2026-02-28T20:46:03.876Z","lastIndexedAt":null,"nextCrawlAt":"2026-03-01T20:46:03.876Z","lastVerifiedAt":null,"highlights":[{"version":"1.2.1","createdAt":"2026-02-27T13:19:27.315Z","changelog":"v1.2.1 (2026-02-27) Agentic Webhooks Expanded from 1 to 4 event types Event Types - payment.succeeded Fires on any payment for your endpoint (unchanged) - credits.depleted Fires when endpoint.owner_credits hits 0 Signals that a top-up is required before users receive 503 errors - credits.low Fires when credits drop to 100 or below Early warning to top up proactively - credits.recharged Fires after a successful top-up Returns credits_added, previous_balance, new_balance Technical - Refactored dispatchEndpointWebhook to a generic (eventType, data) signature - credits.depleted and credits.low fire at the per-request deduction site (post-RPC) - credits.recharged fires alongside payment.succeeded on the top-up path - All events use the same HMAC-SHA256 signing as payment.succeeded Documentation - SKILL.md updated with an event type table and example payloads","fileCount":26,"zipByteSize":42328},{"version":"1.2.0","createdAt":"2026-02-27T09:03:06.877Z","changelog":"v1.2.0 (2026-02-27) -------------------- NEW: Agentic Webhooks - endpoint-level payment notifications - Agents can now receive payment.succeeded events at their own HTTPS URL - No user account or Pro plan required - works purely via API key - Webhook fires on: credit purchase, direct payment, top-up NEW SCRIPT: manage_webhook.py - manage_webhook.py set <slug> <url> — add or update webhook - manage_webhook.py remove <slug> — remove webhook - manage_webhook.py info <slug> — check if webhook is configured UPDATED: create_endpoint.py - New --webhook-url flag: set a webhook at endpoint creation time - Returns signing_secret in response (shown once, save immediately) Backend API: - POST /agent/endpoints: add webhook_url in body - PATCH /agent/endpoints?slug=X: set/update/remove webhook after creation Requires: X-API-Key header (from creation response) Body: {\"webhook_url\": \"https://...\"} or {\"webhook_url\": null} Webhook signature verification: HMAC-SHA256 over \"timestamp.body\" using your signing_secret Header: X-X402-Signature: t=<ts>,v1=<hex> Event format: { \"id\": \"<uuid>\", \"type\": \"payment.succeeded\", \"created_at\": \"<iso8601>\", \"data\": { \"source\": \"endpoint\", \"source_slug\": \"my-api\", \"amount\": 0.01, \"currency\": \"USDC\", \"tx_hash\": \"0x...\", \"payer_wallet\": \"0x...\", \"network\": \"base\", \"status\": \"confirmed\" } } Credits note: when endpoint credits = 0, no requests go through, so no payments happen and no webhook events fire. Backward compatible: all existing endpoints unaffected (webhook_url defaults to null, events fire only when webhook_url is set).","fileCount":26,"zipByteSize":42062},{"version":"1.1.3","createdAt":"2026-02-24T19:42:16.752Z","changelog":"x402-layer 1.1.3 - Updated pricing for endpoint creation: now $1 (was $5), includes 4,000 starting credits (was 20,000). - Updated documentation to reflect new credit and pricing model. - Scripts and instructions now show pricing/credit adjustments.","fileCount":null,"zipByteSize":null},{"version":"1.1.2","createdAt":"2026-02-15T08:11:11.918Z","changelog":"x402-layer 1.1.2 - Updated documentation in SKILL.md with minor clarifications. - Scripts updated: awal_bridge.py, consume_product.py, wallet_signing.py (details not specified). - Internal maintenance and small improvements.","fileCount":null,"zipByteSize":null},{"version":"1.1.1","createdAt":"2026-02-14T19:26:08.959Z","changelog":"[1.1.1] - 2026-02-15 Bug Fixes: - Fixed AWAL CLI command: Updated from \"pay\" to \"x402 pay\" - Fixed AWAL URL handling: Pass full URL instead of split format - Fixed endpoint creation for AWAL: Backend now includes EIP-712 domain parameters Changes: - scripts/awal_bridge.py - Updated CLI command and URL handling - Backend - Added EIP-712 domain params for AWAL compatibility Tested: - AWAL endpoint creation verified working - PK mode unchanged and functional","fileCount":null,"zipByteSize":null},{"version":"1.1.0","createdAt":"2026-02-14T11:53:18.272Z","changelog":"x402-layer v1.1.0 Release Notes Release Date: February 14, 2026 --- RELEASE SUMMARY Coinbase Agentic Wallet (AWAL) Integration - AI agents can now make Base network payments without exposing private keys. --- NEW FEATURES Coinbase Agentic Wallet (AWAL) Support: - Full AWAL integration for all Base network payments - No private key exposure required when using AWAL mode - Automatic authentication mode detection (AWAL vs private-key) - Seamless fallback to private-key mode when AWAL is not configured Environment Variables Added: - X402_USE_AWAL: Set \"1\" to enable Coinbase Agentic Wallet for Base - X402_AUTH_MODE: Auth selection - auto, private-key, or awal - X402_PREFER_NETWORK: Network selection - base or solana - AWAL_PACKAGE: NPM package/version for AWAL CLI (default: awal@1.0.0) - AWAL_BIN: Preinstalled awal binary path - AWAL_FORCE_NPX: Set \"1\" to force npx even when binary exists --- SCRIPTS UPDATED - pay_base.py: AWAL payment support - create_endpoint.py: AWAL support for $5 endpoint creation fee - topup_endpoint.py: AWAL support for endpoint credit recharging - recharge_credits.py: AWAL support for credit pack purchases - consume_product.py: AWAL support for digital product consumption --- SKILL.MD UPDATES - Added AWAL to skill description for discovery - Added all environment variables to metadata frontmatter - Added \"Option B: Coinbase Agentic Wallet (AWAL)\" setup section - Added \"Security Notice\" section with best practices - Updated environment reference table --- AWAL DEPENDENCY (Optional) AWAL is optional. To use AWAL mode, users should first install the Coinbase skill: npx skills add coinbase/agentic-wallet-skills export X402_USE_AWAL=1 --- BACKWARD COMPATIBILITY - Private-key mode works exactly as before - Solana payments unchanged (private-key only) - All existing environment variables (PRIVATE_KEY, WALLET_ADDRESS, SOLANA_SECRET_KEY) still work - No breaking changes --- NETWORK SUPPORT Base: AWAL Supported, Private Key Supported Solana: AWAL Not supported, Private Key Required Note: AWAL is a Coinbase CDP product and only supports EVM chains (Base, Ethereum). Solana payments continue to use private-key mode. --- SECURITY NOTICE IMPORTANT: This skill handles private keys for signing blockchain transactions. - Never use your primary custody wallet - Create a dedicated wallet with limited funds - Private keys are used locally only - They sign transactions locally and are never transmitted - Signed payloads are sent to api.x402layer.cc - Payment signatures and wallet addresses are transmitted to settle payments - For testing: Use a throwaway wallet with minimal USDC ($1-5 is enough for testing) - API Keys: When you create an endpoint, store the returned API key securely - Review the code: All scripts are auditable in the scripts/ directory - Use AWAL for production: Eliminates private key exposure entirely for Base payments --- TESTING PERFORMED - Base payments via private key: Passed - Base payments via AWAL: Passed - Solana payments via private key: Passed - Endpoint creation ($5 fee): Passed - Credit purchases: Passed - Marketplace operations: Passed --- UPGRADE INSTRUCTIONS (From v1.0.0 to v1.1.0) 1. No action required for existing users - everything works as before 2. To use AWAL (optional): npx skills add coinbase/agentic-wallet-skills npx awal auth login your@email.com export X402_USE_AWAL=1 python scripts/pay_base.py https://api.x402layer.cc/e/endpoint --- Skill Slug: x402-layer Version: 1.1.0 Previous Version: 1.0.0","fileCount":null,"zipByteSize":null},{"version":"1.0.1","createdAt":"2026-02-02T11:33:13.875Z","changelog":"x402-layer 1.0.1 - Version bump (1.0.0 → 1.0.1). - Security: Added strict x-api-key verification for marketplace listing/unlisting. - Docs: Updated README.md with critical API Key security note. - Script: Updated list_on_marketplace.py to support X_API_KEY env var.","fileCount":null,"zipByteSize":null},{"version":"1.0.0","createdAt":"2026-02-02T10:49:56.579Z","changelog":"# v1.0.0 - Initial Release ## 🎉 Features ### Consumer Mode - Pay-Per-Request on Base (100% reliable) and Solana (EIP-712/versioned txs) - Credit System for zero-latency API access - Marketplace Discovery: browse, search, filter by category - Digital Products: purchase and download files ### Provider Mode - Endpoint Creation: $5 one-time (includes 20,000 credits) - Marketplace Listing during creation OR update afterward - List/Unlist endpoint visibility control - Credit Top-up to keep services running ### Security - API key verification (x-api-key header) - EIP-712 typed data signatures (Base) - Versioned transactions with fee payer (Solana) ### Scripts (11) pay_base, pay_solana, consume_credits, check_credits, recharge_credits, consume_product, discover_marketplace, create_endpoint, manage_endpoint, topup_endpoint, list_on_marketplace ### Known Issues - Solana ~75% success rate (retry logic included)","fileCount":null,"zipByteSize":null}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install kn73xndw522wt8y06avyd39a8h7ztbeh:x402-layer","setupComplexity":"low","setupSteps":["Install using `clawhub skill install kn73xndw522wt8y06avyd39a8h7ztbeh:x402-layer` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/ivaavimusic/x402-layer before using production credentials."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ivaavimusic-x402-layer/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ivaavimusic-x402-layer/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ivaavimusic-x402-layer/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-ivaavimusic-x402-layer/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-ivaavimusic-x402-layer/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-ivaavimusic-x402-layer/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-09T14:46:33.371Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ivaavimusic-x402-layer/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ivaavimusic-x402-layer/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ivaavimusic-x402-layer/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ivaavimusic-x402-layer/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"readme":"Skill: x402 Singularity Layer\n\nOwner: ivaavimusic\n\nSummary: This skill should be used when the user asks to \"create x402 endpoint\", \"deploy monetized API\", \"pay for API with USDC\", \"check x402 credits\", \"consume API c...\n\nTags: ERC8004:1.2.0, SGL:1.2.1, Stripe:1.2.1, agentic:1.1.3, agentic access:1.2.1, agentic webhooks:1.2.1, api:1.2.1, awal:1.1.1, base:1.2.1, coinbase:1.1.1, credits:1.2.1, latest:1.2.1, marketplace:1.2.1, monetization:1.2.1, payments:1.2.1, solana:1.2.1, stripe:1.2.0, usdc:1.2.1, web3:1.2.1, x402:1.2.1, x402 Bazaar:1.2.0, x402 Protocol:1.2.1, x402 Singularity Layer:1.2.1\n\nVersion history:\n\nv1.2.1 | 2026-02-27T13:19:27.315Z | user\n\nv1.2.1 (2026-02-27)\n\nAgentic Webhooks\nExpanded from 1 to 4 event types\n\nEvent Types\n- payment.succeeded\n  Fires on any payment for your endpoint (unchanged)\n\n- credits.depleted\n  Fires when endpoint.owner_credits hits 0\n  Signals that a top-up is required before users receive 503 errors\n\n- credits.low\n  Fires when credits drop to 100 or below\n  Early warning to top up proactively\n\n- credits.recharged\n  Fires after a successful top-up\n  Returns credits_added, previous_balance, new_balance\n\nTechnical\n- Refactored dispatchEndpointWebhook to a generic (eventType, data) signature\n- credits.depleted and credits.low fire at the per-request deduction site (post-RPC)\n- credits.recharged fires alongside payment.succeeded on the top-up path\n- All events use the same HMAC-SHA256 signing as payment.succeeded\n\nDocumentation\n- SKILL.md updated with an event type table and example payloads\n\nv1.2.0 | 2026-02-27T09:03:06.877Z | user\n\nv1.2.0 (2026-02-27)\n--------------------\nNEW: Agentic Webhooks - endpoint-level payment notifications\n- Agents can now receive payment.succeeded events at their own HTTPS URL\n- No user account or Pro plan required - works purely via API key\n- Webhook fires on: credit purchase, direct payment, top-up\n\nNEW SCRIPT: manage_webhook.py\n- manage_webhook.py set <slug> <url>    — add or update webhook\n- manage_webhook.py remove <slug>       — remove webhook\n- manage_webhook.py info <slug>         — check if webhook is configured\n\nUPDATED: create_endpoint.py\n- New --webhook-url flag: set a webhook at endpoint creation time\n- Returns signing_secret in response (shown once, save immediately)\n\nBackend API:\n- POST /agent/endpoints: add webhook_url in body\n- PATCH /agent/endpoints?slug=X: set/update/remove webhook after creation\n  Requires: X-API-Key header (from creation response)\n  Body: {\"webhook_url\": \"https://...\"} or {\"webhook_url\": null}\n\nWebhook signature verification:\n  HMAC-SHA256 over \"timestamp.body\" using your signing_secret\n  Header: X-X402-Signature: t=<ts>,v1=<hex>\n\nEvent format:\n  {\n    \"id\": \"<uuid>\",\n    \"type\": \"payment.succeeded\",\n    \"created_at\": \"<iso8601>\",\n    \"data\": {\n      \"source\": \"endpoint\",\n      \"source_slug\": \"my-api\",\n      \"amount\": 0.01,\n      \"currency\": \"USDC\",\n      \"tx_hash\": \"0x...\",\n      \"payer_wallet\": \"0x...\",\n      \"network\": \"base\",\n      \"status\": \"confirmed\"\n    }\n  }\n\nCredits note: when endpoint credits = 0, no requests go through,\nso no payments happen and no webhook events fire.\n\nBackward compatible: all existing endpoints unaffected (webhook_url\ndefaults to null, events fire only when webhook_url is set).\n\nv1.1.3 | 2026-02-24T19:42:16.752Z | user\n\nx402-layer 1.1.3\n\n- Updated pricing for endpoint creation: now $1 (was $5), includes 4,000 starting credits (was 20,000).\n- Updated documentation to reflect new credit and pricing model.\n- Scripts and instructions now show pricing/credit adjustments.\n\nv1.1.2 | 2026-02-15T08:11:11.918Z | auto\n\nx402-layer 1.1.2\n\n- Updated documentation in SKILL.md with minor clarifications.\n- Scripts updated: awal_bridge.py, consume_product.py, wallet_signing.py (details not specified).\n- Internal maintenance and small improvements.\n\nv1.1.1 | 2026-02-14T19:26:08.959Z | user\n\n[1.1.1] - 2026-02-15\n\nBug Fixes:\n\n- Fixed AWAL CLI command: Updated from \"pay\" to \"x402 pay\"\n- Fixed AWAL URL handling: Pass full URL instead of split format\n- Fixed endpoint creation for AWAL: Backend now includes EIP-712 domain parameters\n\nChanges:\n\n- scripts/awal_bridge.py - Updated CLI command and URL handling\n- Backend - Added EIP-712 domain params for AWAL compatibility\n\nTested:\n\n- AWAL endpoint creation verified working\n- PK mode unchanged and functional\n\nv1.1.0 | 2026-02-14T11:53:18.272Z | user\n\nx402-layer v1.1.0 Release Notes\nRelease Date: February 14, 2026\n\n---\n\nRELEASE SUMMARY\n\nCoinbase Agentic Wallet (AWAL) Integration - AI agents can now make Base network payments without exposing private keys.\n\n---\n\nNEW FEATURES\n\nCoinbase Agentic Wallet (AWAL) Support:\n- Full AWAL integration for all Base network payments\n- No private key exposure required when using AWAL mode\n- Automatic authentication mode detection (AWAL vs private-key)\n- Seamless fallback to private-key mode when AWAL is not configured\n\nEnvironment Variables Added:\n- X402_USE_AWAL: Set \"1\" to enable Coinbase Agentic Wallet for Base\n- X402_AUTH_MODE: Auth selection - auto, private-key, or awal\n- X402_PREFER_NETWORK: Network selection - base or solana\n- AWAL_PACKAGE: NPM package/version for AWAL CLI (default: awal@1.0.0)\n- AWAL_BIN: Preinstalled awal binary path\n- AWAL_FORCE_NPX: Set \"1\" to force npx even when binary exists\n\n---\n\nSCRIPTS UPDATED\n\n- pay_base.py: AWAL payment support\n- create_endpoint.py: AWAL support for $5 endpoint creation fee\n- topup_endpoint.py: AWAL support for endpoint credit recharging\n- recharge_credits.py: AWAL support for credit pack purchases\n- consume_product.py: AWAL support for digital product consumption\n\n---\n\nSKILL.MD UPDATES\n\n- Added AWAL to skill description for discovery\n- Added all environment variables to metadata frontmatter\n- Added \"Option B: Coinbase Agentic Wallet (AWAL)\" setup section\n- Added \"Security Notice\" section with best practices\n- Updated environment reference table\n\n---\n\nAWAL DEPENDENCY (Optional)\n\nAWAL is optional. To use AWAL mode, users should first install the Coinbase skill:\n\n  npx skills add coinbase/agentic-wallet-skills\n  export X402_USE_AWAL=1\n\n---\n\nBACKWARD COMPATIBILITY\n\n- Private-key mode works exactly as before\n- Solana payments unchanged (private-key only)\n- All existing environment variables (PRIVATE_KEY, WALLET_ADDRESS, SOLANA_SECRET_KEY) still work\n- No breaking changes\n\n---\n\nNETWORK SUPPORT\n\nBase: AWAL Supported, Private Key Supported\nSolana: AWAL Not supported, Private Key Required\n\nNote: AWAL is a Coinbase CDP product and only supports EVM chains (Base, Ethereum). Solana payments continue to use private-key mode.\n\n---\n\nSECURITY NOTICE\n\nIMPORTANT: This skill handles private keys for signing blockchain transactions.\n\n- Never use your primary custody wallet - Create a dedicated wallet with limited funds\n- Private keys are used locally only - They sign transactions locally and are never transmitted\n- Signed payloads are sent to api.x402layer.cc - Payment signatures and wallet addresses are transmitted to settle payments\n- For testing: Use a throwaway wallet with minimal USDC ($1-5 is enough for testing)\n- API Keys: When you create an endpoint, store the returned API key securely\n- Review the code: All scripts are auditable in the scripts/ directory\n- Use AWAL for production: Eliminates private key exposure entirely for Base payments\n\n---\n\nTESTING PERFORMED\n\n- Base payments via private key: Passed\n- Base payments via AWAL: Passed\n- Solana payments via private key: Passed\n- Endpoint creation ($5 fee): Passed\n- Credit purchases: Passed\n- Marketplace operations: Passed\n\n---\n\nUPGRADE INSTRUCTIONS (From v1.0.0 to v1.1.0)\n\n1. No action required for existing users - everything works as before\n\n2. To use AWAL (optional):\n\n   npx skills add coinbase/agentic-wallet-skills\n   npx awal auth login your@email.com\n   export X402_USE_AWAL=1\n   python scripts/pay_base.py https://api.x402layer.cc/e/endpoint\n\n---\n\nSkill Slug: x402-layer\nVersion: 1.1.0\nPrevious Version: 1.0.0\n\nv1.0.1 | 2026-02-02T11:33:13.875Z | user\n\nx402-layer 1.0.1\n\n- Version bump (1.0.0 → 1.0.1).\n- Security: Added strict x-api-key verification for marketplace listing/unlisting.\n- Docs: Updated README.md with critical API Key security note.\n- Script: Updated list_on_marketplace.py to support X_API_KEY env var.\n\nv1.0.0 | 2026-02-02T10:49:56.579Z | user\n\n# v1.0.0 - Initial Release\n\n## 🎉 Features\n\n### Consumer Mode\n- Pay-Per-Request on Base (100% reliable) and Solana (EIP-712/versioned txs)\n- Credit System for zero-latency API access\n- Marketplace Discovery: browse, search, filter by category\n- Digital Products: purchase and download files\n\n### Provider Mode  \n- Endpoint Creation: $5 one-time (includes 20,000 credits)\n- Marketplace Listing during creation OR update afterward\n- List/Unlist endpoint visibility control\n- Credit Top-up to keep services running\n\n### Security\n- API key verification (x-api-key header)\n- EIP-712 typed data signatures (Base)\n- Versioned transactions with fee payer (Solana)\n\n### Scripts (11)\npay_base, pay_solana, consume_credits, check_credits, recharge_credits,\nconsume_product, discover_marketplace, create_endpoint, manage_endpoint,\ntopup_endpoint, list_on_marketplace\n\n### Known Issues\n- Solana ~75% success rate (retry logic included)\n\nArchive index:\n\nArchive v1.2.1: 26 files, 42328 bytes\n\nFiles: references/agentic-endpoints.md (523b), references/credit-based.md (1561b), references/marketplace.md (1001b), references/pay-per-request.md (4833b), references/payment-signing.md (1864b), requirements.txt (368b), scripts/awal_bridge.py (4378b), scripts/awal_cli.py (4063b), scripts/check_credits.py (1709b), scripts/consume_credits.py (2345b), scripts/consume_product.py (10724b), scripts/create_endpoint.py (9191b), scripts/discover_marketplace.py (3262b), scripts/list_on_marketplace.py (5596b), scripts/manage_endpoint.py (7122b), scripts/manage_webhook.py (4360b), scripts/network_selection.py (2280b), scripts/pay_base.py (2668b), scripts/pay_solana.py (2843b), scripts/recharge_credits.py (4854b), scripts/solana_signing.py (7103b), scripts/topup_endpoint.py (4024b), scripts/wallet_signing.py (5808b), SETUP_AWAL.md (1364b), SKILL.md (14760b), _meta.json (129b)\n\nFile v1.2.1:SKILL.md\n\n---\nname: x402-layer\nversion: 1.2.1\ndescription: |\n  This skill should be used when the user asks to \"create x402 endpoint\",\n  \"deploy monetized API\", \"pay for API with USDC\", \"check x402 credits\",\n  \"consume API credits\", \"list endpoint on marketplace\", \"buy API credits\",\n  \"topup endpoint\", \"browse x402 marketplace\", \"set up webhook\",\n  \"receive payment notifications\", \"manage endpoint webhook\",\n  use \"Coinbase Agentic Wallet (AWAL)\", or manage x402 Singularity Layer\n  operations on Base or Solana networks.\nhomepage: https://studio.x402layer.cc/docs/agentic-access/openclaw-skill\nmetadata:\n  clawdbot:\n    emoji: \"⚡\"\n    homepage: https://studio.x402layer.cc\n    os:\n      - linux\n      - darwin\n    requires:\n      bins:\n        - python3\n      env:\n        # Core credentials (required for payments)\n        - WALLET_ADDRESS\n        - PRIVATE_KEY\n        # Solana payments (required for Solana network)\n        - SOLANA_SECRET_KEY\n        # Provider operations (required for endpoint management)\n        - X_API_KEY\n        - API_KEY\n        # AWAL mode (optional - for Coinbase Agentic Wallet)\n        - X402_USE_AWAL\n        - X402_AUTH_MODE\n        - X402_PREFER_NETWORK\n        - AWAL_PACKAGE\n        - AWAL_BIN\n        - AWAL_FORCE_NPX\nallowed-tools:\n  - Read\n  - Write\n  - Edit\n  - Bash\n  - WebFetch\n---\n\n\n# x402 Singularity Layer\n\nx402 is a **Web3 payment layer** enabling AI agents to:\n- 💰 **Pay** for API access using USDC\n- 🚀 **Deploy** monetized endpoints\n- 🔍 **Discover** services via marketplace\n- 📊 **Manage** endpoints and credits\n- 🔔 **Webhooks** — receive payment notifications\n\n**Networks:** Base (EVM) • Solana  \n**Currency:** USDC  \n**Protocol:** HTTP 402 Payment Required\n\n---\n\n## Quick Start\n\n### 1. Install Dependencies\n```bash\npip install -r {baseDir}/requirements.txt\n```\n\n### 2. Set Up Wallet (Choose One Mode)\n\n#### Option A: Private Keys (existing mode)\n```bash\n# For Base (EVM)\nexport PRIVATE_KEY=\"0x...\"\nexport WALLET_ADDRESS=\"0x...\"\n\n# For Solana (optional)\nexport SOLANA_SECRET_KEY=\"[1,2,3,...]\"  # JSON array\n```\n\n#### Option B: Coinbase Agentic Wallet (AWAL)\n\nFor Base payments without exposing private keys, use Coinbase Agentic Wallet:\n\n```bash\n# First, install and set up AWAL (one-time setup)\nnpx skills add coinbase/agentic-wallet-skills\n\n# Then enable AWAL mode for this skill\nexport X402_USE_AWAL=1\n```\n\n> **Note**: See [Coinbase AWAL docs](https://docs.cdp.coinbase.com/agentic-wallet/welcome) for full setup instructions. You'll need to authenticate and fund your AWAL wallet with USDC on Base.\n\nOnce AWAL is configured, all Base payment scripts will automatically use it instead of PRIVATE_KEY.\n\n---\n\n## ⚠️ Security Notice\n\n> **IMPORTANT**: This skill handles private keys for signing blockchain transactions.\n>\n> - **Never use your primary custody wallet** - Create a dedicated wallet with limited funds\n> - **Private keys are used locally only** - They sign transactions locally and are never transmitted\n> - **Signed payloads are sent to api.x402layer.cc** - Payment signatures and wallet addresses are transmitted to settle payments\n> - **For testing**: Use a throwaway wallet with minimal USDC ($1-5 is enough for testing)\n> - **API Keys**: When you create an endpoint, store the returned API key securely\n> - **Review the code**: All scripts are auditable in the `scripts/` directory\n\n---\n\n## Scripts Overview\n\n### 🛒 CONSUMER MODE (Buying Services)\n\n| Script | Purpose |\n|--------|---------|\n| `pay_base.py` | Pay for endpoint on Base network |\n| `pay_solana.py` | Pay for endpoint on Solana network |\n| `consume_credits.py` | Use pre-purchased credits (fast) |\n| `consume_product.py` | Purchase digital products (files) |\n| `awal_cli.py` | Run Coinbase Agentic Wallet CLI commands (auth, bazaar, pay, discover) |\n| `check_credits.py` | Check your credit balance |\n| `recharge_credits.py` | Buy credit packs for an endpoint |\n| `discover_marketplace.py` | Browse available services |\n\n### 🏭 PROVIDER MODE (Selling Services)\n\n| Script | Purpose |\n|--------|---------|\n| `create_endpoint.py` | Deploy new monetized endpoint ($1) |\n| `manage_endpoint.py` | View/update your endpoints |\n| `topup_endpoint.py` | Recharge YOUR endpoint with credits |\n| `list_on_marketplace.py` | Update marketplace listing |\n| `manage_webhook.py` | Set/update/remove webhook URL |\n\n---\n\n## Security: API Key Verification\n\n> [!IMPORTANT]\n> When you create an endpoint, x402 acts as a proxy to your origin server. You MUST verify that requests are coming from x402.\n\n1. **Get your API Key**: Returned when you run `create_endpoint.py`.\n2. **Verify Headers**: Your origin server MUST check for this header in every request:\n   ```http\n   x-api-key: <YOUR_API_KEY>\n   ```\n   If the header is missing or incorrect, reject the request (401 Unauthorized).\n\n---\n\n## Credit System: How It Works\n\n> [!WARNING]\n> **Credits are NOT test credits!** They are consumed with every API request.\n\n### Flow\n\n```\nUser pays $0.01 → Your wallet receives payment → 1 credit deducted from your endpoint\n```\n\n### Economics\n\n| Item | Value |\n|------|-------|\n| **Creation cost** | $1 (one-time) |\n| **Starting credits** | 4,000 credits |\n| **Recharge rate** | 500 credits per $1 |\n| **Consumption** | 1 credit per API request |\n| **Your earnings** | Whatever price you set per call |\n\n### Example\n\n1. **Create endpoint**: Pay $1, get 4,000 credits\n2. **Set price**: $0.01 per call\n3. **User calls your API 1,000 times**: You earn $10, 1,000 credits deducted\n4. **Remaining**: 19,000 credits + $10 profit\n5. **Credits run low?** Recharge with `topup_endpoint.py`\n\n### What Happens When Credits = 0?\n\nYour endpoint **stops working** and returns an error. Users cannot access it until you recharge.\n\n---\n\n## Consumer Flows\n\n### A. Pay-Per-Request (Recommended)\n\n```bash\n# Pay with Base (EVM) - 100% reliable\npython {baseDir}/scripts/pay_base.py https://api.x402layer.cc/e/weather-data\n\n# Pay with Solana - includes retry logic\npython {baseDir}/scripts/pay_solana.py https://api.x402layer.cc/e/weather-data\n\n# Pay with Coinbase Agentic Wallet (AWAL)\npython {baseDir}/scripts/awal_cli.py pay-url https://api.x402layer.cc/e/weather-data\n```\n\n### B. Credit-Based Access (Fastest)\n\nPre-purchase credits for instant access without blockchain latency:\n\n```bash\n# Check your balance\npython {baseDir}/scripts/check_credits.py weather-data\n\n# Buy credits (consumer purchasing credits)\npython {baseDir}/scripts/recharge_credits.py weather-data pack_100\n\n# Use credits for instant access\npython {baseDir}/scripts/consume_credits.py https://api.x402layer.cc/e/weather-data\n```\n\n### C. Discover Services\n\n```bash\n# Browse all services\npython {baseDir}/scripts/discover_marketplace.py\n\n# Search by keyword\npython {baseDir}/scripts/discover_marketplace.py search weather\n\n# AWAL bazaar discovery\npython {baseDir}/scripts/awal_cli.py run bazaar list\n```\n\n---\n\n## Provider Flows\n\n### A. Create Endpoint ($1 one-time)\n\nDeploy your own monetized API:\n\n**Basic (not listed on marketplace):**\n```bash\npython {baseDir}/scripts/create_endpoint.py my-api \"My AI Service\" https://api.example.com 0.01 --no-list\n```\n\n**With marketplace listing (recommended):**\n```bash\npython {baseDir}/scripts/create_endpoint.py my-api \"My AI Service\" https://api.example.com 0.01 \\\n    --category ai \\\n    --description \"AI-powered data analysis API\" \\\n    --logo https://example.com/logo.png \\\n    --banner https://example.com/banner.jpg\n```\n\n**Available categories:** `ai`, `data`, `finance`, `utility`, `social`, `gaming`\n\n> **Note**: Save the `API Key` from the output and use it to secure your origin server.\n\n> ⚠️ **IMPORTANT - How Credits Work:**\n> - **Cost:** $1 one-time, includes **4,000 credits** (NOT test credits!)\n> - **Consumption:** 1 credit is deducted for **each API request** to your endpoint\n> - **When credits reach 0:** Your endpoint **stops working** until you recharge\n> - **Recharge:** Use `topup_endpoint.py` to add more credits ($1 = 500 credits)\n> - **Users pay YOU:** Each user payment goes to your wallet, then 1 credit is used\n\nIncludes 4,000 starting credits.\n\n### B. Manage Your Endpoint\n\n```bash\n# List your endpoints\npython {baseDir}/scripts/manage_endpoint.py list\n\n# View stats\npython {baseDir}/scripts/manage_endpoint.py stats my-api\n\n# Update price\npython {baseDir}/scripts/manage_endpoint.py update my-api --price 0.02\n```\n\n### C. Recharge Your Endpoint (Required to Keep It Working)\n\n**Your endpoint consumes 1 credit per request.** When credits run out, it stops working. Recharge to keep it active:\n\n```bash\n# Add $10 worth of credits (5,000 credits at 500 credits/$1)\npython {baseDir}/scripts/topup_endpoint.py my-api 10\n\n# Check remaining credits first\npython {baseDir}/scripts/manage_endpoint.py stats my-api\n```\n\n> ⚠️ **Remember:** `topup_endpoint.py` is for **providers** to recharge THEIR endpoint.\n> `recharge_credits.py` is for **consumers** to buy credits at someone else's endpoint.\n\n### D. Marketplace Listing Management\n\nMarketplace listing can be done **during creation** OR **separately afterward**:\n\n**Option 1: During Creation** (Recommended)\n```bash\npython {baseDir}/scripts/create_endpoint.py my-api \"My API\" https://api.example.com 0.01 \\\n    --category ai \\\n    --description \"AI-powered analysis\" \\\n    --logo https://example.com/logo.png \\\n    --banner https://example.com/banner.jpg\n```\n\n**Option 2: After Creation** (Update or List Later)\n```bash\n# List or update marketplace listing\npython {baseDir}/scripts/list_on_marketplace.py my-api \\\n    --category ai \\\n    --description \"AI-powered analysis\" \\\n    --logo https://example.com/logo.png \\\n    --banner https://example.com/banner.jpg\n\n# Unlist from marketplace\npython {baseDir}/scripts/list_on_marketplace.py my-api --unlist\n```\n\n> **Tip:** Use `list_on_marketplace.py` to update your listing anytime - change category, description, or images without recreating the endpoint.\n\n### E. Webhooks (Payment Notifications)\n\nReceive `payment.succeeded` events when someone pays for your endpoint. Optional — not required for endpoints to work.\n\n**Set webhook at creation time:**\n```bash\npython {baseDir}/scripts/create_endpoint.py my-api \"My API\" https://api.example.com 0.01 \\\n    --webhook-url https://my-server.com/webhook\n```\n\n**Add or update webhook on existing endpoint:**\n```bash\npython {baseDir}/scripts/manage_webhook.py set my-api https://my-server.com/webhook\n```\n\n**Check webhook status:**\n```bash\npython {baseDir}/scripts/manage_webhook.py info my-api\n```\n\n**Remove webhook:**\n```bash\npython {baseDir}/scripts/manage_webhook.py remove my-api\n```\n\n> ⚠️ **IMPORTANT**: The `signing_secret` is returned only once when you set a webhook. Save it immediately.\n\n#### Webhook Event Types\n\n| Event | When | Key Fields |\n|-------|------|-----------|\n| `payment.succeeded` | Any payment for your endpoint | `amount`, `tx_hash`, `payer_wallet`, `network` |\n| `credits.depleted` | Owner credits hit 0 | `remaining_credits`, `topup_endpoint` |\n| `credits.low` | Credits drop to ≤100 | `remaining_credits` |\n| `credits.recharged` | Top-up payment succeeds | `credits_added`, `new_balance`, `amount_paid` |\n\nYour endpoint receives POST requests with:\n```http\nContent-Type: application/json\nX-X402-Event: <event_type>\nX-X402-Signature: t=<timestamp>,v1=<hmac_sha256>\n```\n\n**payment.succeeded example:**\n```json\n{\n  \"id\": \"event-uuid\",\n  \"type\": \"payment.succeeded\",\n  \"created_at\": \"2026-01-01T00:00:00.000Z\",\n  \"data\": {\n    \"source\": \"endpoint\",\n    \"source_slug\": \"my-api\",\n    \"amount\": 0.01,\n    \"currency\": \"USDC\",\n    \"tx_hash\": \"0x...\",\n    \"payer_wallet\": \"0x...\",\n    \"network\": \"base\",\n    \"status\": \"confirmed\"\n  }\n}\n```\n\n**credits.depleted example:**\n```json\n{\n  \"type\": \"credits.depleted\",\n  \"data\": {\n    \"source\": \"endpoint\",\n    \"source_slug\": \"my-api\",\n    \"remaining_credits\": 0,\n    \"message\": \"Endpoint credits exhausted. Top up to resume service.\"\n  }\n}\n```\n\n**credits.recharged example:**\n```json\n{\n  \"type\": \"credits.recharged\",\n  \"data\": {\n    \"source\": \"endpoint\",\n    \"source_slug\": \"my-api\",\n    \"credits_added\": 5000,\n    \"previous_balance\": 0,\n    \"new_balance\": 5000,\n    \"amount_paid\": 10,\n    \"currency\": \"USDC\"\n  }\n}\n```\n\n#### Verify Webhook Signature\n```python\nimport hmac, hashlib\ndef verify(secret, timestamp, body, received_sig):\n    expected = hmac.new(secret.encode(), f\"{timestamp}.{body}\".encode(), hashlib.sha256).hexdigest()\n    return hmac.compare_digest(expected, received_sig)\n```\n\n> **When credits = 0**, no requests go through, so no payments happen and no webhook events fire. Self-regulating.\n\n---\n\n## Payment Technical Details\n\n### Base (EVM) - EIP-712 Signatures\n\nUses USDC `TransferWithAuthorization` (EIP-3009):\n- Gasless for payer\n- Facilitator settles on-chain\n- 100% reliable\n\n### Solana - Versioned Transactions\n\nUses `VersionedTransaction` with `MessageV0`:\n- Facilitator pays gas (from `extra.feePayer`)\n- SPL Token `TransferChecked` instruction\n- ~75% success rate (retry logic included)\n\n---\n\n## Environment Reference\n\n| Variable | Required For | Description |\n|----------|--------------|-------------|\n| `PRIVATE_KEY` | Base payments (private-key mode) | EVM private key (0x...) |\n| `WALLET_ADDRESS` | All operations | Your wallet address |\n| `SOLANA_SECRET_KEY` | Solana payments | JSON array of bytes |\n| `X402_USE_AWAL` | AWAL mode | Set `1` to enable Coinbase Agentic Wallet for Base |\n| `X402_AUTH_MODE` | Auth selection (optional) | `auto`, `private-key`, or `awal` (default: auto) |\n| `X402_PREFER_NETWORK` | Network selection (optional) | `base` or `solana` (default: base) |\n| `AWAL_PACKAGE` | AWAL mode (optional) | NPM package/version for AWAL CLI (default: `awal@1.0.0`) |\n| `AWAL_BIN` | AWAL mode (optional) | Preinstalled `awal` binary path/name |\n| `AWAL_FORCE_NPX` | AWAL mode (optional) | Set `1` to force npx even when `awal` binary exists |\n\n---\n\n## API Base URL\n\n- **Endpoints:** `https://api.x402layer.cc/e/{slug}`\n- **Marketplace:** `https://api.x402layer.cc/api/marketplace`\n- **Credits:** `https://api.x402layer.cc/api/credits/*`\n- **Agent API:** `https://api.x402layer.cc/agent/*`\n\n---\n\n## Resources\n\n- 📖 **Documentation:** [studio.x402layer.cc/docs/agentic-access/openclaw-skill](https://studio.x402layer.cc/docs/agentic-access/openclaw-skill)\n- 💻 **GitHub Docs:** [github.com/ivaavimusic/SGL_DOCS_2025](https://github.com/ivaavimusic/SGL_DOCS_2025)\n- 🐦 **OpenClaw:** [x.com/openclaw](https://x.com/openclaw)\n- 🌐 **x402 Studio:** [studio.x402layer.cc](https://studio.x402layer.cc)\n\n---\n\n## Known Issues\n\n⚠️ **Solana payments** have ~75% success rate due to facilitator-side fee payer infrastructure issue. Retry logic is included in `pay_solana.py`. **Base (EVM) payments are 100% reliable** and recommended for production.\n\nFile v1.2.1:_meta.json\n\n{\n  \"ownerId\": \"kn73xndw522wt8y06avyd39a8h7ztbeh\",\n  \"slug\": \"x402-layer\",\n  \"version\": \"1.2.1\",\n  \"publishedAt\": 1772198367315\n}\n\nFile v1.2.1:references/agentic-endpoints.md\n\n# Agentic Endpoint Creation\n\nDeploy your own monetized API endpoints programmatically.\n\n## Endpoint\nPOST https://api.x402layer.cc/agent/endpoints\n\n## Pricing\nCreate: $1 (4,000 credits included)\nTop-up: $1 = 500 credits\n\n## Create Flow\n1. POST with endpoint config (name, slug, origin_url, chain)\n2. Get 402 challenge\n3. Sign with EIP-712\n4. Send X-Payment header\n5. Receive gateway URL and API key\n\n## Top-Up\nPUT /agent/endpoints/<slug> with topup_amount\n\n## Check Status\nGET /agent/endpoints/<slug> with x-api-key header\n\nFile v1.2.1:references/credit-based.md\n\n# Credit-Based Access\n\nFor high-frequency or latency-sensitive API calls. Pre-purchase credits, consume instantly.\n\n## Why Use Credits?\n\n- Zero latency (no blockchain wait)\n- Zero gas fees per request\n- Simple header-based access\n\n## Usage\n\n### Check Balance\n```bash\ncurl \"https://api.x402layer.cc/api/credits/balance?endpoint=<slug>\" \\\n  -H \"x-wallet-address: 0xYourWallet...\"\n```\n\n### Consume Endpoint\n```bash\ncurl \"https://api.x402layer.cc/e/<slug>\" \\\n  -H \"x-wallet-address: 0xYourWallet...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"{\\\"prompt\\\": \\\"your request\\\"}\"\n```\n\n### Insufficient Credits Response\nWhen out of credits, you get a 402 with purchase options:\n\n```json\n{\n  \"error\": \"Insufficient credits\",\n  \"current_balance\": 0,\n  \"purchase_url\": \"https://studio.x402layer.cc/pay/credits/<slug>\",\n  \"credit_package\": {\"size\": 69, \"price\": 0.01},\n  \"accepts\": [...]\n}\n```\n\n## Purchasing Credits\n\nUse the standard 402 flow on the `purchase_url`:\n\n1. GET the purchase URL\n2. Parse 402 challenge  \n3. Sign EIP-712 payment\n4. Send with X-Payment header\n5. Credits added to wallet\n\n## Example Python\n\n```python\nimport requests\n\ndef call_with_credits(url, wallet, data):\n    resp = requests.post(url, \n        json=data,\n        headers={\"x-wallet-address\": wallet})\n    \n    if resp.status_code == 402:\n        print(\"Need credits!\", resp.json()[\"purchase_url\"])\n        return None\n    \n    return resp.json()\n```\n\n## Scripts\n\n- `check_credits.py` - Query balance\n- `consume_with_credits.py` - Use credits\n- `recharge_credits.py` - Top up via payment\n\nFile v1.2.1:references/marketplace.md\n\n# Marketplace Discovery\n\nBrowse, search, and consume x402 marketplace services.\n\n## Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/api/marketplace` | GET | List all public listings |\n| `/api/marketplace/search?q=<term>` | GET | Search by keyword |\n| `/api/marketplace/featured` | GET | Featured listings |\n| `/api/marketplace/<slug>` | GET | Single endpoint details |\n| `/api/marketplace/list` | POST | List endpoint (provider) |\n| `/api/marketplace/unlist` | POST | Remove from marketplace |\n\n## Categories\n`ai`, `data`, `finance`, `utility`, `social`, `gaming`\n\n## Example: Browse All\n\n```bash\npython discover_marketplace.py\n```\n\n## Example: Consume Found Service\n\n```bash\n# Get details for an endpoint\npython discover_marketplace.py details weather-api\n\n# Pay and consume\npython pay_base.py https://api.x402layer.cc/e/weather-api\n```\n\n## Scripts\n\n- `discover_marketplace.py` - Browse/search marketplace\n- `list_on_marketplace.py` - List/unlist your endpoint\n\nFile v1.2.1:references/pay-per-request.md\n\n# Pay-Per-Request (Direct Mode)\n\nPay-Per-Request uses the HTTP 402 Payment Required status code to negotiate payment for each individual API call.\n\n## Critical: EIP-712 Signatures\n\n**x402 uses EIP-712 typed data signatures, NOT raw ERC20 transfers.**\n\nThe facilitator validates and broadcasts the payment. You only need to sign a permit.\n\n## Coinbase Agentic Wallet (AWAL) Shortcut\n\nIf you do not want local private-key signing, use AWAL:\n\n```bash\npython {baseDir}/scripts/awal_cli.py run auth login agent@example.com\npython {baseDir}/scripts/awal_cli.py run auth verify <flow_id> <otp>\npython {baseDir}/scripts/awal_cli.py pay-url https://api.x402layer.cc/e/my-endpoint\n```\n\n---\n\n## Interaction Cycle\n\n### 1. Naïve Request\n\n```bash\ncurl https://api.x402layer.cc/e/my-endpoint\n```\n\n### 2. Parse 402 Challenge\n\n```json\n{\n  \"x402Version\": 1,\n  \"accepts\": [\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"base\",\n      \"maxAmountRequired\": \"10000\",\n      \"payTo\": \"0xCD95802A4aBddD75A5750DD2d6935007eF268275\",\n      \"asset\": \"eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n      \"extra\": {\n        \"name\": \"USD Coin\",\n        \"version\": \"2\"\n      }\n    },\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"solana\",\n      \"maxAmountRequired\": \"10000\",\n      \"payTo\": \"3rcdSzTam4h5e6UN2USv5L2t9R4Ah466B4mHgxRVEqCx\",\n      \"asset\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n      \"extra\": {\n        \"feePayer\": \"BENrLoUbndxoNMUS5JXApGMtNykLjFXXixMtpDwDR9SP\"\n      }\n    }\n  ]\n}\n```\n\n### 3. Sign Payment (EIP-712)\n\n```python\nimport os\nimport time\nimport json\nimport base64\nfrom eth_account import Account\nfrom eth_account.messages import encode_typed_data\n\ndef sign_x402_payment(challenge, wallet_address, private_key):\n    \"\"\"Sign x402 payment using EIP-712 (NOT raw ERC20 transfer)\"\"\"\n    \n    # Find Base option\n    base_option = next((a for a in challenge[\"accepts\"] if a[\"network\"] == \"base\"), None)\n    if not base_option:\n        raise ValueError(\"No Base payment option\")\n    \n    # Domain from extra field\n    extra = base_option.get(\"extra\", {})\n    domain = {\n        \"name\": extra.get(\"name\", \"USD Coin\"),\n        \"version\": extra.get(\"version\", \"2\"),\n        \"chainId\": 8453,\n        \"verifyingContract\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\"\n    }\n    \n    # EIP-712 types for TransferWithAuthorization\n    types = {\n        \"TransferWithAuthorization\": [\n            {\"name\": \"from\", \"type\": \"address\"},\n            {\"name\": \"to\", \"type\": \"address\"},\n            {\"name\": \"value\", \"type\": \"uint256\"},\n            {\"name\": \"validAfter\", \"type\": \"uint256\"},\n            {\"name\": \"validBefore\", \"type\": \"uint256\"},\n            {\"name\": \"nonce\", \"type\": \"bytes32\"},\n        ]\n    }\n    \n    # Message data\n    nonce = os.urandom(32)\n    message = {\n        \"from\": wallet_address,\n        \"to\": base_option[\"payTo\"],\n        \"value\": int(base_option[\"maxAmountRequired\"]),\n        \"validAfter\": 0,\n        \"validBefore\": int(time.time()) + 3600,\n        \"nonce\": nonce,\n    }\n    \n    # Sign\n    encoded = encode_typed_data(domain, types, message)\n    signed = Account.sign_message(encoded, private_key)\n    \n    # Build X-Payment payload\n    payment_obj = {\n        \"x402Version\": 1,\n        \"scheme\": \"exact\",\n        \"network\": \"base\",\n        \"payload\": {\n            \"signature\": signed.signature.hex(),\n            \"from\": wallet_address,\n            \"to\": base_option[\"payTo\"],\n            \"value\": str(message[\"value\"]),\n            \"validAfter\": str(message[\"validAfter\"]),\n            \"validBefore\": str(message[\"validBefore\"]),\n            \"nonce\": \"0x\" + nonce.hex(),\n        }\n    }\n    \n    return base64.b64encode(json.dumps(payment_obj).encode()).decode()\n```\n\n### 4. Authorized Request\n\n```python\nimport requests\n\nx_payment = sign_x402_payment(challenge, wallet, key)\nresponse = requests.get(url, headers={\"X-Payment\": x_payment})\nprint(response.json())\n```\n\n---\n\n## Free Endpoints (maxAmountRequired = \"0\")\n\nEven if amount is 0, you MUST still send a signed payload. This authenticates the caller.\n\n---\n\n## Solana Payments\n\nSolana uses SPL Token transfers (not EIP-712). The transaction must include the `feePayer` from challenge.\n\n```python\nfrom solders.keypair import Keypair\nfrom solders.transaction import Transaction\nfrom solders.pubkey import Pubkey\nfrom spl.token.instructions import transfer_checked\nimport base64\n\n# Build SPL transfer transaction\n# Include feePayer from challenge extra\n# Serialize and base64 encode\n```\n\n---\n\n## Common Errors\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| \"Invalid signature\" | Using raw transfer() | Use EIP-712 signing |\n| \"Nonce already used\" | Replay attack | Generate fresh random nonce |\n| \"validBefore expired\" | Timeout | Set validBefore = now + 3600 |\n| \"Wrong domain\" | Bad name/version | Use \"USD Coin\" v2 for Base USDC |\n\nFile v1.2.1:references/payment-signing.md\n\n# Payment Signing Reference\n\n## Critical Understanding\n\nx402 uses EIP-712 typed data signatures for TransferWithAuthorization. The facilitator verifies signatures and settles the payment.\n\n## Base (EVM) - EIP-712 Signing\n\n### Domain (Base USDC)\n```python\ndomain = {\n    \"name\": \"USD Coin\",\n    \"version\": \"2\",\n    \"chainId\": 8453,\n    \"verifyingContract\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\"\n}\n```\n\n### Types\n```python\ntypes = {\n    \"TransferWithAuthorization\": [\n        {\"name\": \"from\", \"type\": \"address\"},\n        {\"name\": \"to\", \"type\": \"address\"},\n        {\"name\": \"value\", \"type\": \"uint256\"},\n        {\"name\": \"validAfter\", \"type\": \"uint256\"},\n        {\"name\": \"validBefore\", \"type\": \"uint256\"},\n        {\"name\": \"nonce\", \"type\": \"bytes32\"},\n    ]\n}\n```\n\n### Signing\n```python\nfrom eth_account import Account\nfrom eth_account.messages import encode_typed_data\nimport os, time\n\nmessage = {\n    \"from\": wallet,\n    \"to\": challenge[\"payTo\"],\n    \"value\": int(challenge[\"maxAmountRequired\"]),\n    \"validAfter\": 0,\n    \"validBefore\": int(time.time()) + 3600,\n    \"nonce\": os.urandom(32),\n}\n\nencoded = encode_typed_data(domain, types, message)\nsigned = Account.sign_message(encoded, private_key)\n```\n\n## Solana - SPL Transfer\n\nSolana uses SPL Token transfers with base64 encoding.\n\n## Coinbase Agentic Wallet (AWAL) Mode\n\nYou can avoid direct key management by using AWAL:\n\n```bash\npython {baseDir}/scripts/awal_cli.py run auth login agent@example.com\npython {baseDir}/scripts/awal_cli.py run auth verify <flow_id> <otp>\npython {baseDir}/scripts/awal_cli.py pay-url https://api.x402layer.cc/e/weather-data\n```\n\nAWAL package version can be pinned:\n\n```bash\nexport AWAL_PACKAGE=\"awal@1.0.0\"\n```\n\n## X-Payment Header Format\n\nBase64 encode the payment JSON:\n```python\nimport json, base64\nx_payment = base64.b64encode(json.dumps(payload).encode()).decode()\n```\n\nFile v1.2.1:SETUP_AWAL.md\n\n# Setup Guide: Coinbase Agentic Wallet (AWAL) CLI\n\nTo use the `x402-layer` skill with Coinbase Agentic Wallet (AWAL) for Base payments, you need to install the `awal` CLI tool.\n\n## Prerequisites\n\n- Node.js (version 18+ recommended)\n- NPM or Yarn\n\n## Option 1: Global Installation (Recommended)\n\nInstalling globally allows you to run `awal` commands directly from any directory.\n\n```bash\nnpm install -g awal\n```\n\nVerify installation:\n```bash\nawal --version\n```\n\n## Option 2: Using NPX (No Installation Required)\n\nYou can run commands without installing `awal` globally by prefixing with `npx`.\n\n```bash\nnpx awal --version\n```\n\n## Authentication\n\n1.  **Login**: Start the authentication process. You will receive an email with an OTP.\n    ```bash\n    # If installed globally:\n    awal auth login your-email@example.com\n\n    # If using npx:\n    npx awal auth login your-email@example.com\n    ```\n\n2.  **Verify**: Check your email for the OTP and complete the login.\n    ```bash\n    # Replace <flow-id> and <otp-code> with values from the login step and email.\n    awal auth verify <flow-id> <otp-code>\n    ```\n\n3.  **Check Status**: Confirm you are logged in.\n    ```bash\n    awal status\n    ```\n\n## Configuration for x402-layer\n\nOnce setup, ensure you export the necessary environment variable to enable AWAL mode in the scripts:\n\n```bash\nexport X402_USE_AWAL=1\n```\n\nFile v1.2.1:requirements.txt\n\n# x402 Layer - Python Dependencies\n# Install: pip install -r requirements.txt\n\n# EVM/Base payments - Required for EIP-712 signing\neth-account>=0.10.0\nweb3>=6.0.0\n\n# HTTP requests\nrequests>=2.28.0\n\n# Environment variables\npython-dotenv>=1.0.0\n\n# Solana payments - Optional, only needed for Solana network\n# Uncomment if using Solana:\n# solders>=0.20.0\n# solana>=0.30.0\n\nArchive v1.2.0: 26 files, 42062 bytes\n\nFiles: references/agentic-endpoints.md (523b), references/credit-based.md (1561b), references/marketplace.md (1001b), references/pay-per-request.md (4833b), references/payment-signing.md (1864b), requirements.txt (368b), scripts/awal_bridge.py (4378b), scripts/awal_cli.py (4063b), scripts/check_credits.py (1709b), scripts/consume_credits.py (2345b), scripts/consume_product.py (10724b), scripts/create_endpoint.py (9191b), scripts/discover_marketplace.py (3262b), scripts/list_on_marketplace.py (5596b), scripts/manage_endpoint.py (7122b), scripts/manage_webhook.py (4360b), scripts/network_selection.py (2280b), scripts/pay_base.py (2668b), scripts/pay_solana.py (2843b), scripts/recharge_credits.py (4854b), scripts/solana_signing.py (7103b), scripts/topup_endpoint.py (4024b), scripts/wallet_signing.py (5808b), SETUP_AWAL.md (1364b), SKILL.md (13800b), _meta.json (129b)\n\nFile v1.2.0:SKILL.md\n\n---\nname: x402-layer\nversion: 1.2.0\ndescription: |\n  This skill should be used when the user asks to \"create x402 endpoint\",\n  \"deploy monetized API\", \"pay for API with USDC\", \"check x402 credits\",\n  \"consume API credits\", \"list endpoint on marketplace\", \"buy API credits\",\n  \"topup endpoint\", \"browse x402 marketplace\", \"set up webhook\",\n  \"receive payment notifications\", \"manage endpoint webhook\",\n  use \"Coinbase Agentic Wallet (AWAL)\", or manage x402 Singularity Layer\n  operations on Base or Solana networks.\nhomepage: https://studio.x402layer.cc/docs/agentic-access/openclaw-skill\nmetadata:\n  clawdbot:\n    emoji: \"⚡\"\n    homepage: https://studio.x402layer.cc\n    os:\n      - linux\n      - darwin\n    requires:\n      bins:\n        - python3\n      env:\n        # Core credentials (required for payments)\n        - WALLET_ADDRESS\n        - PRIVATE_KEY\n        # Solana payments (required for Solana network)\n        - SOLANA_SECRET_KEY\n        # Provider operations (required for endpoint management)\n        - X_API_KEY\n        - API_KEY\n        # AWAL mode (optional - for Coinbase Agentic Wallet)\n        - X402_USE_AWAL\n        - X402_AUTH_MODE\n        - X402_PREFER_NETWORK\n        - AWAL_PACKAGE\n        - AWAL_BIN\n        - AWAL_FORCE_NPX\nallowed-tools:\n  - Read\n  - Write\n  - Edit\n  - Bash\n  - WebFetch\n---\n\n\n# x402 Singularity Layer\n\nx402 is a **Web3 payment layer** enabling AI agents to:\n- 💰 **Pay** for API access using USDC\n- 🚀 **Deploy** monetized endpoints\n- 🔍 **Discover** services via marketplace\n- 📊 **Manage** endpoints and credits\n- 🔔 **Webhooks** — receive payment notifications\n\n**Networks:** Base (EVM) • Solana  \n**Currency:** USDC  \n**Protocol:** HTTP 402 Payment Required\n\n---\n\n## Quick Start\n\n### 1. Install Dependencies\n```bash\npip install -r {baseDir}/requirements.txt\n```\n\n### 2. Set Up Wallet (Choose One Mode)\n\n#### Option A: Private Keys (existing mode)\n```bash\n# For Base (EVM)\nexport PRIVATE_KEY=\"0x...\"\nexport WALLET_ADDRESS=\"0x...\"\n\n# For Solana (optional)\nexport SOLANA_SECRET_KEY=\"[1,2,3,...]\"  # JSON array\n```\n\n#### Option B: Coinbase Agentic Wallet (AWAL)\n\nFor Base payments without exposing private keys, use Coinbase Agentic Wallet:\n\n```bash\n# First, install and set up AWAL (one-time setup)\nnpx skills add coinbase/agentic-wallet-skills\n\n# Then enable AWAL mode for this skill\nexport X402_USE_AWAL=1\n```\n\n> **Note**: See [Coinbase AWAL docs](https://docs.cdp.coinbase.com/agentic-wallet/welcome) for full setup instructions. You'll need to authenticate and fund your AWAL wallet with USDC on Base.\n\nOnce AWAL is configured, all Base payment scripts will automatically use it instead of PRIVATE_KEY.\n\n---\n\n## ⚠️ Security Notice\n\n> **IMPORTANT**: This skill handles private keys for signing blockchain transactions.\n>\n> - **Never use your primary custody wallet** - Create a dedicated wallet with limited funds\n> - **Private keys are used locally only** - They sign transactions locally and are never transmitted\n> - **Signed payloads are sent to api.x402layer.cc** - Payment signatures and wallet addresses are transmitted to settle payments\n> - **For testing**: Use a throwaway wallet with minimal USDC ($1-5 is enough for testing)\n> - **API Keys**: When you create an endpoint, store the returned API key securely\n> - **Review the code**: All scripts are auditable in the `scripts/` directory\n\n---\n\n## Scripts Overview\n\n### 🛒 CONSUMER MODE (Buying Services)\n\n| Script | Purpose |\n|--------|---------|\n| `pay_base.py` | Pay for endpoint on Base network |\n| `pay_solana.py` | Pay for endpoint on Solana network |\n| `consume_credits.py` | Use pre-purchased credits (fast) |\n| `consume_product.py` | Purchase digital products (files) |\n| `awal_cli.py` | Run Coinbase Agentic Wallet CLI commands (auth, bazaar, pay, discover) |\n| `check_credits.py` | Check your credit balance |\n| `recharge_credits.py` | Buy credit packs for an endpoint |\n| `discover_marketplace.py` | Browse available services |\n\n### 🏭 PROVIDER MODE (Selling Services)\n\n| Script | Purpose |\n|--------|---------|\n| `create_endpoint.py` | Deploy new monetized endpoint ($1) |\n| `manage_endpoint.py` | View/update your endpoints |\n| `topup_endpoint.py` | Recharge YOUR endpoint with credits |\n| `list_on_marketplace.py` | Update marketplace listing |\n| `manage_webhook.py` | Set/update/remove webhook URL |\n\n---\n\n## Security: API Key Verification\n\n> [!IMPORTANT]\n> When you create an endpoint, x402 acts as a proxy to your origin server. You MUST verify that requests are coming from x402.\n\n1. **Get your API Key**: Returned when you run `create_endpoint.py`.\n2. **Verify Headers**: Your origin server MUST check for this header in every request:\n   ```http\n   x-api-key: <YOUR_API_KEY>\n   ```\n   If the header is missing or incorrect, reject the request (401 Unauthorized).\n\n---\n\n## Credit System: How It Works\n\n> [!WARNING]\n> **Credits are NOT test credits!** They are consumed with every API request.\n\n### Flow\n\n```\nUser pays $0.01 → Your wallet receives payment → 1 credit deducted from your endpoint\n```\n\n### Economics\n\n| Item | Value |\n|------|-------|\n| **Creation cost** | $1 (one-time) |\n| **Starting credits** | 4,000 credits |\n| **Recharge rate** | 500 credits per $1 |\n| **Consumption** | 1 credit per API request |\n| **Your earnings** | Whatever price you set per call |\n\n### Example\n\n1. **Create endpoint**: Pay $1, get 4,000 credits\n2. **Set price**: $0.01 per call\n3. **User calls your API 1,000 times**: You earn $10, 1,000 credits deducted\n4. **Remaining**: 19,000 credits + $10 profit\n5. **Credits run low?** Recharge with `topup_endpoint.py`\n\n### What Happens When Credits = 0?\n\nYour endpoint **stops working** and returns an error. Users cannot access it until you recharge.\n\n---\n\n## Consumer Flows\n\n### A. Pay-Per-Request (Recommended)\n\n```bash\n# Pay with Base (EVM) - 100% reliable\npython {baseDir}/scripts/pay_base.py https://api.x402layer.cc/e/weather-data\n\n# Pay with Solana - includes retry logic\npython {baseDir}/scripts/pay_solana.py https://api.x402layer.cc/e/weather-data\n\n# Pay with Coinbase Agentic Wallet (AWAL)\npython {baseDir}/scripts/awal_cli.py pay-url https://api.x402layer.cc/e/weather-data\n```\n\n### B. Credit-Based Access (Fastest)\n\nPre-purchase credits for instant access without blockchain latency:\n\n```bash\n# Check your balance\npython {baseDir}/scripts/check_credits.py weather-data\n\n# Buy credits (consumer purchasing credits)\npython {baseDir}/scripts/recharge_credits.py weather-data pack_100\n\n# Use credits for instant access\npython {baseDir}/scripts/consume_credits.py https://api.x402layer.cc/e/weather-data\n```\n\n### C. Discover Services\n\n```bash\n# Browse all services\npython {baseDir}/scripts/discover_marketplace.py\n\n# Search by keyword\npython {baseDir}/scripts/discover_marketplace.py search weather\n\n# AWAL bazaar discovery\npython {baseDir}/scripts/awal_cli.py run bazaar list\n```\n\n---\n\n## Provider Flows\n\n### A. Create Endpoint ($1 one-time)\n\nDeploy your own monetized API:\n\n**Basic (not listed on marketplace):**\n```bash\npython {baseDir}/scripts/create_endpoint.py my-api \"My AI Service\" https://api.example.com 0.01 --no-list\n```\n\n**With marketplace listing (recommended):**\n```bash\npython {baseDir}/scripts/create_endpoint.py my-api \"My AI Service\" https://api.example.com 0.01 \\\n    --category ai \\\n    --description \"AI-powered data analysis API\" \\\n    --logo https://example.com/logo.png \\\n    --banner https://example.com/banner.jpg\n```\n\n**Available categories:** `ai`, `data`, `finance`, `utility`, `social`, `gaming`\n\n> **Note**: Save the `API Key` from the output and use it to secure your origin server.\n\n> ⚠️ **IMPORTANT - How Credits Work:**\n> - **Cost:** $1 one-time, includes **4,000 credits** (NOT test credits!)\n> - **Consumption:** 1 credit is deducted for **each API request** to your endpoint\n> - **When credits reach 0:** Your endpoint **stops working** until you recharge\n> - **Recharge:** Use `topup_endpoint.py` to add more credits ($1 = 500 credits)\n> - **Users pay YOU:** Each user payment goes to your wallet, then 1 credit is used\n\nIncludes 4,000 starting credits.\n\n### B. Manage Your Endpoint\n\n```bash\n# List your endpoints\npython {baseDir}/scripts/manage_endpoint.py list\n\n# View stats\npython {baseDir}/scripts/manage_endpoint.py stats my-api\n\n# Update price\npython {baseDir}/scripts/manage_endpoint.py update my-api --price 0.02\n```\n\n### C. Recharge Your Endpoint (Required to Keep It Working)\n\n**Your endpoint consumes 1 credit per request.** When credits run out, it stops working. Recharge to keep it active:\n\n```bash\n# Add $10 worth of credits (5,000 credits at 500 credits/$1)\npython {baseDir}/scripts/topup_endpoint.py my-api 10\n\n# Check remaining credits first\npython {baseDir}/scripts/manage_endpoint.py stats my-api\n```\n\n> ⚠️ **Remember:** `topup_endpoint.py` is for **providers** to recharge THEIR endpoint.\n> `recharge_credits.py` is for **consumers** to buy credits at someone else's endpoint.\n\n### D. Marketplace Listing Management\n\nMarketplace listing can be done **during creation** OR **separately afterward**:\n\n**Option 1: During Creation** (Recommended)\n```bash\npython {baseDir}/scripts/create_endpoint.py my-api \"My API\" https://api.example.com 0.01 \\\n    --category ai \\\n    --description \"AI-powered analysis\" \\\n    --logo https://example.com/logo.png \\\n    --banner https://example.com/banner.jpg\n```\n\n**Option 2: After Creation** (Update or List Later)\n```bash\n# List or update marketplace listing\npython {baseDir}/scripts/list_on_marketplace.py my-api \\\n    --category ai \\\n    --description \"AI-powered analysis\" \\\n    --logo https://example.com/logo.png \\\n    --banner https://example.com/banner.jpg\n\n# Unlist from marketplace\npython {baseDir}/scripts/list_on_marketplace.py my-api --unlist\n```\n\n> **Tip:** Use `list_on_marketplace.py` to update your listing anytime - change category, description, or images without recreating the endpoint.\n\n### E. Webhooks (Payment Notifications)\n\nReceive `payment.succeeded` events when someone pays for your endpoint. Optional — not required for endpoints to work.\n\n**Set webhook at creation time:**\n```bash\npython {baseDir}/scripts/create_endpoint.py my-api \"My API\" https://api.example.com 0.01 \\\n    --webhook-url https://my-server.com/webhook\n```\n\n**Add or update webhook on existing endpoint:**\n```bash\npython {baseDir}/scripts/manage_webhook.py set my-api https://my-server.com/webhook\n```\n\n**Check webhook status:**\n```bash\npython {baseDir}/scripts/manage_webhook.py info my-api\n```\n\n**Remove webhook:**\n```bash\npython {baseDir}/scripts/manage_webhook.py remove my-api\n```\n\n> ⚠️ **IMPORTANT**: The `signing_secret` is returned only once when you set a webhook. Save it immediately.\n\n#### Webhook Event Format\n\nYour endpoint receives POST requests with:\n```http\nContent-Type: application/json\nX-X402-Event: payment.succeeded\nX-X402-Signature: t=<timestamp>,v1=<hmac_sha256>\n```\n\n```json\n{\n  \"id\": \"event-uuid\",\n  \"type\": \"payment.succeeded\",\n  \"created_at\": \"2026-01-01T00:00:00.000Z\",\n  \"data\": {\n    \"source\": \"endpoint\",\n    \"source_slug\": \"my-api\",\n    \"amount\": 0.01,\n    \"currency\": \"USDC\",\n    \"tx_hash\": \"0x...\",\n    \"payer_wallet\": \"0x...\",\n    \"network\": \"base\",\n    \"status\": \"confirmed\"\n  }\n}\n```\n\n#### Verify Webhook Signature\n```python\nimport hmac, hashlib\ndef verify(secret, timestamp, body, received_sig):\n    expected = hmac.new(secret.encode(), f\"{timestamp}.{body}\".encode(), hashlib.sha256).hexdigest()\n    return hmac.compare_digest(expected, received_sig)\n```\n\n> **When credits = 0**, no requests go through, so no payments happen and no webhook events fire. Self-regulating.\n\n---\n\n## Payment Technical Details\n\n### Base (EVM) - EIP-712 Signatures\n\nUses USDC `TransferWithAuthorization` (EIP-3009):\n- Gasless for payer\n- Facilitator settles on-chain\n- 100% reliable\n\n### Solana - Versioned Transactions\n\nUses `VersionedTransaction` with `MessageV0`:\n- Facilitator pays gas (from `extra.feePayer`)\n- SPL Token `TransferChecked` instruction\n- ~75% success rate (retry logic included)\n\n---\n\n## Environment Reference\n\n| Variable | Required For | Description |\n|----------|--------------|-------------|\n| `PRIVATE_KEY` | Base payments (private-key mode) | EVM private key (0x...) |\n| `WALLET_ADDRESS` | All operations | Your wallet address |\n| `SOLANA_SECRET_KEY` | Solana payments | JSON array of bytes |\n| `X402_USE_AWAL` | AWAL mode | Set `1` to enable Coinbase Agentic Wallet for Base |\n| `X402_AUTH_MODE` | Auth selection (optional) | `auto`, `private-key`, or `awal` (default: auto) |\n| `X402_PREFER_NETWORK` | Network selection (optional) | `base` or `solana` (default: base) |\n| `AWAL_PACKAGE` | AWAL mode (optional) | NPM package/version for AWAL CLI (default: `awal@1.0.0`) |\n| `AWAL_BIN` | AWAL mode (optional) | Preinstalled `awal` binary path/name |\n| `AWAL_FORCE_NPX` | AWAL mode (optional) | Set `1` to force npx even when `awal` binary exists |\n\n---\n\n## API Base URL\n\n- **Endpoints:** `https://api.x402layer.cc/e/{slug}`\n- **Marketplace:** `https://api.x402layer.cc/api/marketplace`\n- **Credits:** `https://api.x402layer.cc/api/credits/*`\n- **Agent API:** `https://api.x402layer.cc/agent/*`\n\n---\n\n## Resources\n\n- 📖 **Documentation:** [studio.x402layer.cc/docs/agentic-access/openclaw-skill](https://studio.x402layer.cc/docs/agentic-access/openclaw-skill)\n- 💻 **GitHub Docs:** [github.com/ivaavimusic/SGL_DOCS_2025](https://github.com/ivaavimusic/SGL_DOCS_2025)\n- 🐦 **OpenClaw:** [x.com/openclaw](https://x.com/openclaw)\n- 🌐 **x402 Studio:** [studio.x402layer.cc](https://studio.x402layer.cc)\n\n---\n\n## Known Issues\n\n⚠️ **Solana payments** have ~75% success rate due to facilitator-side fee payer infrastructure issue. Retry logic is included in `pay_solana.py`. **Base (EVM) payments are 100% reliable** and recommended for production.\n\nFile v1.2.0:_meta.json\n\n{\n  \"ownerId\": \"kn73xndw522wt8y06avyd39a8h7ztbeh\",\n  \"slug\": \"x402-layer\",\n  \"version\": \"1.2.0\",\n  \"publishedAt\": 1772182986877\n}\n\nFile v1.2.0:references/agentic-endpoints.md\n\n# Agentic Endpoint Creation\n\nDeploy your own monetized API endpoints programmatically.\n\n## Endpoint\nPOST https://api.x402layer.cc/agent/endpoints\n\n## Pricing\nCreate: $1 (4,000 credits included)\nTop-up: $1 = 500 credits\n\n## Create Flow\n1. POST with endpoint config (name, slug, origin_url, chain)\n2. Get 402 challenge\n3. Sign with EIP-712\n4. Send X-Payment header\n5. Receive gateway URL and API key\n\n## Top-Up\nPUT /agent/endpoints/<slug> with topup_amount\n\n## Check Status\nGET /agent/endpoints/<slug> with x-api-key header\n\nFile v1.2.0:references/credit-based.md\n\n# Credit-Based Access\n\nFor high-frequency or latency-sensitive API calls. Pre-purchase credits, consume instantly.\n\n## Why Use Credits?\n\n- Zero latency (no blockchain wait)\n- Zero gas fees per request\n- Simple header-based access\n\n## Usage\n\n### Check Balance\n```bash\ncurl \"https://api.x402layer.cc/api/credits/balance?endpoint=<slug>\" \\\n  -H \"x-wallet-address: 0xYourWallet...\"\n```\n\n### Consume Endpoint\n```bash\ncurl \"https://api.x402layer.cc/e/<slug>\" \\\n  -H \"x-wallet-address: 0xYourWallet...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"{\\\"prompt\\\": \\\"your request\\\"}\"\n```\n\n### Insufficient Credits Response\nWhen out of credits, you get a 402 with purchase options:\n\n```json\n{\n  \"error\": \"Insufficient credits\",\n  \"current_balance\": 0,\n  \"purchase_url\": \"https://studio.x402layer.cc/pay/credits/<slug>\",\n  \"credit_package\": {\"size\": 69, \"price\": 0.01},\n  \"accepts\": [...]\n}\n```\n\n## Purchasing Credits\n\nUse the standard 402 flow on the `purchase_url`:\n\n1. GET the purchase URL\n2. Parse 402 challenge  \n3. Sign EIP-712 payment\n4. Send with X-Payment header\n5. Credits added to wallet\n\n## Example Python\n\n```python\nimport requests\n\ndef call_with_credits(url, wallet, data):\n    resp = requests.post(url, \n        json=data,\n        headers={\"x-wallet-address\": wallet})\n    \n    if resp.status_code == 402:\n        print(\"Need credits!\", resp.json()[\"purchase_url\"])\n        return None\n    \n    return resp.json()\n```\n\n## Scripts\n\n- `check_credits.py` - Query balance\n- `consume_with_credits.py` - Use credits\n- `recharge_credits.py` - Top up via payment\n\nFile v1.2.0:references/marketplace.md\n\n# Marketplace Discovery\n\nBrowse, search, and consume x402 marketplace services.\n\n## Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/api/marketplace` | GET | List all public listings |\n| `/api/marketplace/search?q=<term>` | GET | Search by keyword |\n| `/api/marketplace/featured` | GET | Featured listings |\n| `/api/marketplace/<slug>` | GET | Single endpoint details |\n| `/api/marketplace/list` | POST | List endpoint (provider) |\n| `/api/marketplace/unlist` | POST | Remove from marketplace |\n\n## Categories\n`ai`, `data`, `finance`, `utility`, `social`, `gaming`\n\n## Example: Browse All\n\n```bash\npython discover_marketplace.py\n```\n\n## Example: Consume Found Service\n\n```bash\n# Get details for an endpoint\npython discover_marketplace.py details weather-api\n\n# Pay and consume\npython pay_base.py https://api.x402layer.cc/e/weather-api\n```\n\n## Scripts\n\n- `discover_marketplace.py` - Browse/search marketplace\n- `list_on_marketplace.py` - List/unlist your endpoint\n\nFile v1.2.0:references/pay-per-request.md\n\n# Pay-Per-Request (Direct Mode)\n\nPay-Per-Request uses the HTTP 402 Payment Required status code to negotiate payment for each individual API call.\n\n## Critical: EIP-712 Signatures\n\n**x402 uses EIP-712 typed data signatures, NOT raw ERC20 transfers.**\n\nThe facilitator validates and broadcasts the payment. You only need to sign a permit.\n\n## Coinbase Agentic Wallet (AWAL) Shortcut\n\nIf you do not want local private-key signing, use AWAL:\n\n```bash\npython {baseDir}/scripts/awal_cli.py run auth login agent@example.com\npython {baseDir}/scripts/awal_cli.py run auth verify <flow_id> <otp>\npython {baseDir}/scripts/awal_cli.py pay-url https://api.x402layer.cc/e/my-endpoint\n```\n\n---\n\n## Interaction Cycle\n\n### 1. Naïve Request\n\n```bash\ncurl https://api.x402layer.cc/e/my-endpoint\n```\n\n### 2. Parse 402 Challenge\n\n```json\n{\n  \"x402Version\": 1,\n  \"accepts\": [\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"base\",\n      \"maxAmountRequired\": \"10000\",\n      \"payTo\": \"0xCD95802A4aBddD75A5750DD2d6935007eF268275\",\n      \"asset\": \"eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n      \"extra\": {\n        \"name\": \"USD Coin\",\n        \"version\": \"2\"\n      }\n    },\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"solana\",\n      \"maxAmountRequired\": \"10000\",\n      \"payTo\": \"3rcdSzTam4h5e6UN2USv5L2t9R4Ah466B4mHgxRVEqCx\",\n      \"asset\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n      \"extra\": {\n        \"feePayer\": \"BENrLoUbndxoNMUS5JXApGMtNykLjFXXixMtpDwDR9SP\"\n      }\n    }\n  ]\n}\n```\n\n### 3. Sign Payment (EIP-712)\n\n```python\nimport os\nimport time\nimport json\nimport base64\nfrom eth_account import Account\nfrom eth_account.messages import encode_typed_data\n\ndef sign_x402_payment(challenge, wallet_address, private_key):\n    \"\"\"Sign x402 payment using EIP-712 (NOT raw ERC20 transfer)\"\"\"\n    \n    # Find Base option\n    base_option = next((a for a in challenge[\"accepts\"] if a[\"network\"] == \"base\"), None)\n    if not base_option:\n        raise ValueError(\"No Base payment option\")\n    \n    # Domain from extra field\n    extra = base_option.get(\"extra\", {})\n    domain = {\n        \"name\": extra.get(\"name\", \"USD Coin\"),\n        \"version\": extra.get(\"version\", \"2\"),\n        \"chainId\": 8453,\n        \"verifyingContract\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\"\n    }\n    \n    # EIP-712 types for TransferWithAuthorization\n    types = {\n        \"TransferWithAuthorization\": [\n            {\"name\": \"from\", \"type\": \"address\"},\n            {\"name\": \"to\", \"type\": \"address\"},\n            {\"name\": \"value\", \"type\": \"uint256\"},\n            {\"name\": \"validAfter\", \"type\": \"uint256\"},\n            {\"name\": \"validBefore\", \"type\": \"uint256\"},\n            {\"name\": \"nonce\", \"type\": \"bytes32\"},\n        ]\n    }\n    \n    # Message data\n    nonce = os.urandom(32)\n    message = {\n        \"from\": wallet_address,\n        \"to\": base_option[\"payTo\"],\n        \"value\": int(base_option[\"maxAmountRequired\"]),\n        \"validAfter\": 0,\n        \"validBefore\": int(time.time()) + 3600,\n        \"nonce\": nonce,\n    }\n    \n    # Sign\n    encoded = encode_typed_data(domain, types, message)\n    signed = Account.sign_message(encoded, private_key)\n    \n    # Build X-Payment payload\n    payment_obj = {\n        \"x402Version\": 1,\n        \"scheme\": \"exact\",\n        \"network\": \"base\",\n        \"payload\": {\n            \"signature\": signed.signature.hex(),\n            \"from\": wallet_address,\n            \"to\": base_option[\"payTo\"],\n            \"value\": str(message[\"value\"]),\n            \"validAfter\": str(message[\"validAfter\"]),\n            \"validBefore\": str(message[\"validBefore\"]),\n            \"nonce\": \"0x\" + nonce.hex(),\n        }\n    }\n    \n    return base64.b64encode(json.dumps(payment_obj).encode()).decode()\n```\n\n### 4. Authorized Request\n\n```python\nimport requests\n\nx_payment = sign_x402_payment(challenge, wallet, key)\nresponse = requests.get(url, headers={\"X-Payment\": x_payment})\nprint(response.json())\n```\n\n---\n\n## Free Endpoints (maxAmountRequired = \"0\")\n\nEven if amount is 0, you MUST still send a signed payload. This authenticates the caller.\n\n---\n\n## Solana Payments\n\nSolana uses SPL Token transfers (not EIP-712). The transaction must include the `feePayer` from challenge.\n\n```python\nfrom solders.keypair import Keypair\nfrom solders.transaction import Transaction\nfrom solders.pubkey import Pubkey\nfrom spl.token.instructions import transfer_checked\nimport base64\n\n# Build SPL transfer transaction\n# Include feePayer from challenge extra\n# Serialize and base64 encode\n```\n\n---\n\n## Common Errors\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| \"Invalid signature\" | Using raw transfer() | Use EIP-712 signing |\n| \"Nonce already used\" | Replay attack | Generate fresh random nonce |\n| \"validBefore expired\" | Timeout | Set validBefore = now + 3600 |\n| \"Wrong domain\" | Bad name/version | Use \"USD Coin\" v2 for Base USDC |\n\nFile v1.2.0:references/payment-signing.md\n\n# Payment Signing Reference\n\n## Critical Understanding\n\nx402 uses EIP-712 typed data signatures for TransferWithAuthorization. The facilitator verifies signatures and settles the payment.\n\n## Base (EVM) - EIP-712 Signing\n\n### Domain (Base USDC)\n```python\ndomain = {\n    \"name\": \"USD Coin\",\n    \"version\": \"2\",\n    \"chainId\": 8453,\n    \"verifyingContract\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\"\n}\n```\n\n### Types\n```python\ntypes = {\n    \"TransferWithAuthorization\": [\n        {\"name\": \"from\", \"type\": \"address\"},\n        {\"name\": \"to\", \"type\": \"address\"},\n        {\"name\": \"value\", \"type\": \"uint256\"},\n        {\"name\": \"validAfter\", \"type\": \"uint256\"},\n        {\"name\": \"validBefore\", \"type\": \"uint256\"},\n        {\"name\": \"nonce\", \"type\": \"bytes32\"},\n    ]\n}\n```\n\n### Signing\n```python\nfrom eth_account import Account\nfrom eth_account.messages import encode_typed_data\nimport os, time\n\nmessage = {\n    \"from\": wallet,\n    \"to\": challenge[\"payTo\"],\n    \"value\": int(challenge[\"maxAmountRequired\"]),\n    \"validAfter\": 0,\n    \"validBefore\": int(time.time()) + 3600,\n    \"nonce\": os.urandom(32),\n}\n\nencoded = encode_typed_data(domain, types, message)\nsigned = Account.sign_message(encoded, private_key)\n```\n\n## Solana - SPL Transfer\n\nSolana uses SPL Token transfers with base64 encoding.\n\n## Coinbase Agentic Wallet (AWAL) Mode\n\nYou can avoid direct key management by using AWAL:\n\n```bash\npython {baseDir}/scripts/awal_cli.py run auth login agent@example.com\npython {baseDir}/scripts/awal_cli.py run auth verify <flow_id> <otp>\npython {baseDir}/scripts/awal_cli.py pay-url https://api.x402layer.cc/e/weather-data\n```\n\nAWAL package version can be pinned:\n\n```bash\nexport AWAL_PACKAGE=\"awal@1.0.0\"\n```\n\n## X-Payment Header Format\n\nBase64 encode the payment JSON:\n```python\nimport json, base64\nx_payment = base64.b64encode(json.dumps(payload).encode()).decode()\n```\n\nFile v1.2.0:SETUP_AWAL.md\n\n# Setup Guide: Coinbase Agentic Wallet (AWAL) CLI\n\nTo use the `x402-layer` skill with Coinbase Agentic Wallet (AWAL) for Base payments, you need to install the `awal` CLI tool.\n\n## Prerequisites\n\n- Node.js (version 18+ recommended)\n- NPM or Yarn\n\n## Option 1: Global Installation (Recommended)\n\nInstalling globally allows you to run `awal` commands directly from any directory.\n\n```bash\nnpm install -g awal\n```\n\nVerify installation:\n```bash\nawal --version\n```\n\n## Option 2: Using NPX (No Installation Required)\n\nYou can run commands without installing `awal` globally by prefixing with `npx`.\n\n```bash\nnpx awal --version\n```\n\n## Authentication\n\n1.  **Login**: Start the authentication process. You will receive an email with an OTP.\n    ```bash\n    # If installed globally:\n    awal auth login your-email@example.com\n\n    # If using npx:\n    npx awal auth login your-email@example.com\n    ```\n\n2.  **Verify**: Check your email for the OTP and complete the login.\n    ```bash\n    # Replace <flow-id> and <otp-code> with values from the login step and email.\n    awal auth verify <flow-id> <otp-code>\n    ```\n\n3.  **Check Status**: Confirm you are logged in.\n    ```bash\n    awal status\n    ```\n\n## Configuration for x402-layer\n\nOnce setup, ensure you export the necessary environment variable to enable AWAL mode in the scripts:\n\n```bash\nexport X402_USE_AWAL=1\n```\n\nFile v1.2.0:requirements.txt\n\n# x402 Layer - Python Dependencies\n# Install: pip install -r requirements.txt\n\n# EVM/Base payments - Required for EIP-712 signing\neth-account>=0.10.0\nweb3>=6.0.0\n\n# HTTP requests\nrequests>=2.28.0\n\n# Environment variables\npython-dotenv>=1.0.0\n\n# Solana payments - Optional, only needed for Solana network\n# Uncomment if using Solana:\n# solders>=0.20.0\n# solana>=0.30.0","readmeExcerpt":"Skill: x402 Singularity Layer Owner: ivaavimusic Summary: This skill should be used when the user asks to \"create x402 endpoint\", \"deploy monetized API\", \"pay for API with USDC\", \"check x402 credits\", \"consume API c... Tags: ERC8004:1.2.0, SGL:1.2.1, Stripe:1.2.1, agentic:1.1.3, agentic access:1.2.1, agentic webhooks:1.2.1, api:1.2.1, awal:1.1.1, base:1.2.1, coinbase:1.1.1, credits:1.2.1, latest:1.2.1, marketplace:1.","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"pip install -r {baseDir}/requirements.txt"},{"language":"bash","snippet":"# For Base (EVM)\nexport PRIVATE_KEY=\"0x...\"\nexport WALLET_ADDRESS=\"0x...\"\n\n# For Solana (optional)\nexport SOLANA_SECRET_KEY=\"[1,2,3,...]\"  # JSON array"},{"language":"bash","snippet":"# First, install and set up AWAL (one-time setup)\nnpx skills add coinbase/agentic-wallet-skills\n\n# Then enable AWAL mode for this skill\nexport X402_USE_AWAL=1"},{"language":"http","snippet":"x-api-key: <YOUR_API_KEY>"},{"language":"text","snippet":"User pays $0.01 → Your wallet receives payment → 1 credit deducted from your endpoint"},{"language":"bash","snippet":"# Pay with Base (EVM) - 100% reliable\npython {baseDir}/scripts/pay_base.py https://api.x402layer.cc/e/weather-data\n\n# Pay with Solana - includes retry logic\npython {baseDir}/scripts/pay_solana.py https://api.x402layer.cc/e/weather-data\n\n# Pay with Coinbase Agentic Wallet (AWAL)\npython {baseDir}/scripts/awal_cli.py pay-url https://api.x402layer.cc/e/weather-data"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: x402-layer\nversion: 1.2.1\ndescription: |\n  This skill should be used when the user asks to \"create x402 endpoint\",\n  \"deploy monetized API\", \"pay for API with USDC\", \"check x402 credits\",\n  \"consume API credits\", \"list endpoint on marketplace\", \"buy API credits\",\n  \"topup endpoint\", \"browse x402 marketplace\", \"set up webhook\",\n  \"receive payment notifications\", \"manage endpoint webhook\",\n  use \"Coinbase Agentic Wallet (AWAL)\", or manage x402 Singularity Layer\n  operations on Base or Solana networks.\nhomepage: https://studio.x402layer.cc/docs/agentic-access/openclaw-skill\nmetadata:\n  clawdbot:\n    emoji: \"⚡\"\n    homepage: https://studio.x402layer.cc\n    os:\n      - linux\n      - darwin\n    requires:\n      bins:\n        - python3\n      env:\n        # Core credentials (required for payments)\n        - WALLET_ADDRESS\n        - PRIVATE_KEY\n        # Solana payments (required for Solana network)\n        - SOLANA_SECRET_KEY\n        # Provider operations (required for endpoint management)\n        - X_API_KEY\n        - API_KEY\n        # AWAL mode (optional - for Coinbase Agentic Wallet)\n        - X402_USE_AWAL\n        - X402_AUTH_MODE\n        - X402_PREFER_NETWORK\n        - AWAL_PACKAGE\n        - AWAL_BIN\n        - AWAL_FORCE_NPX\nallowed-tools:\n  - Read\n  - Write\n  - Edit\n  - Bash\n  - WebFetch\n---\n\n\n# x402 Singularity Layer\n\nx402 is a **Web3 payment layer** enabling AI agents to:\n- 💰 **Pay** for API access using USDC\n- 🚀 **Deploy** monetized endpoints\n- 🔍 **Discover** services via marketplace\n- 📊 **Manage** endpoints and credits\n- 🔔 **Webhooks** — receive payment notifications\n\n**Networks:** Base (EVM) • Solana  \n**Currency:** USDC  \n**Protocol:** HTTP 402 Payment Required\n\n---\n\n## Quick Start\n\n### 1. Install Dependencies\n```bash\npip install -r {baseDir}/requirements.txt\n```\n\n### 2. Set Up Wallet (Choose One Mode)\n\n#### Option A: Private Keys (existing mode)\n```bash\n# For Base (EVM)\nexport PRIVATE_KEY=\"0x...\"\nexport WALLET_ADDRESS=\"0x...\"\n\n# For Solana (optional)\nexport SOLANA_SECRET_KEY=\"[1,2,3,...]\"  # JSON array\n```\n\n#### Option B: Coinbase Agentic Wallet (AWAL)\n\nFor Base payments without exposing private keys, use Coinbase Agentic Wallet:\n\n```bash\n# First, install and set up AWAL (one-time setup)\nnpx skills add coinbase/agentic-wallet-skills\n\n# Then enable AWAL mode for this skill\nexport X402_USE_AWAL=1\n```\n\n> **Note**: See [Coinbase AWAL docs](https://docs.cdp.coinbase.com/agentic-wallet/welcome) for full setup instructions. You'll need to authenticate and fund your AWAL wallet with USDC on Base.\n\nOnce AWAL is configured, all Base payment scripts will automatically use it instead of PRIVATE_KEY.\n\n---\n\n## ⚠️ Security Notice\n\n> **IMPORTANT**: This skill handles private keys for signing blockchain transactions.\n>\n> - **Never use your primary custody wallet** - Create a dedicated wallet with limited funds\n> - **Private keys are used locally only** - They sign transactions locally and are never transmitted\n> - **Signed payloads are sent to "},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn73xndw522wt8y06avyd39a8h7ztbeh\",\n  \"slug\": \"x402-layer\",\n  \"version\": \"1.2.1\",\n  \"publishedAt\": 1772198367315\n}"},{"path":"references/agentic-endpoints.md","content":"# Agentic Endpoint Creation\n\nDeploy your own monetized API endpoints programmatically.\n\n## Endpoint\nPOST https://api.x402layer.cc/agent/endpoints\n\n## Pricing\nCreate: $1 (4,000 credits included)\nTop-up: $1 = 500 credits\n\n## Create Flow\n1. POST with endpoint config (name, slug, origin_url, chain)\n2. Get 402 challenge\n3. Sign with EIP-712\n4. Send X-Payment header\n5. Receive gateway URL and API key\n\n## Top-Up\nPUT /agent/endpoints/<slug> with topup_amount\n\n## Check Status\nGET /agent/endpoints/<slug> with x-api-key header"},{"path":"references/credit-based.md","content":"# Credit-Based Access\n\nFor high-frequency or latency-sensitive API calls. Pre-purchase credits, consume instantly.\n\n## Why Use Credits?\n\n- Zero latency (no blockchain wait)\n- Zero gas fees per request\n- Simple header-based access\n\n## Usage\n\n### Check Balance\n```bash\ncurl \"https://api.x402layer.cc/api/credits/balance?endpoint=<slug>\" \\\n  -H \"x-wallet-address: 0xYourWallet...\"\n```\n\n### Consume Endpoint\n```bash\ncurl \"https://api.x402layer.cc/e/<slug>\" \\\n  -H \"x-wallet-address: 0xYourWallet...\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"{\\\"prompt\\\": \\\"your request\\\"}\"\n```\n\n### Insufficient Credits Response\nWhen out of credits, you get a 402 with purchase options:\n\n```json\n{\n  \"error\": \"Insufficient credits\",\n  \"current_balance\": 0,\n  \"purchase_url\": \"https://studio.x402layer.cc/pay/credits/<slug>\",\n  \"credit_package\": {\"size\": 69, \"price\": 0.01},\n  \"accepts\": [...]\n}\n```\n\n## Purchasing Credits\n\nUse the standard 402 flow on the `purchase_url`:\n\n1. GET the purchase URL\n2. Parse 402 challenge  \n3. Sign EIP-712 payment\n4. Send with X-Payment header\n5. Credits added to wallet\n\n## Example Python\n\n```python\nimport requests\n\ndef call_with_credits(url, wallet, data):\n    resp = requests.post(url, \n        json=data,\n        headers={\"x-wallet-address\": wallet})\n    \n    if resp.status_code == 402:\n        print(\"Need credits!\", resp.json()[\"purchase_url\"])\n        return None\n    \n    return resp.json()\n```\n\n## Scripts\n\n- `check_credits.py` - Query balance\n- `consume_with_credits.py` - Use credits\n- `recharge_credits.py` - Top up via payment"},{"path":"references/marketplace.md","content":"# Marketplace Discovery\n\nBrowse, search, and consume x402 marketplace services.\n\n## Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/api/marketplace` | GET | List all public listings |\n| `/api/marketplace/search?q=<term>` | GET | Search by keyword |\n| `/api/marketplace/featured` | GET | Featured listings |\n| `/api/marketplace/<slug>` | GET | Single endpoint details |\n| `/api/marketplace/list` | POST | List endpoint (provider) |\n| `/api/marketplace/unlist` | POST | Remove from marketplace |\n\n## Categories\n`ai`, `data`, `finance`, `utility`, `social`, `gaming`\n\n## Example: Browse All\n\n```bash\npython discover_marketplace.py\n```\n\n## Example: Consume Found Service\n\n```bash\n# Get details for an endpoint\npython discover_marketplace.py details weather-api\n\n# Pay and consume\npython pay_base.py https://api.x402layer.cc/e/weather-api\n```\n\n## Scripts\n\n- `discover_marketplace.py` - Browse/search marketplace\n- `list_on_marketplace.py` - List/unlist your endpoint"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":2104,"uniquenessScore":36,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-09T14:46:33.371Z","emptyReason":null},"items":[{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-10T18:48:31.762Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}