Resolution order

omp resolves env vars through a layered .env chain. The first source that defines a key wins:

  1. The existing process environment.

  2. $PWD/.env — the project’s .env in the directory omp was launched from.

  3. ~/.omp/agent/.env — or $PI_CODING_AGENT_DIR/.env / $PI_CONFIG_DIR/agent/.env if those are set.

  4. ~/.omp/.env — honouring PI_CONFIG_DIR.

  5. ~/.env — your home .env.

Inside each .env file, keys written as OMP_FOO are mirrored to PI_FOO, so old configs from the OMP_* era still work without renaming. Settings in ~/.omp/agent/config.yml override built-in defaults; CLI flags override both. See CLI reference for the flag list.

Env vars are read at startup. After editing ~/.env or a project .env, restart omp.

Treat anything ending in _API_KEY, _TOKEN, or _OAUTH_TOKEN as a secret. Never commit .env files; never paste them into chat logs. chmod 600 any .env file containing credentials.

.env file format

One KEY=value per line, # for comments, quotes optional but recommended for values containing spaces or shell metacharacters. No interpolation, no export keyword required.

# ~/.omp/.env — applies to every project
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
PI_SLOW_MODEL="openai/gpt-5.3-codex:high"
PI_NO_PTY=1

Runtime knobs

The flags people reach for most often. Each has a higher-priority CLI flag or settings key; the env var is the lowest-friction way to set one for a shell session or CI job.

| Variable | What it does | | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | | PI_CODING_AGENT_DIR | Move the agent data directory off ~/.omp/agent — useful on shared boxes or when isolating profiles. | | PI_CONFIG_DIR | Rename the config root under $HOME (default .omp). Agent dir becomes ~/<PI_CONFIG_DIR>/agent unless PI_CODING_AGENT_DIR is also set. | | PI_PACKAGE_DIR | Point package asset resolution (docs, examples, changelog) at a custom install path — handy on Nix/Guix. | | PI_SMOL_MODEL | Pin the smol role for the session. CLI --smol wins if both are set. | | PI_SLOW_MODEL | Pin the slow/reasoning role. CLI --slow wins. | | PI_PLAN_MODEL | Pin the plan role. CLI --plan wins. | | PI_NO_PTY | Set to 1 to disable the PTY path of the bash tool. Equivalent to --no-pty. | | PI_PY | Gate the Python backend of the eval tool: truthy (1/true/yes/on) enables, any other value disables; unset defers to the eval.py setting (default enabled). | | PI_JS | Companion gate for the JavaScript backend of eval (eval.js setting). | | OMP_GITHUB_CACHE_DB | Override the SQLite cache file backing pr:// and issue://. Default ~/.omp/cache/github-cache.db. | | OMP_AUTORESEARCH_DB_DIR | Override the directory holding the autoresearch SQLite database. | | VISUAL, EDITOR | Preferred external editor and fallback, used by Ctrl+G. | | PUPPETEER_EXECUTABLE_PATH | Tell the browser tool which Chromium binary to launch. | |

Provider credentials

One key per provider you want to use. For Anthropic, OpenAI Codex, GitHub Copilot, Kimi, Cursor, and Qwen Portal, interactive /login writes OAuth credentials to ~/.omp/agent/agent.db and is usually less hassle than managing API keys. See Providers for the full OAuth matrix and login flows.

ProviderEnv var(s)Notes
AnthropicANTHROPIC_OAUTH_TOKEN, ANTHROPIC_API_KEYOAuth token wins over API key.
Anthropic FoundryANTHROPIC_FOUNDRY_API_KEYUsed when CLAUDE_CODE_USE_FOUNDRY is on.
OpenAIOPENAI_API_KEYAlso used by OpenAI Responses and Codex resolution.
OpenAI CodexOPENAI_CODEX_OAUTH_TOKENOAuth via /login preferred.
Google (Gemini)GEMINI_API_KEYImage tool falls back to GOOGLE_API_KEY.
Google VertexGOOGLE_CLOUD_API_KEYOtherwise ADC + project/location; see Cloud providers below.
Amazon BedrockmultipleSee Cloud providers below.
Azure OpenAIAZURE_OPENAI_API_KEYSee Cloud providers below.
GroqGROQ_API_KEY
CerebrasCEREBRAS_API_KEY
FireworksFIREWORKS_API_KEY
TogetherTOGETHER_API_KEY
Hugging FaceHUGGINGFACE_HUB_TOKENHF_TOKENFirst non-empty wins.
SyntheticSYNTHETIC_API_KEY
NVIDIANVIDIA_API_KEY
NanoGPTNANO_GPT_API_KEY
VeniceVENICE_API_KEYAllows unauthenticated access.
LiteLLMLITELLM_API_KEYOpenAI-compatible LiteLLM proxy.
LM StudioLM_STUDIO_API_KEY (optional)Local servers usually need no auth.
OllamaOLLAMA_API_KEY (optional)
Ollama CloudOLLAMA_CLOUD_API_KEY
llama.cppLLAMA_CPP_API_KEY (optional)
vLLMVLLM_API_KEYAny non-empty value for no-auth local servers.
Xiaomi MiMoXIAOMI_API_KEY
MoonshotMOONSHOT_API_KEY
Kimi CodeKIMI_API_KEYOAuth via /login is the common path.
xAIXAI_API_KEY
OpenRouterOPENROUTER_API_KEYAlso used by image tool when routed through OpenRouter.
MistralMISTRAL_API_KEY
Z.AIZAI_API_KEYAlso drives the z.ai web-search provider.
MiniMaxMINIMAX_API_KEY
MiniMax CodeMINIMAX_CODE_API_KEY
MiniMax Code CNMINIMAX_CODE_CN_API_KEY
OpenCode Go / ZenOPENCODE_API_KEYShared key for both routes.
QianfanQIANFAN_API_KEY
Qwen PortalQWEN_OAUTH_TOKENQWEN_PORTAL_API_KEYOAuth token wins.
CursorCURSOR_ACCESS_TOKENOAuth via /login recommended.
ZenMuxZENMUX_API_KEYCovers ZenMux’s OpenAI and Anthropic-compatible routes.
DeepSeekDEEPSEEK_API_KEY
Kilo GatewayKILO_API_KEYAllows unauthenticated access.
Alibaba Coding PlanALIBABA_CODING_PLAN_API_KEY
Vercel AI GatewayAI_GATEWAY_API_KEYAlso accepts VERCEL_AI_GATEWAY_API_KEY for catalog discovery.
Cloudflare AI GatewayCLOUDFLARE_AI_GATEWAY_API_KEYBase URL form https://gateway.ai.cloudflare.com/v1/<account>/<gateway>/anthropic.
GitLab DuoGITLAB_TOKEN
GitHub CopilotCOPILOT_GITHUB_TOKENGeneric GH_TOKEN / GITHUB_TOKEN are not used for Copilot (the web scraper reads those).
Auth broker (remote)OMP_AUTH_BROKER_URL, OMP_AUTH_BROKER_TOKENPoint omp at a remote credential vault instead of ~/.omp/agent/agent.db. URL enables broker mode; token authenticates the client. See Providers.

Cloud providers

Anthropic Foundry & mTLS

Reach for this when your organisation fronts Anthropic with an Azure Foundry or enterprise gateway that needs custom headers or a client certificate. Setting CLAUDE_CODE_USE_FOUNDRY flips the Anthropic provider into Foundry mode for both streaming and search.

VariableBehavior
CLAUDE_CODE_USE_FOUNDRYBoolean-like switch (1, true, yes, on).
FOUNDRY_BASE_URLAnthropic endpoint base URL in Foundry mode.
ANTHROPIC_FOUNDRY_API_KEYBearer token for Foundry-mode requests.
ANTHROPIC_CUSTOM_HEADERSExtra headers, name: value entries comma- or newline-separated.
NODE_EXTRA_CA_CERTSExtra CA chain — PEM file path or inline PEM (escaped \n supported).
CLAUDE_CODE_CLIENT_CERT, CLAUDE_CODE_CLIENT_KEYmTLS client certificate and matching private key (must be paired).

Anthropic resolution with Foundry enabled becomes ANTHROPIC_FOUNDRY_API_KEYANTHROPIC_OAUTH_TOKENANTHROPIC_API_KEY; otherwise OAuth token then API key.

Amazon Bedrock

Region resolves options.regionAWS_REGIONAWS_DEFAULT_REGIONus-east-1.

VariableBehavior
AWS_REGION, AWS_DEFAULT_REGIONPrimary region, then fallback.
AWS_PROFILENamed-profile auth path.
AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEYPlain IAM keys.
AWS_BEARER_TOKEN_BEDROCKBedrock API-key (bearer token) auth.
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI, AWS_CONTAINER_CREDENTIALS_FULL_URIMark Bedrock as available in provider detection (resolution itself covers env keys, profiles/SSO/credential_process, then IMDSv2).
AWS_WEB_IDENTITY_TOKEN_FILE + AWS_ROLE_ARNMark Bedrock as available in provider detection (same caveat as the ECS variables above).
AWS_BEDROCK_SKIP_AUTHIf 1, injects dummy credentials for proxy / no-auth setups.
HTTPS_PROXY, HTTP_PROXY, NO_PROXYHonored via Bun’s native fetch proxy support.

Azure OpenAI Responses

Base URL resolves option → AZURE_OPENAI_BASE_URLAZURE_OPENAI_RESOURCE_NAME → the model’s default.

VariableBehavior
AZURE_OPENAI_API_KEYRequired unless an API key is passed as an option.
AZURE_OPENAI_API_VERSIONDefault v1.
AZURE_OPENAI_BASE_URLDirect base URL override.
AZURE_OPENAI_RESOURCE_NAMEBuilds https://<resource>.openai.azure.com/openai/v1.
AZURE_OPENAI_DEPLOYMENT_NAME_MAPMapping string: modelId=deployment,modelB=deploymentB.

Google Vertex AI

VariableBehavior
GOOGLE_CLOUD_PROJECT, GCLOUD_PROJECTProject ID, then fallback.
GOOGLE_CLOUD_LOCATIONRegion; required for ADC auth (no default).
GOOGLE_CLOUD_API_KEYDirect Vertex API-key auth; skips ADC.
GOOGLE_APPLICATION_CREDENTIALSPath to ADC JSON; falls back to ~/.config/gcloud/application_default_credentials.json.
GOOGLE_CLOUD_PROJECT_IDOAuth login helper only — used by Gemini CLI project discovery.

Credentials and endpoint overrides for built-in web-search providers. Some keys (e.g. Z.AI, Anthropic search) are also read by the corresponding model provider.

VariableUsed by
EXA_API_KEYExa search and Exa MCP tools.
BRAVE_API_KEYBrave search.
PERPLEXITY_API_KEYPerplexity API-key mode.
PERPLEXITY_COOKIESPerplexity cookie-auth mode.
TAVILY_API_KEYTavily.
KAGI_API_KEYKagi.
JINA_API_KEYJina.
PARALLEL_API_KEYParallel.
ANTHROPIC_SEARCH_API_KEY, ANTHROPIC_SEARCH_BASE_URL, ANTHROPIC_SEARCH_MODELOverrides for the Anthropic web-search backend. Default model: claude-haiku-4-5.
ANTHROPIC_BASE_URLGeneric Anthropic base URL used by the search fallback path.
MOONSHOT_SEARCH_API_KEY / KIMI_SEARCH_API_KEYKimi / Moonshot search provider.
MOONSHOT_SEARCH_BASE_URL / KIMI_SEARCH_BASE_URLKimi / Moonshot search endpoint override.
PI_CODEX_WEB_SEARCH_MODELCodex search provider model override.
SEARXNG_ENDPOINT, SEARXNG_TOKENSearXNG endpoint and optional bearer token.
SEARXNG_BASIC_USERNAME, SEARXNG_BASIC_PASSWORDSearXNG HTTP Basic Auth.
PI_AUTH_NO_BORROWDisables the macOS native-app token-borrowing path used by Perplexity login.

Eval & Python kernel

VariableBehavior
PI_PYBackend gate (see Runtime knobs).
PI_JSCompanion gate for the JavaScript backend.
PI_PYTHON_SKIP_CHECKSkip Python availability probes (the runner still starts on demand).
PI_PYTHON_INTEGRATIONIf 1, opts gated integration tests in against a real Python install.
PI_PYTHON_IPC_TRACEIf 1, logs NDJSON frames exchanged with the Python runner.
VIRTUAL_ENVHighest-priority venv path for Python runtime resolution.

When BUN_ENV=test or NODE_ENV=test, Python availability checks are treated as OK and warming is skipped. The Python runner strips common API-key vars from its subprocess env and only forwards LC_, XDG_, and PI_ prefixes plus a safe base set.

Subagent caps

VariableBehavior
PI_TASK_MAX_OUTPUT_BYTESMax captured output bytes per subagent (default 500000).
PI_TASK_MAX_OUTPUT_LINESMax captured output lines per subagent (default 5000).
PI_BLOCKED_AGENTBlock a specific subagent type in the task tool.
PI_SUBPROCESS_CMDOverride the subagent spawn command (bypasses omp / omp.cmd lookup).

Behaviour toggles

VariableBehavior
PI_NO_TITLESkip auto-generated session titles on first user message.
NULL_PROMPTIf true, the system prompt builder returns an empty string. Useful for debugging or running raw models.
PI_EDIT_VARIANTForce an edit-tool variant: patch, replace, hashline, apply_patch.
PI_CACHE_RETENTIONIf long, enables long prompt-cache retention where supported (Anthropic, OpenAI Responses, Bedrock).
PI_DISABLE_LSPMUXIf 1, disables lspmux integration and forces direct LSP server spawning.
PI_RPC_EMIT_TITLEEmit title events in RPC mode.

Performance & debug

VariableBehavior
PI_TIMINGAny non-empty value prints accumulated startup/tool timings to stderr — once startup completes (before the TUI starts) in interactive mode, after the prompt batch in -p print mode. x prints them and exits with status 0; full adds every module-load span. In print mode each prompt is wrapped as print:prompt:initial / print:prompt:next.
DEBUG_CURSORCursor provider debug logs; 2/verbose for payload snippets.
DEBUG_CURSOR_LOGOptional JSONL log file path for the Cursor debug stream.
PI_CODEX_DEBUGOpenAI Codex provider debug logging.
PI_CODEX_WEBSOCKETToggle websocket transport for the Codex provider.
PI_CODEX_WEBSOCKET_IDLE_TIMEOUT_MSOverride idle timeout (default 300000).
PI_CODEX_WEBSOCKET_RETRY_BUDGETOverride retry budget (default 5).
PI_CODEX_WEBSOCKET_RETRY_DELAY_MSOverride base backoff (default 500).
PI_OPENAI_STREAM_IDLE_TIMEOUT_MSOverride the OpenAI stream idle timeout.
PI_AI_GEMINI_CLI_VERSIONOverride the Gemini CLI user-agent version tag.

Local server discovery

VariableDefault
LM_STUDIO_BASE_URLhttp://127.0.0.1:1234/v1
OLLAMA_BASE_URLhttp://127.0.0.1:11434
LLAMA_CPP_BASE_URLhttp://127.0.0.1:8080
KIMI_CODE_OAUTH_HOSTKIMI_OAUTH_HOSTOAuth host override; defaults to https://auth.kimi.com.
KIMI_CODE_BASE_URLKimi usage endpoint base URL.
SMITHERY_URL, SMITHERY_API_URLSmithery web (https://smithery.ai) and API (https://api.smithery.ai) bases.

Shell execution

How the bash tool wraps the user’s shell when running commands. Each PI_* key has a legacy CLAUDE_* alias that still works.

VariableBehavior
PI_BASH_NO_CISuppress the automatic CI=true injection into spawned shells.
PI_BASH_NO_LOGINDrop login-shell mode — shell args become ['-c'] instead of ['-l','-c'].
PI_SHELL_PREFIXOptional command-prefix wrapper applied to every shell invocation.
CLAUDE_BASH_NO_CI, CLAUDE_BASH_NO_LOGIN, CLAUDE_CODE_SHELL_PREFIXLegacy aliases for the three above.
PI_NO_PTYDisable the PTY path of the bash tool (also set internally by --no-pty).

TUI runtime

Terminal-side knobs. Most are auto-detected; set these only when the defaults misbehave.

VariableBehavior
PI_NOTIFICATIONSoff / 0 / false suppresses desktop notifications.
PI_FORCE_IMAGE_PROTOCOLForce a terminal image protocol: kitty, iterm2/iterm, sixel, none.
PI_ALLOW_SIXEL_PASSTHROUGHAllow SIXEL passthrough when PI_FORCE_IMAGE_PROTOCOL=sixel.
PI_HARDWARE_CURSORIf 1, enable hardware cursor mode.
PI_TUI_WRITE_LOGLog all TUI writes to a file.
PI_DEBUG_REDRAWEnable redraw debug logging.

Commit pipeline

The /commit slash command and the underlying commit agent honour these toggles. Mostly used during development of the commit pipeline itself.

| Variable | Behavior | | ------------------------- | ------------------------------------------------------------------------------------- | --- | | PI_COMMIT_TEST_FALLBACK | If true, force the heuristic fallback path instead of asking the agent. | | PI_COMMIT_NO_FALLBACK | If true, leave the proposal empty when the agent doesn’t produce one (no fallback). | | PI_COMMIT_MAP_REDUCE | If false, disable the map-reduce analysis path for large diffs. | | DEBUG | If set, the commit agent prints its full error stack on failure. | \n |

Ask Docs

AI assistant to help answer questions about the documentation. Answers are read-only and cite docs/source.

Hi! How can I help you with the documentation today? Answers are read-only and cite docs/source.

Ctrl+Enter to send