Skip to content

cmd ai studio

github-actions[bot] edited this page May 18, 2026 · 1 revision

nself ai-studio

Google AI Studio integration for local nSelf instances via a secure Cloudflare Tunnel.

Synopsis

nself ai-studio <subcommand> [flags]
nself ai-studio bridge [flags]

Description

nself ai-studio connects a local nSelf Postgres instance to Google AI Studio so Gemini models can query your schema without any cloud deployment of your data.

The only current subcommand is bridge, which starts a local HTTP proxy and opens an ephemeral Cloudflare Tunnel (trycloudflare.com, no account required). The tunnel URL is printed to stdout; you paste it into AI Studio as a custom connector. The proxy sits between AI Studio and your Hasura GraphQL endpoint and enforces schema read-only access: no mutations, DDL, or DML pass through.

Each session issues a short-lived auth token (30-minute idle TTL by default) scoped to one project. On every response the proxy injects an X-Nself-Schema-Context header that carries your current Postgres schema so Gemini has full type information without making a separate introspection request. Pass --no-context to omit this header.

The bridge auto-closes when the idle timeout expires or on Ctrl-C. The cloudflared binary is downloaded automatically on first use if absent. The tunnel region defaults to auto but can be overridden with --region for latency tuning. IP access can be restricted to specific CIDR ranges with --ip-allowlist.

Passing --dry-run prints what would happen without starting the proxy or opening a tunnel.

Flags

ai-studio bridge

Flag Short Type Default Description
--port int 8890 Local proxy port
--no-context bool false Disable X-Nself-Schema-Context header injection
--dry-run bool false Print tunnel info without starting the proxy
--idle-timeout int 30 Auto-close tunnel after N minutes of inactivity
--ip-allowlist string "" Comma-separated CIDRs to restrict tunnel access (default: unrestricted)
--region string auto Cloudflare tunnel region

Examples

# Start the bridge with defaults
nself ai-studio bridge
# Start on a custom local port
nself ai-studio bridge --port 9000
# Skip schema context injection
nself ai-studio bridge --no-context
# Preview what would start without actually opening the tunnel
nself ai-studio bridge --dry-run
# Restrict access to your home network
nself ai-studio bridge --ip-allowlist 192.168.1.0/24
# Keep the tunnel open for 60 minutes of idle time
nself ai-studio bridge --idle-timeout 60
# Route the tunnel through a specific region
nself ai-studio bridge --region eu

See Also

Commands | Home

Home


Getting Started


Commands


Features


Configuration


Plugins (87 + 10 monitoring)

Free (25)
Pro (62)
Planned (26)
  • plugin-audit
  • plugin-blog
  • plugin-checkout
  • plugin-commerce
  • plugin-drm
  • plugin-export
  • plugin-flow
  • plugin-import
  • plugin-ldap
  • plugin-mailgun
  • plugin-media
  • plugin-oauth-providers
  • plugin-pages
  • plugin-postmark
  • plugin-rate-limit
  • plugin-reports
  • plugin-saml
  • plugin-scheduler
  • plugin-sendgrid
  • plugin-sso
  • plugin-subscription
  • plugin-thumb
  • plugin-transcoder
  • plugin-twilio
  • plugin-waf
  • plugin-watermark

Guides


Architecture


Reference


Licensing


Security


Brand


Operations


Contributing


Admin


Changelog

Clone this wiki locally