Open a Cloudflare Tunnel so Google AI Studio can reach your local nSelf instance — without exposing it permanently to the internet.
# Start the bridge on the default port (8080)
nself ai-studio bridge
# Start on a specific port with context disabled
nself ai-studio bridge --port 9090 --no-contextnself ai-studio bridge [FLAGS]Google AI Studio supports custom tool endpoints, but they must be reachable from the public internet. nself ai-studio bridge starts a temporary Cloudflare Tunnel (via cloudflared) that forwards HTTPS traffic from a random *.trycloudflare.com subdomain to your local nSelf API.
By default the bridge also injects nSelf project context (stack version, plugin list, env) into the AI Studio system prompt so the AI understands your deployment. Use --no-context to disable this if you only want a raw tunnel.
The tunnel closes when you press Ctrl+C or when the idle timeout expires. No persistent configuration is written to Cloudflare — each run generates a fresh ephemeral URL.
The only subcommand. Starts the Cloudflare Tunnel bridge.
nself ai-studio bridge
# Tunnel URL: https://random-name.trycloudflare.com
# Paste this into Google AI Studio → Connections → Custom endpoint
# Press Ctrl+C to close| Flag | Type | Default | Description |
|---|---|---|---|
--port | int | 8080 | Local port to expose through the tunnel |
--no-context | bool | false | Do not inject nSelf project context into AI Studio system prompt |
--dry-run | bool | false | Print the tunnel command without starting it |
--idle-timeout | int | 300 | Seconds of inactivity before auto-closing the tunnel |
--ip-allowlist | string | Comma-separated CIDR ranges allowed through the tunnel (e.g. 66.249.0.0/16) | |
--region | string | auto | Cloudflare region for the tunnel endpoint (us, eu, auto) |
nself ai-studio bridge
# Prints: https://abc123.trycloudflare.com
# Paste URL into AI Studio as your tool endpoint
# nSelf context automatically injected into system promptnself ai-studio bridge --port 9090 --region eunself ai-studio bridge --ip-allowlist "66.249.0.0/16,64.233.160.0/19"nself ai-studio bridge --dry-run
# Outputs: cloudflared tunnel --url http://localhost:8080 --region autonself ai-studio bridge --idle-timeout 60cloudflared must be installed: brew install cloudflare/cloudflare/cloudflarednself plugin status aiNSELF_AI_STUDIO_PORT — default port to expose (overrides --port)CLOUDFLARED_BIN — path to the cloudflared binary if not in PATH0 — tunnel closed cleanly (Ctrl+C or idle timeout)1 — cloudflared not found or tunnel failed to start2 — invalid arguments