Skip to content

Commit 50ad3f4

Browse files
committed
fix: raise the declared output limit from 16k to 32k (v1.0.4)
OpenCode forwards limit.output as max_completion_tokens, so the hardcoded 16,384 capped every Command Code response regardless of what the model supports. The DeepSeek V4.1 Flash 1017 build declares 393,216 output tokens. - Default is now 32,768, the highest value safe across the whole catalog: the minimum declared output in models.dev's commandcode provider is exactly 32,768. - COMMANDCODE_OUTPUT_TOKENS overrides it per process (verified: 131072 reaches the wire as max_completion_tokens). - The 28 static model entries in opencode.json carried output: 16384, which won over the plugin; the limits are now owned by the plugin alone. - Verified end to end with a local echo provider: default 32768, override 131072.
1 parent e4ee5d3 commit 50ad3f4

5 files changed

Lines changed: 35 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) - SemVer.
55

66
## [Unreleased]
77

8+
## [1.0.4] - 2026-10-20
9+
10+
### Fixed
11+
12+
- The declared output limit was hardcoded to 16,384 tokens for every model. OpenCode
13+
forwards `limit.output` as `max_completion_tokens`, so every response was capped at
14+
16k even though the catalog supports far more (the DeepSeek V4.1 Flash 1017 build
15+
declares 393,216). The default is now 32,768, the highest value that is safe across the
16+
whole catalog (the minimum declared output in models.dev's commandcode provider is
17+
exactly 32,768), and `COMMANDCODE_OUTPUT_TOKENS` overrides it per process.
18+
- The static model entries in `opencode.json` carried `output: 16384`, which took
19+
precedence over the plugin. Those limits are now owned by the plugin alone.
20+
821
## [1.0.3] - 2026-10-19
922

1023
### Added

‎README.es.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ Cada ajuste es una variable de entorno con default seguro. Referencia completa:
210210
| `CC_NO_CONNECTION_CLOSE` | `0` | Poner en `1` para dejar de inyectar `Connection: close` |
211211
| `COMMANDCODE_STATE_DIR` | `$XDG_STATE_HOME/opencode` | Donde viven los logs y la cache de modelos |
212212
| `COMMANDCODE_LIVE_TESTS` | `0` | Poner en `1` para correr la suite de tests con red |
213+
| `COMMANDCODE_OUTPUT_TOKENS` | `32768` | Limite de tokens de salida declarado por modelo (OpenCode lo envia como `max_completion_tokens`). Subilo si un modelo soporta mas |
213214

214215
Kill switch en runtime para la higiene de conexion: crea un archivo centinela llamado
215216
`.disable-connection-close` dentro del directorio del plugin.

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ Every setting is an environment variable with a safe default. Full reference:
204204
| `CC_NO_CONNECTION_CLOSE` | `0` | Set to `1` to stop injecting `Connection: close` |
205205
| `COMMANDCODE_STATE_DIR` | `$XDG_STATE_HOME/opencode` | Where logs and the model cache live |
206206
| `COMMANDCODE_LIVE_TESTS` | `0` | Set to `1` to run the network test suite |
207+
| `COMMANDCODE_OUTPUT_TOKENS` | `32768` | Output token limit declared per model (OpenCode sends it as `max_completion_tokens`). Raise it for models that support more |
207208

208209
Runtime kill switch for connection hygiene: create a sentinel file named
209210
`.disable-connection-close` inside the plugin directory.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "opencode-commandcode",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "Production-grade OpenCode plugin for Command Code: dynamic model discovery, stability hooks and quota telemetry",
55
"main": "index.ts",
66
"type": "module",

‎src/index.ts‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@ import { describeRetryEvent } from "./telemetry.ts";
1818
import { buildReleaseDate, freeCostEntry } from "./catalog.ts";
1919

2020
export const PROVIDER_ID = "commandcode";
21+
22+
/**
23+
* Max completion tokens declared for every Command Code model.
24+
*
25+
* OpenCode forwards `limit.output` as `max_completion_tokens`, so this value caps
26+
* every response. The catalog API only exposes the context window, but every model
27+
* in models.dev's commandcode provider declares an output limit of at least 32,768
28+
* (the minimum is exactly that, for Qwen3.8-27B and Ling 3.1 Flash), so 32,768 is
29+
* the highest value that is safe across the whole catalog.
30+
*
31+
* Override with COMMANDCODE_OUTPUT_TOKENS when a specific model needs more (the
32+
* DeepSeek V4.1 Flash 1017 build supports 393,216).
33+
*/
34+
function outputLimit(): number {
35+
const raw = Number(process.env.COMMANDCODE_OUTPUT_TOKENS);
36+
if (Number.isFinite(raw) && raw >= 1024) return Math.floor(raw);
37+
return 32768;
38+
}
2139
const WATCHDOG_TIMEOUT_MS = 60_000;
2240

2341
function logPath(name: string): string {
@@ -82,7 +100,7 @@ function applyModelCatalog(editor: any, models: any[]): { registered: number; sk
82100
draft.enabled = true;
83101
draft.limit = {
84102
context: model.context_length || 200000,
85-
output: 16384,
103+
output: outputLimit(),
86104
};
87105
draft.capabilities = {
88106
tools: true,

0 commit comments

Comments
 (0)