소스 정보
- 저장소
- second-state/x402-skill
- 최근 소스 활동
- 2026년 2월 14일 06:48
- 감지된 SKILL.md 언어
- 영어
- 스타
- 6
- 포크
- 2
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/second-state/x402-skill --skill x402명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | x402 |
| description | Handle HTTP 402 Payment Required responses using x402 protocol |
| trigger | reactive |
When an HTTP request returns 402 Payment Required with x402 payment info, automatically retry using x402curl.
Only activate when all of the following are true:
402X-Payment header"x402Version" in JSONIf a 402 response lacks these markers, inform the user it requires payment but do not retry — it is not an x402 endpoint.
Step 1: Inform the user (one line):
This endpoint requires payment via x402. Retrying with x402curl...
Step 2: Transform the original curl command into an x402curl command.
Replace curl with {baseDir}/scripts/x402curl and adjust flags:
Preserve these flags as-is:
-X, -H, -d, --data, --data-binary, -o, -F, -u, -L, -f
Drop these flags (x402curl manages its own output):
-v, --verbose, -s, --silent
# Original
curl -X POST -s https://api.example.com/endpoint \
-H "Content-Type: application/json" \
-d '{"key": "value"}'
# Transformed
{baseDir}/scripts/x402curl -X POST https://api.example.com/endpoint \
-H "Content-Type: application/json" \
-d '{"key": "value"}'
Step 3: Execute and return the result. On success, show the response without mentioning payment again.
Map x402curl exit codes to user-friendly messages:
| Exit code | Meaning | Message |
|---|---|---|
| 1 | General error | "x402curl encountered an unexpected error. Run with --verbose to see details." |
| 2 | Network error | "Could not reach the payment network. Check your internet connection and try again." |
| 3 | Insufficient funds | "Payment failed: insufficient funds. Your wallet needs USDC on Base network. Testnet: get funds from https://www.alchemy.com/faucets/base-sepolia — Mainnet: transfer USDC to your wallet on Base." |
| 4 | HTTP error | "The server returned an error after payment. The API may have changed requirements or be temporarily unavailable." |
| 5 | Config error | "Wallet configuration error. Follow install.md to fix your setup." |
| 6 | RPC error | "Could not query wallet balance. The RPC endpoint may be unavailable. Try again or use --x402-rpc-url to specify a custom endpoint." |
When a user asks to check their wallet balance:
Step 1: Run with defaults (Base mainnet USDC):
{baseDir}/scripts/x402curl --x402-balance
Step 2: Show the result to the user.
Step 3: Ask: "Would you like to check a balance on a different network or token?"
If yes, ask for the RPC URL and token contract address. Then run:
{baseDir}/scripts/x402curl --x402-balance --x402-rpc-url <url> --x402-token <address>
# 1. Original request returns 402
curl https://paid-api.example.com/data
# → 402 with X-Payment header
# 2. Retry with x402curl
{baseDir}/scripts/x402curl https://paid-api.example.com/data
# → 200 with data
# 1. Original
curl -X POST https://translate.example.com/v1 \
-H "Content-Type: application/json" \
-d '{"text": "Hello", "target": "es"}'
# → 402 with x402Version in body
# 2. Retry
{baseDir}/scripts/x402curl -X POST https://translate.example.com/v1 \
-H "Content-Type: application/json" \
-d '{"text": "Hello", "target": "es"}'
# → 200 with translation
# 1. Original
curl -X POST https://ocr.example.com/extract -F "file=@document.pdf"
# → 402
# 2. Retry
{baseDir}/scripts/x402curl -X POST https://ocr.example.com/extract \
-F "file=@document.pdf"
# 1. Original
curl -o result.json https://paid-api.example.com/report
# → 402
# 2. Retry
{baseDir}/scripts/x402curl -o result.json https://paid-api.example.com/report
SOC 직업 분류 기준