通过 Tao Private Network 的去中心化 SOCKS5 代理路由网络流量——这是一个 Bittensor 子网(SN65),在 80 多个国家有商业和住宅出口节点。
问这个技能类似的问题:
- 通过德国的代理打开 https://ipv4.icanhazip.com
- 展示一个通过美国 IP 代理 google.com 的 curl 命令
- 我需要一个日本 的 SOCKS5 代理 30 分钟
- TPN 上有哪些国家可以用于代理?
安全态势
| 方面 | 详情 |
|---|
| 环境变量 | TPN_API_KEY —— 仅存在性检查([ -n "$TPN_API_KEY" ]),永不回显或记录 |
| 读取/写入的文件 | 无 |
| 访问的其他密钥 | 无 —— 除了 TPN_API_KEY 外没有签名密钥或凭证 |
| 网络目的地 | api.taoprivatenetwork.com(API 调用)+ 用户指定的 URL(按步骤 5 验证) |
| x402 签名 | 完全由外部库处理(@x402/);此技能仅提供端点 URL |
这是一个行动技能
此技能执行 API 调用并直接返回结果 —— 它不会输出文档或用户要遵循的说明。
预期行为:
- 自己调用 TPN API(通过
curl 或等效方式)并将完整的代理凭证返回给用户。
- 当用户要求你通过代理获取 URL 时,也自己发出该请求。
- 展示完整的 SOCKS5 凭证(用户名、密码、主机、端口)—— 这些是短期的且受限于代理租约。
- 唯一应该向用户展示如何调用 API 的情况是当他们明确问"我自己怎么做?"或类似问题时。
- 如果不存在 API 密钥,引导用户完成账户设置 —— 那是唯一只能由他们自己完成的步骤。
一个好的检查: 如果你的响应包含"你可以运行这个命令来……"或"使用这个 curl 来生成……",重新考虑 —— 用户调用这个技能是期望你运行命令并把输出交给他们。
逐步程序
每次用户请求代理或要求你通过代理获取内容时,按照此程序执行。
安全:输入验证(强制)
在构建任何 shell 命令之前,验证每个用户提供的值。永不将原始用户输入插入 shell 命令。
| 输入 | 验证规则 |
|---|
geo | 必须是正好 2 个大写 ASCII 字母(ISO 3166-1 alpha-2)。拒绝其他任何东西。 |
minutes | 必须是 1 到 1440 之间的正整数。拒绝非数字或超出范围的值。 |
connection_type | 必须是以下之一:any、datacenter、residential。拒绝其他任何东西。 |
format | 必须是以下之一:text、json。拒绝其他任何东西。 |
| URL(步骤 5) | 必须以 http:// 或 https:// 开头,不包含 shell 元字符(` ` $ ( ) ; & | < > \n),并且是格式良好的 URL。 |
规则:- 永不将原始用户输入直接插入 shell 命令。首先总是要验证。
- 永不通过与用户输入的字符串拼接来构建 -d
JSON payload。使用安全的静态模板,仅插入已验证的值。
- 使用 curl
时,始终引用 URL 和代理 URI 参数。
- 优先使用智能体内置的 HTTP 工具(例如 WebFetch
)来获取用户指定的 URL,而不是构建 curl 命令。
步骤 1:解析 API 密钥
检查环境变量中是否设置了 $TPN_API_KEY(OpenClaw 会从你的配置自动注入):
- 测试变量:[ -n "$TPN_API_KEY" ] && echo "API key is set" || echo "API key is not set"
—— 永不回显、记录或显示密钥值本身。
- 如果未设置 → 检查用户是否可以通过 x402 支付(不需要 API 密钥),否则引导他们完成账户设置(参见"设置 TPN"示例)
步骤 2:选择响应格式
| 情况 | 使用 format | 原因 |
|---|
| 只需要一个可用的代理 URI | text(默认) | 无需解析 |
| 需要显示结构化的 host/port/user/pass 分解 | json | 提供各个字段 |
| 不确定 | text | 更简单,更少出错 |
如果选择 json
,用 jq
解析响应:curl -s ... | jq -r '.vpnConfig.username'
如果
jq
不可用,改用 format=text
—— 它返回一个不需要解析的纯 socks5://
URI。不要使用
python -c
、grep
、cut
或其他基于 shell 的 JSON 解析回退。当与动态输入结合时,这些模式有 shell 注入风险。坚持使用 jq
或 format=text
。步骤 3:生成代理
curl -s -X POST https://api.taoprivatenetwork.com/api/v1/proxy/generate \
-H "Content-Type: application/json" \
-H "X-API-Key: $TPN_API_KEY" \
-d '{"minutes": 60, "format": "text", "connection_type": "any"}'
将用户的请求映射到这些参数:
| 字段 | 类型 | 必填 | 默认值 | 描述 |
|---|
minutes | integer | 是 | — | 租约时长(1–1440)。如未指定默认为 60。 |
geo | string | 否 | any | ISO 国家代码(如 "US"、"DE"、"JP") |
format | string | 否 | text | "text" 为 URI 字符串,"json" 为对象 |
connection_type | string | 否 | any | "any"、"datacenter" 或 "residential" |
安全的 JSON body 构建:始终将
-d
JSON payload 构建为带引号的静态字符串,仅插入已验证的值。在构建 curl 命令之前,按照上述验证规则验证 geo
(2 个大写字母)、minutes
(整数 1–1440)、connection_type
(枚举)和 format
(枚举)。永不将原始用户输入拼接到 JSON body 或命令的任何部分。步骤 4:呈现结果
展示完整的代理凭证以便用户可以立即连接。这些是临时的(受限于租约时长)且在上下文中可以安全显示。使用
socks5h://
方案(带 h
)以确保 DNS 通过代理解析 —— 这保护用户 DNS 隐私。(当智能体在步骤 5 获取 URL 时,它使用 socks5://
—— 参见步骤 5。)包括:- 结构化配置块(主机、端口、用户名、密码、方案、过期时间)
- 完整的
socks5h://
URI
相关的即贴即用 curl
示例步骤 5:如果用户要求你获取 URL
生成代理后,自己发出请求。使用
socks5://
(不是 socks5h://
)以便 DNS 在本地解析 —— 连接的 IP 是已验证的 IP。使用智能体内置的 HTTP 工具(例如
WebFetch
)通过代理获取 URL。这是首选方法 —— 它完全避免了 shell 命令构建。URL 验证 —— 获取前每一项检查都必须通过:
http://
或 https://
无 shell 元字符: `
$
(
)
;
&
|
<
>
换行符
仅限域名 —— 拒绝原始 IP 地址(IPv4 或 IPv6)
拒绝内部主机名:.internal
、.local、.localhost
、.localdomain、.corp
、.lan、metadata.、单标签主机名
主机名必须通过本地 DNS 解析 —— 拒绝无法解析的主机名
解析的 IP 必须是公开可路由的 —— 拒绝 127.0.0.0/8
、10.0.0.0/8
、172.16.0.0/12
、192.168.0.0/16
、169.254.0.0/16
、::1
、fd00::/8
、169.254.169.254
回退 —— curl(仅当 WebFetch 不可用时)。始终双引号引用 URL 和代理 URI:
curl --proxy "socks5://username:password@ip:port" \
--connect-timeout 10 --max-time 30 \
"https://validated-target-url.com"
将响应内容返回给用户 —— 目标是完整答案,不是他们仍需自己使用的代理。
示例
这些展示了用户具体问什么以及你应该回复什么。学习这些 —— 它们是黄金标准。
用户: "Give me a socks5 config for Belgium"
回复:
🇧🇪 Belgium SOCKS5 代理已生成!配置详情:
• 主机:be.socks5.tproxies.net
• 端口:1080
• 用户名:tpn_xxx
• 密码:xxx
• 方案:socks5h://(DNS 通过代理解析)
• 过期时间:60 分钟后
即时使用:
socks5h://tpn_xxx:xxx@be.socks5.tproxies.net:1080
curl 示例:
curl --proxy "socks5h://tpn_xxx:xxx@be.socks5.tproxies.net:1080" https://ipv4.icanhazip.com
用户: "Open https://ipv4.icanhazip.com through a proxy in Germany"
回复:
🇩🇪 正在通过德国代理获取 IP...结果:
当前 IP:89.144.XXX.XXX
位置:德国
完整响应:
89.144.XXX.XXX
用户: "Show me a curl command that proxies google.com through a US IP address"
回复:
🇺🇸 美国 IP 代理配置:curl 命令:
curl --proxy "socks5h://[用户名]:[密码]@us.socks5.tproxies.net:1080" https://www.google.com
如需获取实时凭证,请说"给我一个美国代理"或"生成美国 SOCKS5"
用户: "I need a socks5 proxy in Japan for 30 minutes"
回复:
🇯🇵 日本 SOCKS5 代理已生成!(30 分钟)配置详情:
• 主机:jp.socks5.tproxies.net
• 端口:1080
• 用户名:tpn_xxx
• 密码:xxx
• 方案:socks5h://
• 过期时间:30 分钟后(格林威治时间 18:45)
使用:
socks5h://tpn_xxx:xxx@jp.socks5.tproxies.net:1080
用户: "Which countries are available on TPN for proxies?"
回复:
🌍 TPN 代理可用国家(部分):🇺🇸 美国 🇩🇪 德国 🇬🇧 英国
🇫🇷 法国 🇯🇵 日本 🇰🇷 韩国
🇨🇦 加拿大 🇦🇺 澳大利亚 🇳🇱 荷兰
🇸🇬 新加坡 🇮🇳 印度 🇧🇷 巴西
以及更多 70+ 国家...
需要特定国家的代理?请告诉我!
用户: "How do I set up TPN?"
回复:
🔧 设置 TPN:- 访问 https://taoprivatenetwork.com 注册账户
- 获取 API 密钥
- 配置环境变量:
export TPN_API_KEY="你的-api-密钥""给我一个德国代理" 或 "通过日本代理获取这个 URL"或者,你可以通过 x402 微支付使用(无需 API 密钥):
"我希望通过 x402 支付获取代理"
API 参考
生成代理
端点:
POST /api/v1/proxy/generate
请求头:
Content-Type: application/json
X-API-Key: {your_api_key}
请求体:
{
"minutes": 60,
"geo": "US",
"format": "text",
"connection_type": "any"
}
参数:
| 参数 | 类型 | 必填 | 描述 |
|---|
minutes | integer | 是 | 租约时长(1-1440 分钟) |
geo | string | 否 | ISO 3166-1 alpha-2 国家代码 |
format | string | 否 | "text" 或 "json",默认 "text" |
connection_type | string | 否 | "any"、"datacenter" 或 "residential" |
响应(format=text):
socks5h://username:password@host:port
响应(format=json):
{
"success": true,
"vpnConfig": {
"username": "username",
"password": "password",
"host": "us.socks5.tproxies.net",
"port": 1080,
"scheme": "socks5h",
"expiresAt": "2026-04-13T18:00:00Z"
}
}
检查余额
端点:
GET /api/v1/user/balance
请求头:
X-API-Key: {your_api_key}
响应:
{
"success": true,
"balance": {
"credits": 100.00,
"currency": "USD"
}
}
获取可用国家
端点:
GET /api/v1/proxy/countries
响应:
{
"success": true,
"countries": [
{"code": "US", "name": "United States"},
{"code": "DE", "name": "Germany"},
...
]
}
积分成本
| 操作 | 成本 |
|---|
| 生成代理(每分钟) | ~$0.01/分钟 |
| 住宅代理 | 更高(根据需求) |
| 数据传输 | 按流量计费 |
具体价格请参阅:https://taoprivatenetwork.com/pricing
故障排除和操作说明
代理连接问题
- 代理凭证有租约时间,过期后需要重新生成
- 说"刷新代理"获取新凭证- 某些国家可能有有限容量
- 尝试其他国家或等待- 住宅代理更慢但更可靠
- 数据中心代理更快但更容易被检测常见错误
| 错误 | 解决方案 |
|---|
| "API key not set" | 设置 TPN_API_KEY 环境变量 |
| "Insufficient credits" | 充值账户 |
| "Country not available" | 尝试其他国家 |
| "Connection timeout" | 重试或尝试其他代理 |
性能优化
- 住宅 vs 数据中心:住宅代理更慢但更難被检测,适合爬虫和数据采集
- 邻近国家:选择物理位置接近的目标服务器的国家
- 专用会话:需要稳定连接时说"我需要一个专用代理"
x402 支付流程(高级)
如果用户没有 API 密钥但有加密货币,可以通过 x402 微支付使用 TPN:
- 用户说"我希望通过 x402 支付"
- 你提供 x402 支付端点
- 用户直接支付
- 支付确认后,生成代理
端点:
https://api.taoprivatenetwork.com/api/v1/proxy/generate-x402`
x402 头部:
x402-amount: 0.05
x402-accept: true
x402-payment-url: https://payment.example.com/pay
链接
- 官网:https://taoprivatenetwork.com
- 文档:https://docs.taoprivatenetwork.com
- 支持:https://taoprivatenetwork.com/support
- x402:https://www.x402.org
Route web traffic through Tao Private Network's decentralized SOCKS5 proxies — a Bittensor subnet (SN65) with commercial and residential exit nodes across 80+ countries.
Ask this skill things like:
- Open https://ipv4.icanhazip.com through a proxy in Germany
- Show me a curl command that proxies google.com through a US ip address
- I need a socks5 proxy in Japan for 30 minutes
- Which countries are available on TPN for proxies?
Security Posture
| Aspect | Detail |
|---|
| Environment variables | TPN_API_KEY — existence-checked only ([ -n "$TPN_API_KEY" ]), never echoed or logged |
| Files read/written | None |
| Other secrets accessed | None — no signing keys, no credentials beyond TPN_API_KEY |
| Network destinations | api.taoprivatenetwork.com (API calls) + user-specified URLs (validated per Step 5) |
| x402 signing | Handled entirely by external libraries (@x402/); this skill provides endpoint URLs only |
This is an action skill
This skill executes API calls and returns results directly — it does not output documentation or instructions for the user to follow.
Expected behaviour:
- Call the TPN API yourself (via
curl or equivalent) and return the full proxy credentials to the user.
- When the user asks you to fetch a URL through a proxy, make that request yourself too.
- Show the full SOCKS5 credentials (username, password, host, port) — these are short-lived and scoped to the proxy lease.
- The only time you should show the user how to call the API is when they explicitly ask "how do I do this myself?" or similar.
- If no API key exists, guide the user through account setup — that's the one step only they can do.
A good check: if your response contains "you can run this command to…" or "use this curl to generate…", reconsider — the user invoked this skill expecting you to run the command and hand them the output.
Step-by-Step Procedure
Follow this procedure every time the user requests a proxy or asks you to fetch something through a proxy.
Security: Input validation (mandatory)
Before constructing any shell command, validate every user-provided value. Never interpolate raw user input into shell commands.
| Input | Validation rule |
|---|
geo | Must be exactly 2 uppercase ASCII letters (ISO 3166-1 alpha-2). Reject anything else. |
minutes | Must be a positive integer between 1 and 1440. Reject non-numeric or out-of-range values. |
connection_type | Must be one of: any, datacenter, residential. Reject anything else. |
format | Must be one of: text, json. Reject anything else. |
| URLs (for Step 5) | Must start with http:// or https://, contain no shell metacharacters (` ` $ ( ) ; & | < > \n), and be a well-formed URL. |
Rules:- Never interpolate raw user input directly into shell commands. Always validate first.
- Never construct -d
JSON payloads via string concatenation with user input. Use a safe static template and only insert validated values.
- When using curl
, always quote the URL and proxy URI arguments.
- Prefer using the agent's built-in HTTP tools (e.g. WebFetch
) for fetching user-specified URLs rather than constructing curl commands.
Step 1: Resolve the API key
Check whether $TPN_API_KEY is set in the environment (OpenClaw injects this automatically from your config):
- Test the variable: [ -n "$TPN_API_KEY" ] && echo "API key is set" || echo "API key is not set"
— never echo, log, or display the key value itself.
- If not set → check if the user can pay via x402 (no API key needed), otherwise guide them through account setup (see the "Set up TPN" example)
Step 2: Choose response format
| Situation | Use format | Why |
|---|
| Just need a working proxy URI | text (default) | No parsing needed |
| Need to show structured host/port/user/pass breakdown | json | Gives individual fields |
| Not sure | text | Simpler, fewer things to break |
If you choose json
, parse the response with jq
:curl -s ... | jq -r '.vpnConfig.username'
If
jq
is not available, use format=text
instead — it returns a plain socks5://
URI that needs no parsing.Do not use
python -c
, grep
, cut
, or other shell-based JSON parsing fallbacks. These patterns risk shell injection when combined with dynamic inputs. Stick to jq
or format=text
.Step 3: Generate the proxy
curl -s -X POST https://api.taoprivatenetwork.com/api/v1/proxy/generate \
-H "Content-Type: application/json" \
-H "X-API-Key: $TPN_API_KEY" \
-d '{"minutes": 60, "format": "text", "connection_type": "any"}'
Map the user's request to these parameters:
| Field | Type | Required | Default | Description |
|---|
minutes | integer | yes | — | Lease duration (1–1440). Default to 60 if not specified. |
geo | string | no | any | ISO country code (e.g. "US", "DE", "JP") |
format | string | no | text | "text" for URI string, "json" for object |
connection_type | string | no | any | "any", "datacenter", or "residential" |
Safe JSON body construction: Always build the
-d
JSON payload as a static single-quoted string with only validated values inserted. Validate geo
(2 uppercase letters), minutes
(integer 1–1440), connection_type
(enum), and format
(enum) per the validation rules above before constructing the curl command. Never concatenate raw user input into the JSON body or any part of the command.Step 4: Present the result
Show the full proxy credentials so the user can immediately connect. These are temporary (scoped to the lease duration) and safe to display in context. Use the
socks5h://
scheme (with h
) to ensure DNS resolves through the proxy — this protects user DNS privacy. (When the agent fetches URLs in Step 5, it uses socks5://
instead — see Step 5.) Include:- Structured config block (host, port, username, password, scheme, expiry)
- Full
socks5h://
URI
A ready-to-paste curl
example when relevantStep 5: If the user asked you to fetch a URL
After generating the proxy, make the request yourself. Use
socks5://
(not socks5h://
) so DNS resolves locally — the validated IP is the connected IP.Use the agent's built-in HTTP tools (e.g.
WebFetch
) to fetch the URL through the proxy. This is the preferred method — it avoids shell command construction entirely.URL validation — every check must pass before fetching:
http://
or https://
No shell metacharacters: `
$
(
)
;
&
|
<
>
newlines
Domain names only — reject raw IP addresses (IPv4 or IPv6)
Reject internal hostnames: .internal
, .local, .localhost
, .localdomain, .corp
, .lan, metadata., single-label hostnames
Hostname must resolve via local DNS — reject unresolvable hostnames
Resolved IP must be publicly routable — reject 127.0.0.0/8
, 10.0.0.0/8
, 172.16.0.0/12
, 192.168.0.0/16
, 169.254.0.0/16
, ::1
, fd00::/8
, 169.254.169.254
Fallback — curl (only if WebFetch is unavailable). Always double-quote the URL and proxy URI:
curl --proxy "socks5://username:password@ip:port" \
--connect-timeout 10 --max-time 30 \
"https://validated-target-url.com"
Return the response content to the user — the goal is a complete answer, not a proxy they still need to use themselves.
Examples
These show exactly what users ask and what you should respond. Study these — they are the gold standard.
User: "Give me a socks5 config for Belgium"
You: (generate a BE proxy yourself, then respond:)
Here's your Belgian SOCKS5 proxy (valid 60 minutes):
>
> Host: 185.42.170.3
Port: 1080
Username: u_0CKaBqdE
Password: p_sT6yM3zabqRuhqrahzGOl4i4RTEDgQ7V
Scheme: socks5h
Expires: 2026-02-16T15:30:00Z
>
Full URI:
socks5h://u_0CKaBqdE:p_sT6yM3zabqRuhqrahzGOl4i4RTEDgQ7V@185.42.170.3:1080
>
curl example:
>
> curl --proxy socks5h://u_0CKaBqdE:p_sT6yM3zabqRuhqrahzGOl4i4RTEDgQ7V@185.42.170.3:1080 \
--connect-timeout 10 --max-time 30 \
https://ipv4.icanhazip.com
>
This should return a Belgian IP. The proxy expires in 60 minutes — let me know if you need a longer lease.
User: "Show me a curl command that proxies over Germany"
You: (generate a DE proxy yourself, then respond:)
Here's a curl command routed through a German proxy:
>
> curl --proxy socks5h://u_0E4k7kJ6:p_z2HsXTEXJHYiobwCcfOaU1YMS1tg3m0i@5.39.255.64:1080 \
--connect-timeout 10 --max-time 30 \
https://example.com
>
Replace
https://example.com
with your target URL. This proxy expires at 2026-02-16T14:47:20Z.
User: "Call icanhazip.com from the Netherlands"
You: (generate an NL proxy yourself, fetch icanhazip.com through it, then respond:)
I fetched
https://ipv4.icanhazip.com
through a Dutch proxy. The response:
>
> 82.148.30.91
>
That's the exit IP in the Netherlands. The proxy is still active until 2026-02-16T15:12:00Z if you need more requests.
User: "I need a residential US proxy for 2 hours"
You: (generate a US residential proxy with minutes=120, then respond:)
Here's your US residential proxy (valid 2 hours, 25 credits):
>
> Host: 68.210.185.149
Port: 1080
Username: u_02NyffuT
Password: p_CIYLqgIyLZ1rSvZGQbdh3lyxQQBcBsQn
Scheme: socks5h
Type: residential
Expires: 2026-02-16T16:41:00Z
>
Full URI:
socks5h://u_02NyffuT:p_CIYLqgIyLZ1rSvZGQbdh3lyxQQBcBsQn@68.210.185.149:1080
>
Residential IPs are less likely to be blocked. Let me know if you need a different country.
User: "How many credits do I have left?"
You: (call
GET /api/v1/user/balance
yourself, then respond:)You have 74 credits remaining.
>
For reference, a 60-minute proxy costs 20 credits and a 10-minute proxy costs 10 credits. You can buy more at https://api.taoprivatenetwork.com — packages start at 1,000 credits for $9.99.
User: "Use a proxy to check if my site looks right from Germany"
You: (generate a DE proxy, fetch their site through it, then respond:)
I fetched your site through a German proxy (IP:
91.203.50.12
):
>
- Status: 200 OK
- Content-Language:
de
— looks like your site detected the German IP and served the German version
- Page title: "Willkommen bei Example"
>
Everything seems to be working correctly for German visitors. Want me to check from another country?
User: "Set up TPN" / "How do I get started with TPN?"
You: (check if a key already exists — if yes, tell them they're set up; if no:)
To get started with TPN:
>
1. Go to https://api.taoprivatenetwork.com and create an account
2. From the dashboard, create an API key (it'll look like
tpn-abc123...
)
3. Your first key comes with 100 free credits — enough for about 5 one-hour proxies
>
Once you have the key, share it with me and I'll save it for future sessions. Then I can generate proxies for you anytime.
The pattern: the user asks, you act, you return results. You never tell the user how to call the API — you call it yourself and hand them the output.
API Reference
Base URL:
https://api.taoprivatenetwork.com
Authentication: Pass
X-API-Key:
as a request header. Not Authorization: Bearer.Endpoints
| Method | Path | Auth | Description |
|---|
| POST | /api/v1/proxy/generate | API key | Generate SOCKS5 proxy |
| POST | /api/v1/vpn/generate | API key | Generate WireGuard VPN |
| GET | /api/v1/user/balance | API key | Check credit balance |
| GET | /api/v1/vpn/countries | none | List available countries |
| POST | /api/v1/vpn/cost | none | Calculate credit cost |
| GET | /api/v1/vpn/stats | none | Network statistics |
| GET | /api/v1/health | none | Health check |
| POST | /api/v1/x402/proxy/generate | x402 | Generate SOCKS5 proxy (x402) |
| POST | /api/v1/x402/vpn/generate | x402 | Generate WireGuard VPN (x402) |
Response shapes
/proxy/generate with format=text:{
"success": true,
"vpnConfig": "socks5://u_02NyffuT:p_CIYLqgIyLZ1rSvZGQbdh3lyxQQBcBsQn@9.160.73.2:1080",
"minutes": 60,
"expiresAt": "2026-02-14T19:08:25.690Z",
"creditsUsed": 20,
"type": "socks5"
}
/proxy/generate with format=json:{
"success": true,
"vpnConfig": {
"username": "u_0CKaBqdE",
"password": "p_sT6yM3zabqRuhqrahzGOl4i4RTEDgQ7V",
"ip_address": "68.210.185.149",
"port": 1080
},
"minutes": 60,
"expiresAt": "2026-02-14T19:08:23.958Z",
"creditsUsed": 20,
"usedFallback": false,
"type": "socks5",
"connection_type": "any"
}
/vpn/countries query parameters| Param | Type | Default | Description |
|---|
format | string | json | "json" for array, "text" for newline-separated |
type | string | code | "code" for ISO codes, "name" for full names |
connection_type | string | any | "any", "datacenter", or "residential" |
Using the proxy (for user-facing code examples)
Only show these if the user explicitly asks "how do I use this in my code?" — otherwise just hand them the config.
User-facing code should always use
socks5h:// (with h) to resolve DNS through the proxy, preserving DNS privacy. (The agent uses socks5:// for its own fetching in Step 5, where local DNS resolution is a security feature — see Step 5.)If proxy credentials contain special characters (
@, :, /, #, ?), percent-encode them (e.g. p@ss → p%40ss).curl:
curl --proxy socks5h://username:password@ip_address:port \
--connect-timeout 10 --max-time 30 \
https://ipv4.icanhazip.com
Node.js:
import { SocksProxyAgent } from 'socks-proxy-agent'
import fetch from 'node-fetch'const agent = new SocksProxyAgent( 'socks5h://username:password@ip_address:1080' )
const controller = new AbortController()
const timeout = setTimeout( () => controller.abort(), 30_000 )
const response = await fetch( 'https://ipv4.icanhazip.com', { agent, signal: controller.signal } )
clearTimeout( timeout )
console.log( await response.text() )
Python:
import requestsproxies = {
'http': 'socks5h://username:password@ip_address:1080',
'https': 'socks5h://username:password@ip_address:1080'
}
response = requests.get( 'https://ipv4.icanhazip.com', proxies=proxies, timeout=( 10, 30 ) )
print( response.text )
See
{baseDir}/references/api-examples.md for end-to-end examples (generate + use) in curl, JS, Node.js, and Python.
Credit Costs
Formula:
credits = ceil( 4.1 × minutes ^ 0.375 )| Duration | Credits |
|---|
| 1 min | 5 |
| 5 min | 8 |
| 10 min | 10 |
| 30 min | 15 |
| 60 min | 20 |
| 120 min | 25 |
| 720 min | 49 |
| 1440 min | 63 |
Use POST /api/v1/vpn/cost with {"minutes": N} to calculate before purchasing.Credit packages: Starter 1,000/$9.99 · Pro 5,000/$49.99 · Premium 20,000/$199.99
Troubleshooting & Operational Notes
| Problem | Solution |
|---|
401 Unauthorized | Verify API key is valid — use X-API-Key header, not Bearer |
402 Payment Required | Insufficient credits — buy more or use the x402 flow |
503 Service Unavailable | No miners available — credits are refunded, retry later |
| Connection timeout | Proxy lease may have expired — generate a new one |
| DNS not resolving (user) | Use socks5h:// (with h) for remote DNS resolution |
| DNS not resolving (agent) | Agent uses socks5:// — verify local DNS resolution in check 5 |
Operational rules:- User-facing credentials and code examples: always use
socks5h:// for DNS privacy
Agent-side fetching (Step 5): always use socks5:// so local DNS validation is authoritative
Check credit balance with GET /api/v1/user/balance before generating proxies in bulk
Proxy leases expire at expiresAt — never cache or reuse credentials beyond that time
If a 503 occurs, credits are refunded automatically — retry after a short delay
x402 Payment Flow (Advanced)
The x402 protocol enables pay-per-request access using USDC on Base. No account or API key needed — ideal for autonomous agents that already support x402.
If you are an x402-capable agent, you already know how to handle the payment handshake. The TPN x402 endpoints follow the standard protocol:
POST /api/v1/x402/proxy/generate — returns HTTP 402 with a standard payment-required header
Complete the x402 payment flow per the protocol specification
Retry with the payment header to receive SOCKS5 credentialsSame request body as the centralised endpoint. No
X-API-Key needed.See
{baseDir}/references/x402-examples.md` for curl and browser JS examples, and the x402 spec for full protocol details. Signing is handled entirely by external libraries — this skill provides endpoint URLs only.
Links
- Dashboard & Account: https://api.taoprivatenetwork.com
- API Docs: https://api.taoprivatenetwork.com/docs/getting-started/
- Swagger UI: https://api.taoprivatenetwork.com/api-docs/
- OpenAPI Spec: https://api.taoprivatenetwork.com/api-docs/openapi.json
- LLM-friendly docs: https://api.taoprivatenetwork.com/docs/llms-full.txt
- x402 Protocol: https://www.x402.org