python-web-tunnel

Build Flask web apps with AI API backends and expose them via cloudflared tunnels.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/decniner/HermesP1 --skill python-web-tunnel-decniner
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-web-tunnel
Source: https://github.com/decniner/HermesP1/tree/main/.hermes-backup/skills/software-development/python-web-tunnel
Command: npx skills add https://github.com/decniner/HermesP1 --skill python-web-tunnel-decniner

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires flask, flask-cors, google-genai, openai, python-dotenv, cloudflared, and includes references (resource) components.

What problem does it solve? Local Flask apps with AI API backends fail when exposed to mobile or remote users because common tunnels drop long-running requests, CORS breaks cross-origin fetches, and free-tier AI APIs hit quota limits or return truncated JSON. ## Core Features & Use Cases - Single-Origin Flask Architecture: Serve frontend static files from the Flask backend to eliminate CORS issues and cross-tunnel fetch failures. - Tunnel Selection & AI API Handling: Use cloudflared for long-running requests, probe Gemini models for quota status, and recover truncated JSON responses with bracket-state parsing. - Use Case: Build a mobile-accessible video analysis dashboard where users upload videos from their phone, Gemini analyzes the footage, DeepSeek generates coaching feedback, and SQLite stores session history — all reachable through a cloudflared tunnel URL. ## Quick Start Ask the AI to build a Flask app that serves a frontend dashboard, integrates the Gemini API with model quota probing, and exposes it through a cloudflared tunnel for mobile access.

Frequently Asked Questions about python-web-tunnel

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I expose a local Flask server to the internet for mobile access?▼

Use cloudflared with the command 'cloudflared tunnel --url http://localhost:PORT' to create a public URL without an account. It handles long-running requests over 30 seconds, unlike serveo.net or localtunnel which drop them.

Which tunnel service works best for long AI API requests?▼

cloudflared is the best choice because it handles requests lasting 30-120 seconds, which AI API calls often require. serveo.net drops long POSTs and localtunnel returns 503 errors under sustained load.

How do I handle Gemini API quota limits on the free tier?▼

Probe each available model with a test request and cache the results, then show users a dropdown marking models as available, quota exhausted, or error. Set up a fallback chain such as gemini-3.5-flash to gemini-2.5-flash-lite.

Why does Gemini return invalid JSON and how do I fix it?▼

Gemini truncates JSON mid-string when max_output_tokens is reached, even with response_mime_type set to JSON. Fix it by parsing character-by-character to find the last complete object, then auto-closing unclosed brackets.

Can I upload videos to the Gemini API from a Flask app?▼

Yes, use the Gemini File API: upload the file with client.files.upload, poll until its state leaves PROCESSING, then reference the returned URI via Part.from_uri in generate_content. Set Flask MAX_CONTENT_LENGTH for large uploads.

Why does my Flask app crash with NameError on MAX_CONTENT_LENGTH?▼

The constant referenced in app.config must be defined before app = Flask(__name__) executes. Python raises NameError when a variable is referenced before assignment, so define MAX_UPLOAD_MB at the top of the file.