Skip to content

[FEATURE]: Implement support for TOON to reduce token usage and inference costs #10773

Closed as not planned

Description

@sebamar88

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Hi OpenCode team 👋

First of all, great work on the project. We’ve been using OpenCode in real scenarios and it’s shaping up really nicely.

I’d like to propose adding support for TOON (Token Optimized Output Notation) as an optional output mode, with the explicit goal of reducing token usage and inference costs, especially in agent-based and iterative workflows.

Why TOON?

In many use cases (agents, tools, structured responses, follow-up calls), verbose natural language output is unnecessary and expensive. TOON allows the model to:

Produce highly compact, structured outputs

Minimize repetition and filler tokens

Improve latency and cost efficiency

Maintain semantic clarity while being machine-friendly

This is particularly valuable when:

Running multi-step agents

Chaining model calls

Operating under tight token or budget constraints

Using LLMs as reasoning engines rather than chat interfaces

Proposed Implementation

Some ideas on how this could be integrated (totally open to discussion):

Add a configurable output mode, e.g.:

outputFormat: "natural" | "toon"

Allow TOON to be enabled:

Per request

Per agent

Globally via config

Provide a minimal TOON schema or guideline so outputs stay predictable

Expected Benefits

📉 Lower token consumption

💸 Reduced inference costs

⚡ Faster responses

🤖 Better fit for agentic and automation-heavy workflows

Final Thoughts

This wouldn’t replace natural language outputs, but rather complement them for performance-critical paths. In my opinion, TOON support would be a strong differentiator for OpenCode compared to more chat-oriented tools.

Happy to help with:

Spec definition

Examples

Testing / validation

Thanks for considering it 🚀

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Jan 27, 2026
  2. github-actions commented on Jan 27, 2026

    @github-actions
    Contributor

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

    #9018 is particularly relevant as it already includes TOON format as one of the planned compression technologies (35-50% reduction). You may want to coordinate with that implementation effort.

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

  3. gitPhate commented on Mar 28, 2026

    @gitPhate

    @thdxr any plans on supporting this one?

  4. assigned and unassigned on Apr 26, 2026
  5. removed
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on May 3, 2026
  6. github-actions commented on Jul 6, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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