Skip to main content
Cloudflare tunnels expose your local task app via Cloudflare. Use them when you need stable public URLs or when your infra already uses Cloudflare.

Modes

  • Quick tunnels: ephemeral URLs, no Cloudflare API key
  • Managed tunnels: stable subdomains, requires API key

Quick tunnels

Ephemeral URLs via Cloudflare’s public service.
from synth_ai.core.tunnels import TunneledLocalAPI, TunnelBackend

tunnel = await TunneledLocalAPI.create(
    local_port=8001,
    backend=TunnelBackend.CloudflareQuickTunnel,
)
print(tunnel.url)

Managed tunnels

Stable subdomains that persist across sessions.
tunnel = await TunneledLocalAPI.create(
    local_port=8001,
    backend=TunnelBackend.CloudflareManagedLease,
    api_key="sk_live_...",
)

Auth

Use the task app API key:
job = PromptLearningJob.from_dict(
    config,
    task_app_url=tunnel.url,
    task_app_api_key=env_api_key,
)

CLI fallback

cloudflared tunnel --config /dev/null --url http://127.0.0.1:8001

Non-SDK usage (Go, TypeScript, other)

If you are not using the Python SDK, you can still expose a local task app by running cloudflared directly and passing the resulting public URL to your job config (SDK, CLI, or API).

Go

Start your Go task app locally, then tunnel it:
go run ./cmd/taskapp
cloudflared tunnel --config /dev/null --url http://127.0.0.1:8001

TypeScript

Start your TS task app locally, then tunnel it:
pnpm dev  # or npm run dev
cloudflared tunnel --config /dev/null --url http://127.0.0.1:8001

Other runtimes

As long as your task app is reachable on localhost:<port>, you can tunnel it the same way and use the public URL in your job configuration.

Install cloudflared

brew install cloudflared