how to find models requests logs? #7438

Closed
opened 2026-02-16 18:07:10 -05:00 by yindo · 3 comments
Owner

Originally created by @xucongyong on GitHub (Jan 24, 2026).

Originally assigned to: @rekram1-node on GitHub.

Question

how to find models requests logs?
~/.local/share/opencode/log
not find logs data.

Originally created by @xucongyong on GitHub (Jan 24, 2026). Originally assigned to: @rekram1-node on GitHub. ### Question how to find models requests logs? ~/.local/share/opencode/log not find logs data.
yindo added the docs label 2026-02-16 18:07:10 -05:00
yindo closed this issue 2026-02-16 18:07:10 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 24, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #7858: Add local log paths to AGENTS.md - Documents where logs are stored and how to debug
  • #8901: How to debug server (worker) code? - Discusses debugging and finding logs
  • #7301: Logs sent via client.app.log() are not visible with --print-logs - Related to log visibility issues
  • #9037: Feature Request: Add LLM API Call Duration Logging - Related to logging model API requests

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 24, 2026): This issue might be a duplicate of existing issues. Please check: - #7858: Add local log paths to AGENTS.md - Documents where logs are stored and how to debug - #8901: How to debug server (worker) code? - Discusses debugging and finding logs - #7301: Logs sent via client.app.log() are not visible with --print-logs - Related to log visibility issues - #9037: Feature Request: Add LLM API Call Duration Logging - Related to logging model API requests Feel free to ignore if none of these address your specific case.
Author
Owner

@R44VC0RP commented on GitHub (Jan 24, 2026):

Finding Model Request Logs

Log Location

The log directory is correct: ~/.local/share/opencode/log/

However, log files are named with timestamps, so they might not be obvious. Look for files like:

  • 2026-01-24T123456.log (production)
  • dev.log (when running in dev mode)

Only the 10 most recent log files are kept.

Enable Detailed Logging

By default, the log level is INFO. To see model request details, enable DEBUG logging:

Option 1: CLI flag

opencode --log-level DEBUG

Option 2: Config file (~/.config/opencode/opencode.json)

{
  "logLevel": "DEBUG"
}

Option 3: Print logs to terminal

opencode --print-logs

What Gets Logged

With DEBUG level, LLM requests log:

  • Provider ID and Model ID
  • Session ID
  • Agent name
  • Stream errors

Session History (Detailed Request/Response Data)

For complete LLM interaction history (including token usage and costs), the data is stored in the session storage, not the log files:

~/.local/share/opencode/storage/
├── session/{projectID}/{sessionID}.json
├── message/{sessionID}/*.json
└── part/{messageID}/*.json

You can also:

  • Run opencode debug paths to see all data directories
  • Run opencode export [sessionID] to export full session data
  • Run opencode stats to see token usage and cost statistics

OpenTelemetry (Experimental)

For even more detailed tracing, enable OpenTelemetry in your config:

{
  "experimental": {
    "openTelemetry": true
  }
}

This enables AI SDK spans for detailed request tracing.

@R44VC0RP commented on GitHub (Jan 24, 2026): ## Finding Model Request Logs ### Log Location The log directory is correct: `~/.local/share/opencode/log/` However, log files are **named with timestamps**, so they might not be obvious. Look for files like: - `2026-01-24T123456.log` (production) - `dev.log` (when running in dev mode) Only the **10 most recent** log files are kept. ### Enable Detailed Logging By default, the log level is INFO. To see model request details, enable DEBUG logging: **Option 1: CLI flag** ```bash opencode --log-level DEBUG ``` **Option 2: Config file** (`~/.config/opencode/opencode.json`) ```json { "logLevel": "DEBUG" } ``` **Option 3: Print logs to terminal** ```bash opencode --print-logs ``` ### What Gets Logged With DEBUG level, LLM requests log: - Provider ID and Model ID - Session ID - Agent name - Stream errors ### Session History (Detailed Request/Response Data) For **complete LLM interaction history** (including token usage and costs), the data is stored in the session storage, not the log files: ``` ~/.local/share/opencode/storage/ ├── session/{projectID}/{sessionID}.json ├── message/{sessionID}/*.json └── part/{messageID}/*.json ``` You can also: - Run `opencode debug paths` to see all data directories - Run `opencode export [sessionID]` to export full session data - Run `opencode stats` to see token usage and cost statistics ### OpenTelemetry (Experimental) For even more detailed tracing, enable OpenTelemetry in your config: ```json { "experimental": { "openTelemetry": true } } ``` This enables AI SDK spans for detailed request tracing.
Author
Owner

@gberche-orange commented on GitHub (Jan 27, 2026):

Thanks @R44VC0RP

Session History (Detailed Request/Response Data)

For complete LLM interaction history (including token usage and costs), the data is stored in the session storage, not the log files:

~/.local/share/opencode/storage/
├── session/{projectID}/{sessionID}.json
├── message/{sessionID}/*.json
└── part/{messageID}/*.json

Here is an export of a simple session with debug logs for a simple prompt list files available to you when pointing opencode to an empty directory, followed by refresh the list of files available to you

https://gist.github.com/gberche-orange/b207fad7e76e58b293eae51fe0b73d6b

The session exports with debug logs indeed include the token stats. The assistant claims to have received 10,632 tokens for the initial prompt, which I'd like to inspect and review.

Is there a way to get the actual API calls payloads ?

@gberche-orange commented on GitHub (Jan 27, 2026): Thanks @R44VC0RP > ### Session History (Detailed Request/Response Data) > > For **complete LLM interaction history** (including token usage and costs), the data is stored in the session storage, not the log files: > > ``` > ~/.local/share/opencode/storage/ > ├── session/{projectID}/{sessionID}.json > ├── message/{sessionID}/*.json > └── part/{messageID}/*.json > ``` > Here is an export of a simple session with debug logs for a simple prompt `list files available to you` when pointing opencode to an empty directory, followed by `refresh the list of files available to you` https://gist.github.com/gberche-orange/b207fad7e76e58b293eae51fe0b73d6b The session exports with debug logs indeed include the token stats. The assistant claims to have received 10,632 tokens for the initial prompt, which I'd like to inspect and review. Is there a way to get the actual API calls payloads ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7438