Environment Variables
You can configure promptcmd almost entirely using environment variables, and without a config.toml being present on disk. In this page you find all the environment variables looked up by promptcmd for configuration.
Common Provider's Env Variables
These correspond to the configuration keys you'd set in the config.toml under [providers], namely:
PROMPTCMD_PROVIDERS_TEMPERATUREPROMPTCMD_PROVIDERS_SYSTEMPROMPTCMD_PROVIDERS_MAX_TOKENSPROMPTCMD_PROVIDERS_MODELPROMPTCMD_PROVIDERS_CACHE_TTLPROMPTCMD_PROVIDERS_API_KEY
The variables are going to be used regardless of the final provider being selectedd.
Provider-Specific Env Variables
Use these to configure providers individually (e.g., corresponding to [providers.anthropic] in config.toml). Replace ANTHROPIC with your intended provider:
PROMPTCMD_ANTHROPIC_TEMPERATUREPROMPTCMD_ANTHROPIC_SYSTEMPROMPTCMD_ANTHROPIC_MAX_TOKENSPROMPTCMD_ANTHROPIC_MODELPROMPTCMD_ANTHROPIC_CACHE_TTLPROMPTCMD_ANTHROPIC_API_KEY
If both Provider-Specific and Common Provider's env variables are set, the Provider-Specific ones takes precedence when that provider is being used.
Variant-Specific Env Variables
Use these to configure variants. Replace GOOGLE and CODER with your desired provider and variant name.
PROMPTCMD_GOOGLE_CODER_TEMPERATUREPROMPTCMD_GOOGLE_CODER_SYSTEMPROMPTCMD_GOOGLE_CODER_MAX_TOKENSPROMPTCMD_GOOGLE_CODER_MODELPROMPTCMD_GOOGLE_CODER_CACHE_TTLPROMPTCMD_GOOGLE_CODER_API_KEY
If both Variant-Specific and Provider-Specific variables are set, the Variance-Specific ones takes precedence when that variant is being used.
Mixing Environment Variables with Other Configuration Sources
You can specify some configuration using environment variables, and others by other means. For example, it is common practice to specify an api key as an environment variable (e.g., when running a docker container), but fix the rest of the arguments by other means.
To see how different configuration sources merge together, see Config Resolution.