Redact --api-key value from llama-server startup log

When UNSLOTH_DIRECT_STREAM=1, the generated bearer token was logged
verbatim in the startup command. Replace the secret with <redacted>
before logging.
This commit is contained in:
Daniel Han 2026-03-27 08:26:10 +00:00
commit 2507d26970

View file

@ -950,7 +950,12 @@ class LlamaCppBackend:
else:
self._api_key = None
logger.info(f"Starting llama-server: {' '.join(cmd)}")
_log_cmd = list(cmd)
if "--api-key" in _log_cmd:
_ki = _log_cmd.index("--api-key") + 1
if _ki < len(_log_cmd):
_log_cmd[_ki] = "<redacted>"
logger.info(f"Starting llama-server: {' '.join(_log_cmd)}")
# Set library paths so llama-server can find its shared libs and CUDA DLLs
import os