The /stats command is implemented in the backend and will show session statistics including token usage, costs, and message counts.
- In the opencode TUI, type
/statsin the message input - Important: When you type
/, a command completion dialog will appear, but/statswon't be listed (it's a backend command, not a TUI command) - Either:
- Continue typing
statsto complete/statsand press Enter - Press Escape to dismiss the completion dialog, then press Enter
- Continue typing
- The backend will process the command and return statistics instead of sending it to the AI
The /stats command returns:
- Session information (title, ID, timestamps, duration)
- Model information (provider and model name)
- Message statistics (user vs assistant counts)
- Token usage breakdown (input, output, cache read/write)
- Total cost and cost analysis
- Tool usage statistics (if any)
- Average tokens per message
The /stats command is processed by the backend, not the TUI. This is why it doesn't appear in the TUI's command completion list. Just type it and press Enter!