anomalyco / anomalyco/opencode

Fresh chat sends ~42,000 input tokens before user types anything

Open
#38,076 2 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Jul 21, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

A brand new session (no previous conversation, no project history) appears to send approximately 30,000+ input tokens before any meaningful interaction.

The only user message is: hi

Yet the provider reports roughly 30k+ input tokens.

This happens consistently on a fresh session.

Expected behavior

A new session should send only the base system prompt and essential context, which should be much smaller.

Actual behavior

The provider receives approximately 30k+ input tokens on the first request.

This causes providers with lower TPM limits (for example Groq) to immediately reject requests due to rate limits, even though the conversation is empty.

Environment
  • OpenCode: 1.18.3
  • Provider: Groq
  • Fresh session
  • No conversation history
Additional information

This seems unrelated to conversation history since it occurs immediately in a new chat.

It would be helpful to expose a breakdown of the generated prompt (system prompt, tool schemas, agent prompt, instructions, etc.) to identify which component contributes most of the tokens.

log.txt

Plugins

none

OpenCode version

1.18.4

Steps to reproduce

in termux type opencode.
selec model as llama-3.1-8b- instant or get oss.
type hi.

Screenshot and/or share link
Image
Operating System

proot-distro ubuntu Linux 6.17

Terminal

termux on Android

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.