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.
| Flag | Command | Default | Purpose |
|---|---|---|---|
| --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 directory | Custom 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-browser | login | false | Skip 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. |
| --uninstall | mcp-search install | false | Remove the og-web-search stanza instead of writing it. |
| --category <name> | vault add | credentials | Detection 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> | scan | current directory | Directory to scan. |
| --help, -h | all | — | Print 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.
| Priority | Layer | Examples |
|---|---|---|
| 1 | CLI flags | --provider, --name, --auth-mode |
| 2 | .og.yaml | provider, project, share, region, gateway_url, auth_mode, scan |
| 3 | Environment variables | OG_PROVIDER, OG_REGION, OG_GATEWAY_URL, OG_AUTH_MODE |
| 4 | ~/.og/config.json | api_base, console_url, active region |
| 5 | Build defaults | Default 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: 2097152auth_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.
| Variable | Used by | Default | Purpose |
|---|---|---|---|
| OG_API_BASE | og | https://console.outgate.ai/api | Console API base URL. |
| OG_CONSOLE_URL | og | https://console.outgate.ai | Console URL for auth and account links. |
| OG_PROVIDER | og | "" (auto-resolve) | Default provider name or ID. |
| OG_PROJECT | og | current directory basename | Default project/share name. |
| OG_SHARE | og | "" | Pin an existing share by ID or name. Bypasses share-name lookup. |
| OG_REGION | og | the active region from ~/.og/config.json | Default active region ID. |
| OG_GATEWAY_URL | og | "" (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_MODE | og | url | "url" or "env" — same semantics as --auth-mode. |
| OPENAI_BASE_URL, OPENAI_API_KEY | Codex/OpenAI-compatible tools | set by og at launch | Tool-facing base URL and credential. Pre-existing values on the host shell are overridden by og codex. |
| ANTHROPIC_BASE_URL, ANTHROPIC_API_KEY | Claude Code | set by og at launch | Tool-facing base URL and credential. |
| CODEX_HOME | Codex | ~/.codex/og (synthetic, created on demand) | Codex config home used by og codex so the gateway routing does not clobber a real ~/.codex. |
Web search for Claude Code and Codex
Install og as an MCP web-search provider for your local CLI tools.
og mcp-search runs a stdio MCP server that exposes a web_search tool to Claude Code and Codex CLI. Once installed, your local tools can call the gateway’s search endpoint without any extra wiring.
og mcp-search install --client claude
og mcp-search install --client codexEach install merges a stanza into the client’s native config file. The stanza embeds the gateway base URL and the credentials resolved from your current og session, so the MCP server reaches the same share the rest of og uses.
| Client | Config file | Stanza key |
|---|---|---|
| Claude Code | ~/.claude.json | mcpServers.og-web-search |
| Codex CLI | ~/.codex/config.toml | [mcp_servers.og-web-search] |
Re-running install overwrites the stanza, so it’s safe to re-run after rotating credentials or switching projects. Add --uninstall to remove the entry.
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 stagingog 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.