abra5umente/api-proxy

a small python container that lets you proxy requests from claude's cloud container through your home network

License:MITLanguage:Python160
APIclaude-aiclaude-skillsllmproxy-server

Deep Analysis

一个Python代理服务器,让Claude云容器通过用户家庭网络IP访问被云服务器IP封禁的API(如Reddit)

Core Features

Technical Implementation

Highlights
  • 解决Claude云容器访问Reddit等封禁云IP服务的痛点问题
  • 提供完整的Claude Skills集成方案,包含可复用的proxy_helper.py模块
  • 安全设计:Token认证+域名白名单+Tunnel隐藏,无需直接暴露端口
  • 开箱即用的Docker Compose配置和一键部署脚本
Use Cases
  • 通过Claude访问Reddit API进行内容抓取和分析
  • 访问封禁数据中心IP的游戏API或第三方服务
  • 需要住宅IP才能访问的地理位置敏感服务
  • 绕过云服务器IP频率限制的API调用
  • 开发需要真实用户网络环境的Claude Skills
Limitations
  • 需要用户自行搭建Cloudflare Tunnel和Docker环境
  • 依赖用户家庭网络稳定性,网络中断会导致代理失败
  • 住宅IP也可能被某些服务标记,不是万能解决方案
  • 需要手动维护域名白名单,管理成本较高
  • 仅支持HTTP/HTTPS协议,不支持WebSocket等其他协议
Tech Stack
PythonFlaskDockerCloudflare TunnelClaude Skills API

API Proxy for Claude Skills

Routes API requests through your residential IP for services that block cloud/datacenter IPs (like Reddit, some game APIs, etc).

Why?

Claude's container runs from cloud infrastructure. Some APIs (notably Reddit) block requests from known cloud IP ranges. This proxy lets Claude's skills route requests through your home network instead.

Claude Container → Your Cloudflare Tunnel → This Proxy → Target API
     (blocked)                                              (allowed!)

Quick Start

1. Build and deploy

docker build -t your-registry/api-proxy:latest .
docker push your-registry/api-proxy:latest

2. Add to Docker Compose

services:
  api-proxy:
    image: your-registry/api-proxy:latest
    container_name: api-proxy
    restart: unless-stopped
    environment:
      - PROXY_AUTH_TOKEN=your-secure-token-here
      - ALLOWED_DOMAINS=reddit.com,www.reddit.com,oauth.reddit.com
      - PROXY_TIMEOUT=30
    networks:
      - your-network

3. Expose via Cloudflare Tunnel

Add a route in your config.yml or Zero Trust dashboard:

- hostname: proxy.yourdomain.com
  service: http://api-proxy:8000

4. Whitelist in Claude

Add proxy.yourdomain.com to your Claude allowed domains in Settings.

Environment Variables

Variable Required Default Description
PROXY_AUTH_TOKEN Yes changeme Auth token for requests
ALLOWED_DOMAINS No (all) Comma-separated domain whitelist
PROXY_TIMEOUT No 30 Request timeout in seconds

API Reference

GET /health

Health check endpoint. No authentication required.

curl https://proxy.yourdomain.com/health
# {"status": "ok"}

POST /proxy

Proxy a request through residential IP. Requires X-Proxy-Token header.

Request body:

{
  "url": "https://api.example.com/endpoint",
  "method": "GET",
  "headers": {"User-Agent": "MyBot/1.0"},
  "body": "{\"optional\": \"request body\"}"
}

Response:

{
  "status_code": 200,
  "headers": {"content-type": "application/json", ...},
  "body": "{\"response\": \"from target API\"}"
}

Claude Skills Integration

This proxy is designed to work with Claude's Skills system. A ready-to-use skill is included in the skill/ directory:

skill/
├── skill.md          # Skill definition
├── proxy_helper.py   # Reusable helper module
└── fetch.py          # Ad-hoc fetch script

Quick Start

Ad-hoc requests (when direct fetch fails with 403):

python3 skill/fetch.py "https://api.example.com/endpoint"
python3 skill/fetch.py "https://api.example.com/endpoint" POST '{"key": "value"}'

Building new skills: Copy skill/proxy_helper.py into your skill's scripts/ folder, then:

from proxy_helper import proxy_get, proxy_request

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

See skill/skill.md for full documentation.


Security

  • Auth token: Required for all /proxy requests. Generate with python3 -c "import secrets; print(secrets.token_urlsafe(32))"
  • Domain whitelist: Restrict which APIs can be proxied
  • No direct exposure: Only accessible via Cloudflare Tunnel
  • No host port binding: Container doesn't expose ports to host network

Token Storage

Your token lives in:

  1. Container environment variables (not publicly visible)
  2. Your skill files (in Claude's private /mnt/skills/user/ directory)

Troubleshooting

Error Cause Fix
401 from proxy Invalid token Check X-Proxy-Token matches PROXY_AUTH_TOKEN
403 from proxy Domain not whitelisted Add domain to ALLOWED_DOMAINS
503 from proxy Rate limited / upstream error Retry after delay
504 from proxy Timeout Increase PROXY_TIMEOUT
Connection refused Proxy not running Check container status and CF tunnel

License

MIT

Highly Recommended
agents

wshobson/agents

wshobson

Intelligent automation and multi-agent orchestration for Claude Code

The most comprehensive Claude Code plugin ecosystem, covering full-stack development scenarios with a three-tier model strategy balancing performance and cost.

25.6k2.8k3 days ago
Highly Recommended
awesome-claude-skills

ComposioHQ/awesome-claude-skills

ComposioHQ

A curated list of awesome Claude Skills, resources, and tools for customizing Claude AI workflows

The most comprehensive Claude Skills resource list; connect-apps is a killer feature.

19.9k2.0k3 days ago
Recommended
oh-my-opencode

code-yeongyu/oh-my-opencode

code-yeongyu

The Best Agent Harness. Meet Sisyphus: The Batteries-Included Agent that codes like you.

Powerful multi-agent coding tool, but note OAuth limitations.

17.5k1.2k3 days ago
Recommended
claude-mem

thedotmack/claude-mem

thedotmack

A Claude Code plugin that automatically captures everything Claude does during your coding sessions, compresses it with AI (using Claude's agent-sdk), and injects relevant context back into future sessions.

A practical solution for Claude's memory issues.

14.0k9143 days ago
Highly Recommended
planning-with-files

OthmanAdi/planning-with-files

OthmanAdi

Claude Code skill implementing Manus-style persistent markdown planning — the workflow pattern behind the $2B acquisition.

Context engineering best practices; an open-source implementation of Manus mode.

9.3k8113 days ago
Highly Recommended
Skill_Seekers

yusufkaraaslan/Skill_Seekers

yusufkaraaslan

Convert documentation websites, GitHub repositories, and PDFs into Claude AI skills with automatic conflict detection

An automation powerhouse for skill creation, dramatically improving efficiency.

6.8k6833 days ago