You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Context tokens resets to zero with every new action of AI agent. #3982
changed the title [-]Context tokens reset with every new action of ai agent[/-][+]Context tokens resets to zero with every new action of AI agent.[/+]on Nov 6, 2025
Inconsistent Session Token Count #1937: Inconsistent Session Token Count - reports similar behavior where token counts reset or regress for no apparent reason across multiple providers and models
Feel free to ignore if none of these address your specific case.
Activity
[-]Context tokens reset with every new action of ai agent[/-][+]Context tokens resets to zero with every new action of AI agent.[/+]AliDem1 commentedon Nov 6, 2025
*Running opencode version 1.0.35, but this issue has been around for a very long time now.
github-actions commentedon Nov 6, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
rekram1-node commentedon Nov 6, 2025
can u show me your opencode.json that defines this model?
AliDem1 commentedon Nov 7, 2025
Hiya,
{ "$schema": "https://opencode.ai/config.json", "provider": { "mlx": { "npm": "@ai-sdk/openai-compatible", "name": "Local MLX Server", "options": { "baseURL": "http://127.0.0.1:8080/v1" }, "models": { "glm-4.6-mlx-8bit-gs32": { "name": "GLM 4.6 (MLX gs32)" }, "glm-4.5-air-mlx": { "name": "GLM 4.5 Air (MLX)" } } } }, "plugin": ["opencode-openai-codex-auth"], "mcp": { "weather": { "type": "local", "command": ["bun", "x", "@h1deya/mcp-server-weather"] }, "context7": { "type": "remote", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "{env:CONTEXT7_API_KEY}" } } } }{
"$schema": "https://opencode.ai/config.json",
"provider": {
"mlx": {
"npm": "@ai-sdk/openai-compatible",
"name": "Local MLX Server",
"options": {
"baseURL": "http://127.0.0.1:8080/v1"
},
"models": {
"glm-4.6-mlx-8bit-gs32": { "name": "GLM 4.6 (MLX gs32)" },
"glm-4.5-air-mlx": { "name": "GLM 4.5 Air (MLX)" }
}
}
},
"plugin": ["opencode-openai-codex-auth"],
"mcp": {
"weather": { "type": "local", "command": ["bun", "x", "@h1deya/mcp-server-weather"] },
"context7": {
"type": "remote",
"url": "https://mcp.context7.com/mcp",
"headers": { "CONTEXT7_API_KEY": "{env:CONTEXT7_API_KEY}" }
}
}
}
rekram1-node commentedon Nov 7, 2025
@AliDem1 are you sure your server reports tokens correctly? If they reset on every request i tend to think it reports incorrect numbers