Context
Heavy headless/automation user of the zcode CLI (0.16.9, zcode --prompt) with a GLM coding plan. Three connected requests that would make per-dispatch model routing first-class for automation.
1. --model flag (or env) for headless prompts
zcode --prompt always runs the default model. Automation needs to pick the model per dispatch — e.g. route mechanical work to GLM-5.3-Flash to conserve GLM-5.3 quota (Flash's quota is separate and much larger, which makes this the single highest-leverage cost feature for plan users running automation). Today there is no CLI/env way to select a model headlessly.
2. Report the model in the --json envelope
The one-shot envelope carries sessionId, usage, projection — but not which model served the turn. Cost routing and audit need a model field on every result envelope (ideally per modelRequest when a turn spans models).
3. Standalone accounts for zcode app-server --stdio
We drive the app-server protocol directly for orchestration: NDJSON over stdio, bidirectional handshake (session/requestRuntimePreferences), session/create / session/send with per-send modelSelection {providerId, modelId} — all of which works well. However, on a bare app-server the provider registry stays empty: accounts appear to arrive only via a Desktop-side provider/updateAccountConfig push that carries credential material, so session/setModel and per-send modelSelection both fail the turn for headless orchestrators. A flag or env letting the app-server self-load the CLI's own logged-in accounts (standalone-account mode) would make the protocol usable without forwarding credentials from the client.
Happy to share protocol traces if useful — thanks!
Context
Heavy headless/automation user of the zcode CLI (0.16.9,
zcode --prompt) with a GLM coding plan. Three connected requests that would make per-dispatch model routing first-class for automation.1.
--modelflag (or env) for headless promptszcode --promptalways runs the default model. Automation needs to pick the model per dispatch — e.g. route mechanical work to GLM-5.3-Flash to conserve GLM-5.3 quota (Flash's quota is separate and much larger, which makes this the single highest-leverage cost feature for plan users running automation). Today there is no CLI/env way to select a model headlessly.2. Report the model in the
--jsonenvelopeThe one-shot envelope carries
sessionId,usage,projection— but not which model served the turn. Cost routing and audit need amodelfield on every result envelope (ideally per modelRequest when a turn spans models).3. Standalone accounts for
zcode app-server --stdioWe drive the app-server protocol directly for orchestration: NDJSON over stdio, bidirectional handshake (
session/requestRuntimePreferences),session/create/session/sendwith per-sendmodelSelection {providerId, modelId}— all of which works well. However, on a bare app-server the provider registry stays empty: accounts appear to arrive only via a Desktop-sideprovider/updateAccountConfigpush that carries credential material, sosession/setModeland per-sendmodelSelectionboth fail the turn for headless orchestrators. A flag or env letting the app-server self-load the CLI's own logged-in accounts (standalone-account mode) would make the protocol usable without forwarding credentials from the client.Happy to share protocol traces if useful — thanks!