Skip to content

[Question] detailed per-interaction telemetry (token counts and input composition) for opencode-model communications #2666

@m1pro

Description

@m1pro

I’d like opencode to provide detailed telemetry for each interaction with the model so I can see exactly what is sent and received. Specifically:
Per-request and per-response token counts.
A breakdown of the input composition (prompt/system/instructions/user messages, tool calls, agent/subagent messages, and any injected context).
Visibility into response tokens and any truncation or context-window warnings.
Option to enable/disable verbose logging and to redact sensitive user content. This will help tune agents/subagents and manage context size to reduce costs and avoid hitting token limits.
Priority: Medium — useful for debugging and cost optimization.
Possible implementation notes: expose structured logs or a debug mode that outputs a JSON telemetry object per interaction with fields such as total_tokens, prompt_tokens, completion_tokens, messages[], truncated (bool), and redaction markers.

From what I've check the current logs (even in debug mode) don't include all information.
Is this mode already supported ?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions