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

Open
opened 2026-02-16 18:07:57 -05:00 by yindo · 1 comment
Owner

Originally created by @sebamar88 on GitHub (Jan 26, 2026).

Originally assigned to: @thdxr on GitHub.

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 🚀

Originally created by @sebamar88 on GitHub (Jan 26, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] 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 🚀
yindo added the discussion label 2026-02-16 18:07:57 -05:00
Author
Owner

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

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

  • #9018: feat(tui): Compact Mode Phase 2 - Compression Engine Integration - Explicitly mentions TOON format as a compression technology for 35-50% token reduction vs JSON
  • #10456: [FEATURE]: schema-constrained structured outputs (JSON Schema), similar to Codex - Related feature for structured output modes
  • #9858: [FEATURE]: Token Consumption Analysis and Requirement for a Plugin Disable Feature for Agents - Discusses token optimization strategies and costs

#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.

@github-actions[bot] commented on GitHub (Jan 26, 2026): This issue might be a duplicate of existing issues. Please check: - #9018: feat(tui): Compact Mode Phase 2 - Compression Engine Integration - Explicitly mentions TOON format as a compression technology for 35-50% token reduction vs JSON - #10456: [FEATURE]: schema-constrained structured outputs (JSON Schema), similar to Codex - Related feature for structured output modes - #9858: [FEATURE]: Token Consumption Analysis and Requirement for a Plugin Disable Feature for Agents - Discusses token optimization strategies and costs #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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7691