AgentSkillsCN

api-proxy

通过用户的住宅代理路由API请求,以绕过云IP封锁。两种用例——(1) 当直接curl/fetch因403/被阻止错误而失败时的运行时回退,使用fetch.py快速重试。(2) 用于构建需要代理路由的新技能的模板,将proxy_helper.py复制到新技能中。

SKILL.md
--- frontmatter
name: api-proxy
description: Routes API requests through the user's residential proxy to bypass cloud IP blocks. TWO use cases - (1) Runtime fallback when direct curl/fetch fails with 403/blocked errors, use fetch.py for quick retry. (2) Template for building new skills that need proxy routing, copy proxy_helper.py into the new skill.

API Proxy Skill

Routes requests through residential IP via proxy.address.here.com.

Runtime Fallback (ad-hoc)

When a direct request fails with 403 or IP blocking, retry through the proxy:

bash
# Simple GET
python3 /mnt/skills/user/api-proxy/scripts/fetch.py "https://api.example.com/endpoint"

# POST with body
python3 /mnt/skills/user/api-proxy/scripts/fetch.py "https://api.example.com/endpoint" POST '{"key": "value"}'

Returns JSON response or {"error": "message"} on failure.

Template Mode (building skills)

When creating skills that need proxy routing:

  1. Copy proxy_helper.py into the new skill's scripts/ folder
  2. Import and use:
python
from proxy_helper import proxy_get, proxy_request

data = proxy_get("https://api.example.com/endpoint")

data = proxy_request(
    url="https://api.example.com/endpoint",
    method="POST",
    headers={"Authorization": "Bearer xyz"},
    body='{"key": "value"}'
)

Proxy Details

code
URL: https://proxy.address.here.com/proxy
Token: your_token_here

Currently Whitelisted Domains

  • reddit.com, www.reddit.com, oauth.reddit.com

New domains require user to add them to ALLOWED_DOMAINS env var and restart the container.

Troubleshooting

ErrorCauseFix
403 from proxyDomain not whitelistedAsk user to whitelist
503 from proxyRate limitedRetry after delay
504 from proxyUpstream timeoutIncrease timeout
Connection refusedContainer/tunnel downCheck status