Skip to content

[Enhancement] Show token count and cost estimate after each assistant message #1754

@fuleinist

Description

@fuleinist

Description

Open Interpreter runs code locally with full internet access, but provides no token usage visibility. Unlike cloud-based code interpreters (ChatGPT Code Interpreter, Claude Code), users have no way to see how many tokens each assistant message consumed or estimate the cost.

OI already uses readline for history (per issue #1697). Adding token/cost tracking would complement that infrastructure.

Suggested implementation

Track tokens per assistant response and display after each message:

  • Add a %tokens on/off magic command to toggle (persists in session)
  • Show always-on when --verbose flag is set
  • Add --track-cost CLI flag

Use Case

Developers testing different models and budget-conscious users want to monitor token usage and estimated costs in real-time, especially when iterating on prompts or processing large datasets.

Additional Information

This could be gated behind a config flag track_usage: true in ~/.config/open-interpreter/config.yaml for users who want it enabled by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions