CLI & Agent Tools

Install and sign in

The CLI authenticates with browser, paste, or pre-generated token flows.

curl -fsSL https://outgate.ai/download/install.sh | sh
og login
og status
  • Browser login starts a loopback listener and opens the console consent page.
  • Use og login --no-browser on SSH hosts, containers, or any machine where the browser cannot call back to the CLI.
  • Use og login --token-file /run/secrets/og-token for CI and scripts. Prefer token files over --token because command-line arguments can appear in process lists.

Wrap Claude Code and Codex

og creates or reuses a provider share and launches the tool with gateway routing.

og claude
og claude --provider "Anthropic"
og claude --auth-mode env -p "explain this error"

og codex
og codex --provider "OpenAI"

When no provider is pinned, the CLI prefers routers first, then direct providers matching the wrapped tool. Interactive sessions can prompt when there are multiple matches; non-interactive runs ask you to pin a provider.

Codex routing detail

Codex currently ignores OPENAI_BASE_URL for its built-in OpenAI provider, so og codex creates a synthetic CODEX_HOME at ~/.codex/og with an outgate model provider pointing at the gateway. This keeps Codex sessions and auth usable while routing through Outgate.

Flag reference

Every flag the og CLI accepts, what it does, and its default value.

Flags marked “(passthrough)” are also accepted on og claude and og codex and are stripped from the args before the underlying tool runs.

FlagCommandDefaultPurpose
--provider <name-or-id>env, claude, codex, scan (passthrough)"" (auto-resolve: routers first, then direct providers matching the tool)Pin a specific provider or router. Use the name or the prv-/rtr- ID.
--name <project>env, claude, codex (passthrough)basename of the current directoryCustom project/share name. The share name groups requests in the console.
--auth-mode <url|env>env, claude, codex (passthrough)url"url" embeds the share key in the base URL as /_k/<key>; "env" sets the tool's API key env var (e.g. ANTHROPIC_API_KEY) instead. Claude in non-interactive mode (-p) requires "env".
--no-browserloginfalseSkip opening a browser for OAuth. Prints a URL + code to visit manually — required on SSH hosts, containers, headless CI.
--token <jwt>login""Use a pre-generated CLI token. Visible in ps; prefer --token-file for anything but a quick smoke test.
--token-file <path>login""Read a pre-generated CLI token from a file. Recommended for CI and scripts.
--client <claude|codex>mcp-search install"" (required)Target CLI for the MCP web-search stanza.
--uninstallmcp-search installfalseRemove the og-web-search stanza instead of writing it.
--category <name>vault addcredentialsDetection category. One of credentials, personal_information, sensitive_data.
--category <name>vault list"" (no filter)Filter vault entries by category.
--source <name>vault list"" (no filter)Filter by source: auto-detect, kv-scan, manual.
--tag <label>vault add / vault rm""On add: optional label (max 200 chars). On rm: deletes all entries whose tag contains this substring.
--project <path>scancurrent directoryDirectory to scan.
--help, -hallPrint help for the subcommand. og --help lists every subcommand.

Tool-native flags pass through

Any flag og does not recognize is forwarded verbatim to the underlying tool. For example, og claude --model claude-3-5-sonnet reaches Claude Code unchanged; only --provider, --name, and --auth-mode are consumed by og itself.

Configuration resolution

Flags win, then project config, environment variables, global config, and defaults.

PriorityLayerExamples
1CLI flags--provider, --name, --auth-mode
2.og.yamlprovider, project, share, region, gateway_url, auth_mode, scan
3Environment variablesOG_PROVIDER, OG_REGION, OG_GATEWAY_URL, OG_AUTH_MODE
4~/.og/config.jsonapi_base, console_url, active region
5Build defaultsDefault console and API URLs baked into the binary

Implementation check

This order matches internal/config/resolve.go: global defaults are loaded first, env overrides global config, .og.yaml overrides env, and flags override everything.

.og.yaml project config

Place .og.yaml in a repo root or parent directory; the CLI walks up from the current directory.

provider: "Anthropic"
project: "my-app"
share: "shr-abc123"
region: "reg-abc123"
api_base: "https://console.outgate.ai/api"
gateway_url: "http://localhost:8000"
auth_mode: url

env:
  ANTHROPIC_API_KEY: "sk-ant-og-managed"

scan:
  max_context_tokens: 128000
  context_margin: 0.2
  overlap_lines: 50
  extensions: [".ts", ".js", ".py", ".yaml", ".json", ".env"]
  exclude_dirs: ["node_modules", "dist", ".terraform"]
  exclude_files: ["*.min.js", "*.map", "package-lock.json"]
  max_file_size: 2097152

auth_mode url embeds the gateway share key in the base URL as /_k/{key}. auth_mode env sets ANTHROPIC_API_KEY or OPENAI_API_KEY for tools that require a key environment variable before startup.

Environment variables

Use OG_* variables to steer og itself; tool variables are passed to Claude or Codex.

VariableUsed byDefaultPurpose
OG_API_BASEoghttps://console.outgate.ai/apiConsole API base URL.
OG_CONSOLE_URLoghttps://console.outgate.aiConsole URL for auth and account links.
OG_PROVIDERog"" (auto-resolve)Default provider name or ID.
OG_PROJECTogcurrent directory basenameDefault project/share name.
OG_SHAREog""Pin an existing share by ID or name. Bypasses share-name lookup.
OG_REGIONogthe active region from ~/.og/config.jsonDefault active region ID.
OG_GATEWAY_URLog"" (use the share's endpoint)Direct gateway URL for local or private regions. Path-only values like /abc123 get the region's gateway origin prepended.
OG_AUTH_MODEogurl"url" or "env" — same semantics as --auth-mode.
OPENAI_BASE_URL, OPENAI_API_KEYCodex/OpenAI-compatible toolsset by og at launchTool-facing base URL and credential. Pre-existing values on the host shell are overridden by og codex.
ANTHROPIC_BASE_URL, ANTHROPIC_API_KEYClaude Codeset by og at launchTool-facing base URL and credential.
CODEX_HOMECodex~/.codex/og (synthetic, created on demand)Codex config home used by og codex so the gateway routing does not clobber a real ~/.codex.

Scan and Detection Vault

Use guardrails in dry-run mode to find sensitive values before production traffic sees them.

og scan --provider "Local Ollama"
og scan --provider my-provider --project /path/to/project

og vault add "sk-ant-abc123def456" --category credentials --tag staging
og vault list --category credentials
og vault rm --tag staging

og scan sends files through the selected guardrail-enabled provider with dry-run headers. The request does not reach the upstream model; detections are stored as fingerprints in the Detection Vault for future matching.