An unexpected model reply can come from the prompt template as well as the text sent by an application. In LM Studio, live logs reveal the formatted model input and server activity so a request can be traced beyond its API response.
The model log source shows inference input or output, while the server source shows API requests and server messages. An input filter isolates the prompt after template formatting, including role delimiters that may not appear in the original request.
The lms CLI must connect to the same running LM Studio service that handles the request. A loaded chat model and a reachable local API provide a small test without involving private conversations; both model and server logs can expose request content.
On Debian or Ubuntu, CPU model loading requires libgomp1, available with sudo apt install libgomp1 before loading the model.
Related: Set up the headless service and CLI
Related: Download a model
Related: Load local-chat and start the local API
Steps to view logs in LM Studio:
- Start a model-input log stream under the account running LM Studio.
Logs can contain prompts, generated text, and sensitive application data. Do not share an unredacted stream or send private conversations during a logging test.
$ lms log stream --source model --filter input Streaming logs from LM Studio
–source model selects inference logs, and –filter input limits this stream to formatted prompts. For generated replies, --filter output selects model output instead. For API requests or server errors, lms log stream --source server selects server logs; –filter applies to the model source. The CLI reference is lms log stream.
- Send a synthetic chat request from a second terminal on the same machine.
$ curl --fail-with-body --silent --show-error \ http://127.0.0.1:1234/v1/chat/completions \ -H 'Content-Type: application/json' \ -d '{ "model": "local-chat", "messages": [{"role": "user", "content": "For this log check, name one primary color."}], "max_tokens": 32 }'local-chat is the identifier from the linked model-loading setup; a different loaded model needs its own identifier. The URL assumes port 1234 and local API-token authentication disabled. max_tokens bounds the generated reply, whose wording does not affect the log check.
- Confirm that the first terminal shows your prompt in a llm.prediction.input event for local-chat. Example output:
Streaming logs from LM Studio ##### snipped ##### type: llm.prediction.input modelIdentifier: local-chat ##### snipped ##### input: <|im_start|>system You are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|> <|im_start|>user For this log check, name one primary color.<|im_end|> <|im_start|>assistant
The role delimiters and system prompt depend on the model's template. A stream with only the startup message has not yet shown a matching inference. With the server source, the corresponding event includes Received request: POST to /v1/chat/completions and the request body instead. Pressing Ctrl+C in the logging terminal ends that subscription without stopping LM Studio or its API server.