Skip to content

Environment variables

Pythinker Code CLI uses environment variables to control a small number of runtime behaviors — relocating the data directory, turning off telemetry, and temporarily switching models without touching the config file.

Important: API keys are explicitly referenced

Credential variables such as PYTHINKER_API_KEY, ANTHROPIC_API_KEY, and OPENAI_API_KEY are not guessed automatically. A provider reads a shell credential only when [providers.<name>].api_key_env_var names it. Catalog import writes this reference for supported providers without writing the token itself.

The PYTHINKER_MODEL_* family remains a separate explicit channel that synthesizes a temporary provider — see Define a model from environment variables.

For background, see Config overrides: provider credentials.

Core paths

PYTHINKER_CODE_HOME

Overrides the data root directory; the default is ~/.pythinker-code. Once set, the config file, sessions, logs, OAuth credentials, and all other data land under the new path:

sh
export PYTHINKER_CODE_HOME="/path/to/custom/pythinker-code"

Make sure the directory is writable. Multiple pythinker instances sharing the same PYTHINKER_CODE_HOME will share config and credential files.

For the complete data directory structure, see Data locations.

PYTHINKER_DISABLE_TELEMETRY

Set to 1 to turn off anonymous telemetry reporting (also accepts true, yes, y, case-insensitive):

sh
export PYTHINKER_DISABLE_TELEMETRY=1

PYTHINKER_MODEL_* family

Switch models temporarily without modifying config.toml — when PYTHINKER_MODEL_NAME is set, the CLI synthesizes a temporary provider in memory; the change does not persist after restart. See Define a model from environment variables.

Provider credential environment references

Use api_key_env_var when the secret should remain in the process environment:

toml
[providers.anthropic]
type = "anthropic"
api_key_env_var = "ANTHROPIC_API_KEY"
sh
export ANTHROPIC_API_KEY=YOUR_API_KEY
pythinker

The legacy [providers.<name>.env] sub-table remains a literal config-file fallback for api_key and base_url; it does not read or modify the shell environment:

toml
[providers.pythinker.env]
PYTHINKER_API_KEY = "YOUR_API_KEY"
PYTHINKER_BASE_URL = "https://api.example.com/v1"

Provider-conventional config-subtable keys:

KeyApplicable providerDefault
PYTHINKER_API_KEYPythinker / PythoughtsNone
PYTHINKER_BASE_URLPythinker / Pythoughtshttps://api.pythoughts.ai/v1
ANTHROPIC_API_KEYAnthropicNone
ANTHROPIC_BASE_URLAnthropicFollows Anthropic SDK default
OPENAI_API_KEYOpenAI (openai and openai_responses)None
OPENAI_BASE_URLOpenAI (openai and openai_responses)https://api.openai.com/v1
GOOGLE_API_KEYGoogle GenAI, Vertex AINone
VERTEXAI_API_KEYVertex AINone
GOOGLE_CLOUD_PROJECTVertex AINone
GOOGLE_CLOUD_LOCATIONVertex AINone

Catalog entries can declare other credential names and persist them through api_key_env_var. The featured connections currently declare:

Catalog providerCredential variable
DeepSeek (deepseek)DEEPSEEK_API_KEY
GLM Coding Plan (zai-coding-plan)ZHIPU_API_KEY
MiniMax Token Plan (minimax-coding-plan)MINIMAX_API_KEY
Kimi For Coding (kimi-for-coding)KIMI_API_KEY

WARNING

GOOGLE_APPLICATION_CREDENTIALS (path to a service account JSON file) is read directly by the Google SDK through the standard ADC flow; api_key_env_var is not involved in that path.

For the full provider type and field reference, see Providers and models.

OAuth and managed services

This group of variables redirects OAuth authentication and managed service endpoints to a self-hosted or test environment. They are not needed for everyday use.

VariablePurposeDefault
PYTHINKER_CODE_OAUTH_HOSTOAuth auth host; highest priorityFalls back to PYTHINKER_OAUTH_HOST when unset
PYTHINKER_OAUTH_HOSTOAuth auth host; fallback for PYTHINKER_CODE_OAUTH_HOSTFalls back to https://auth.pythinker.com when unset
PYTHINKER_CODE_BASE_URLManaged API base URL used after OAuth loginhttps://api.pythinker.com/coding/v1

WARNING

PYTHINKER_CODE_BASE_URL (OAuth-managed service, targeting pythinker.com) and PYTHINKER_BASE_URL (direct API key connection, targeting pythoughts.ai) are two distinct variables. Use each one in its appropriate context.

Define a model from environment variables (PYTHINKER_MODEL_*)

Want to switch models for testing without touching config.toml? When PYTHINKER_MODEL_NAME is set, the CLI synthesizes a temporary provider and model alias from the PYTHINKER_MODEL_* variables in memory — nothing is written back to the config file. These variables take priority over default_model in config.toml, but the -m <alias> option at startup still has the highest priority.

sh
export PYTHINKER_MODEL_NAME="pythinker-for-coding"
export PYTHINKER_MODEL_API_KEY="YOUR_API_KEY"
export PYTHINKER_MODEL_BASE_URL="https://api.example.com/v1"
export PYTHINKER_MODEL_MAX_CONTEXT_SIZE="262144"
export PYTHINKER_MODEL_CAPABILITIES="image_in,thinking"
pythinker

Complete variable list:

VariableRequiredPurposeDefault
PYTHINKER_MODEL_NAMEYes (also the enable switch)Model id sent to the API
PYTHINKER_MODEL_API_KEYYesAPI key
PYTHINKER_MODEL_PROVIDER_TYPENoProvider type: pythinker, anthropic, openaipythinker
PYTHINKER_MODEL_BASE_URLNoAPI base URLEach type has its own default
PYTHINKER_MODEL_MAX_CONTEXT_SIZENoMaximum context length (tokens)262144 (256 K)
PYTHINKER_MODEL_CAPABILITIESNoComma-separated capability tags, unioned with auto-detected capabilitiesimage_in,thinking
PYTHINKER_MODEL_DISPLAY_NAMENoName shown in /modelFalls back to PYTHINKER_MODEL_NAME
PYTHINKER_MODEL_MAX_OUTPUT_SIZENoPer-request output cap (anthropic only)Model default
PYTHINKER_MODEL_REASONING_KEYNoReasoning field name override (openai only)Auto-detected
PYTHINKER_MODEL_DEFAULT_THINKINGNoDefault Thinking toggle for new sessionsFollows global default
PYTHINKER_MODEL_THINKING_MODENoThinking trigger policy: auto/on/off
PYTHINKER_MODEL_THINKING_EFFORTNoThinking effort level: low/medium/high/xhigh/max
PYTHINKER_MODEL_ADAPTIVE_THINKINGNoForce adaptive thinking on or off (anthropic only)Inferred from model name

If PYTHINKER_MODEL_NAME is set but a required variable is missing, startup fails immediately with a clear error message.

Runtime switches

Switches that control the behavior of subsystems such as telemetry, background tasks, and the plugin marketplace:

VariablePurposeValid values
PYTHINKER_DISABLE_TELEMETRYDisable anonymous telemetry reporting1, true, yes, y (case-insensitive)
PYTHINKER_CODE_BACKGROUND_KEEP_ALIVE_ON_EXITWhether to keep background tasks when the session closes; takes higher priority than config.toml. The default is to stop them on exitTruthy: 1/true/yes/on; falsy: 0/false/no/off
PYTHINKER_CODE_PLUGIN_MARKETPLACE_URLOverride the plugin marketplace JSON loaded by /pluginsURL or local path
PYTHINKER_CODE_EXPERIMENTAL_FLAGEnable all registered experimental features for this process; micro_compaction is already enabled by default1, true, yes, on
PYTHINKER_CODE_EXPERIMENTAL_MICRO_COMPACTIONOverride [experimental].micro_compaction for this processTruthy or falsy
PYTHINKER_SHELL_PATHOverride the Git Bash path on Windows (used when auto-detection fails)Absolute path
PYTHINKER_MODEL_MAX_COMPLETION_TOKENSHard cap on max_completion_tokens per LLM step; applies to the pythinker provider onlyPositive integer; 0 or negative disables clamping
PYTHINKER_MODEL_TEMPERATURESampling temperature for every request; applies to the pythinker provider only (global — independent of PYTHINKER_MODEL_NAME)Number, e.g. 0.3
PYTHINKER_MODEL_TOP_PNucleus-sampling top_p for every request; applies to the pythinker provider only (global)Number, e.g. 0.95
PYTHINKER_MODEL_THINKING_KEEPPythoughts preserved-thinking passthrough (thinking.keep); applies to the pythinker provider only, and only while Thinking is onA value the API accepts, e.g. all
PYTHINKER_CODE_NO_AUTO_UPDATEFully disable the update preflight — no check, background install, or prompt. Legacy alias PYTHINKER_CLI_NO_AUTO_UPDATE is also honoredTruthy: 1/true/yes/on
PYTHINKER_DISABLE_CRONDisable the scheduled-task tool (CronCreate rejects new schedules; existing tasks do not fire)1 to disable

Diagnostic logs

These variables control log level and file rotation, read once at process startup:

VariablePurposeDefault
PYTHINKER_LOG_LEVELLog level: off, error, warn, info, debuginfo
PYTHINKER_LOG_GLOBAL_MAX_BYTESMaximum bytes per global log file6291456 (6 MB)
PYTHINKER_LOG_GLOBAL_FILESNumber of global log files to retain5
PYTHINKER_LOG_SESSION_MAX_BYTESMaximum bytes per session log file5242880 (5 MB)
PYTHINKER_LOG_SESSION_FILESNumber of session log files to retain3

System environment variables

The CLI also reads several standard system variables to detect the runtime environment; it does not modify them:

  • HOME: used to resolve the default data path
  • VISUAL, EDITOR: external editor command (VISUAL takes precedence)
  • PATH: used to locate dependencies such as rg, fd, fdfind, and git; on Windows, Git Bash detection checks each git.exe found on PATH, including package-manager shims such as Scoop
  • NO_COLOR, FORCE_COLOR: control color output (following the no-color.org convention)
  • CI: when non-empty and not "0", disables theme detection and falls back to the dark theme
  • TERM_PROGRAM, TERM, TMUX: detect terminal features and notification support
  • DISPLAY, WAYLAND_DISPLAY, XDG_SESSION_TYPE: detect Linux graphical sessions (for clipboard and image features)
  • WSL_DISTRO_NAME, WSLENV: detect WSL for the clipboard PowerShell bridge
  • LOCALAPPDATA: used on Windows as a fallback when probing for the Git Bash installation path

HTTP proxy

Pythinker Code honors the standard proxy environment variables for all outbound traffic — model API calls, MCP servers, web tools, telemetry, sign-in, and update checks:

  • HTTP_PROXY / http_proxy: proxy for http:// requests
  • HTTPS_PROXY / https_proxy: proxy for https:// requests
  • ALL_PROXY / all_proxy: fallback proxy used when the scheme-specific variable is unset; this is where a SOCKS proxy is usually set
  • NO_PROXY / no_proxy: comma-separated hosts that bypass the proxy

Both HTTP(S) and SOCKS proxies are supported. A SOCKS proxy is recognized by its scheme — socks5://, socks5h://, socks4://, or socks:// (an alias for socks5://) — and is typically set via ALL_PROXY (the form used by tools like Clash and V2RayN). An HTTP(S) proxy takes precedence over ALL_PROXY for HTTP/HTTPS traffic.

The proxy is applied only when one of these variables is set; otherwise connections are made directly. Loopback hosts (localhost, 127.0.0.1, ::1) always bypass the proxy, so a local server such as a localhost MCP server keeps working when a proxy is configured — add your own internal hosts to NO_PROXY to exempt them too.

Stdio MCP servers that run as Node child processes honor HTTP_PROXY / HTTPS_PROXY / NO_PROXY automatically when the child's Node version supports NODE_USE_ENV_PROXY (Node ≥ 22.21 or ≥ 24.5); SOCKS proxying applies to Pythinker Code's own traffic only.

Next steps