feat: support Command Code Provider Chat Completions API - #22
Merged
Mars-Sea merged 3 commits intoSep 5, 2026
Merged
Conversation
Use the documented /provider/v1/chat/completions transport for accounts with Provider API access, falling back to /alpha/generate only when the Provider API returns upgrade_required (Go plan). The Chat Completions transport: - sends a flat OpenAI-compatible request body - replays historical reasoning as reasoning_content (DeepSeek thinking-mode tool-loop requirement) - parses OpenAI SSE reasoning/content/tool_calls/usage into StreamChunks - keeps the legacy /alpha/generate transport unchanged, including its existing no-reasoning-replay behavior Includes protocol selection with per-account cache and unit tests.
Mars-Sea
added a commit
that referenced
this pull request
Sep 7, 2026
…mmand-code@1.50.0 sync - feat: support Command Code Provider Chat Completions API (#22): use the documented POST /provider/v1/chat/completions transport for accounts with Provider API access, falling back to /alpha/generate only on upgrade_required (Go plan). Historical reasoning replays as reasoning_content; OpenAI SSE parsed into StreamChunks. Legacy transport unchanged, including no-reasoning-replay. - fix: remap overlong cross-provider tool-call ids to the gateway limit (#23): mid-session switches from another provider replay that provider's tool ids verbatim; ids longer than 64 chars are rejected mid-stream (input[N].call_id must be <= 64). Both transports remap overlong paired ids to short per-request aliases (cc-1, cc-2, ...), correlated across call/result; ids within the limit pass through unchanged. - chore: sync with the official command-code@1.50.0 CLI (2026-09-06): COMMAND_CODE_CLI_VERSION is now 1.50.0, re-verified with no snapshot changes (efforts, vision, thinking, plans, subscription maps, deals, peak/off-peak windows all identical to 1.49.1).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for the documented
/provider/v1/chat/completionsendpoint as the preferred chat transport for accounts with Provider API access./alpha/generateonly when Provider API returns403 upgrade_required(Go plan).reasoning_content, which DeepSeek's thinking-mode/tool-loop contract requires.reasoning/reasoning_content/content/tool_calls/usageinto dshStreamChunk./alpha/generatetransport and its existing no-reasoning-replay behavior unchanged.Testing
npm run typechecknpm test(292 passing)npm run buildreasoning_contentreplay, OpenAI SSE reasoning/content/tool-call parsing, and auto fallback/caching onupgrade_required.Closes discussion in #19 about Plan-type based endpoint selection.