Secret Management
Yanshi keeps provider credentials out of model and workflow configuration by default. Config files store environment variable names, while actual values live in process environment variables or ~/.yanshi/.env.
Current Loading Paths
yanshi config initwrites~/.yanshi/models.ymland a template~/.yanshi/.env.Yanshi::init()loads~/.yanshi/.envfirst, then resolves model config asYANSHI_MODELS_CONFIG->~/.yanshi/models.yml->~/.yanshi/models.yaml-> built-in defaults.models.ymlwins over legacymodels.yamlwhen both exist; Yanshi prints a warning so the duplicate can be cleaned up.- LLM provider configs use
api_key_envfields such asOPENAI_API_KEYandSTEPFUN_API_KEY. - Direct CLI audio/image commands currently read
STEPFUN_API_KEYorSTEP_API_KEYfrom the process environment. - Skill MCP servers may receive environment variables from skill configuration; validation and CLI output must treat tool params and env-like values as sensitive.
Storage Boundary
The current supported local secret store is the host environment plus ~/.yanshi/.env. Yanshi does not write plaintext API key values into models.yml or models.yaml.
Local encryption and external secret manager integration should be added behind a resolver boundary:
env:NAMEreads from the process environment or loaded.env.file:/pathreads from a local secret file with caller-controlled permissions.keychain:NAME,vault:PATH, or cloud-specific resolvers can be added without changing model config schema.
Until that resolver exists, users should prefer OS-level secret managers, CI secret injection, Kubernetes Secrets, or .env files outside source control.
Display Policy
yanshi config showrenders config through the shared redaction layer.- Environment variable names such as
OPENAI_API_KEYremain visible because they are identifiers, not credential values. - Credential values in fields such as
api_key,token,authorization,password, and tool params are replaced with[REDACTED]. - Trace replay, trace TUI, workflow output, skill run/chat output, and tool params should default to redacted output.
Validation Policy
yanshi config validate checks configuration shape and reports missing env variable names. It does not print current secret values.