feature about chat completions reasoning, support claude model enable thinking & interleaved thinking , and support gemini-3-x thinking#164
Closed
caozhiyuan wants to merge 17 commits into
Conversation
…g order when stream=false and exclude reasoning_opaque from token calculation in calculateMessageTokens
…llback VSCode version
…inking budget integration
…reasoning_opaque in different deltas
When account type is not specified or set to 'individual', use the default api.githubcopilot.com URL instead of constructing a subdomain-based URL. This restores previous behavior where business users could work without explicitly specifying their account type, as the default URL works for both individual and business accounts. Only constructs account-type-specific URLs (api.business.githubcopilot.com, api.enterprise.githubcopilot.com) when those account types are explicitly specified.
fix: use default API URL when account type is individual
mrhanhan
suggested changes
Jan 5, 2026
mrhanhan
left a comment
There was a problem hiding this comment.
I believe that regularization could be used to transform the Claude model here, which would be better.
function translateModelName(model: string): string {
// Subagent requests use a specific model number which Copilot doesn't support
if (model.startsWith("claude")) {
const newModel = model.replaceAll(
/(claude-(?:haiku|sonnet|opus)-\d+)-(\d+)(?:[.-]\d+)?/g,
"$1.$2",
)
consola.log("Use Model:", model, newModel)
return newModel
}
consola.log("Use Model:", model)
return model
}
Contributor
Author
|
@mrhanhan Actually, this piece of translateModelName code is already useless . claude setting change like this |
Contributor
Author
|
You can also see it in README.md https://github.com/ericc-ch/copilot-api?tab=readme-ov-file#manual-configuration-with-settingsjson |
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.


This pull request introduces significant improvements to the translation logic between Anthropic and OpenAI message formats, especially around the new interleaved thinking protocol for Claude models. It adds support for thinking blocks in both streaming and non-streaming translation flows, updates protocol and API versions, and refines how message content is handled to ensure compatibility and correctness.
Anthropic <-> OpenAI translation improvements:
reasoning_textandreasoning_opaquefields, with appropriate filtering and content handling. [1] [2] [3] [4] [5] [6] [7]thinking_budgetparameter, calculated based on the model's capabilities and request payload, and passed through to copilot as needed. [1] [2]Streaming translation and state handling:
AnthropicStreamStateinterface and related state initialization to trackthinkingBlockOpen. [1] [2]Protocol and API version updates:
0.35.0and2025-10-01respectively, and changed theopenai-intentheader fromconversation-paneltoconversation-agentfor more accurate intent signaling. [1] [2]Message content and tokenization:
reasoning_opaquefield, preventing it from being double-counted in token calculations.Type and interface enhancements:
AnthropicThinkingBlockinterface to include asignaturefield, supporting signature-based validation and filtering for thinking blocks.These changes collectively ensure robust support for the new Claude thinking protocol, improve translation accuracy, and future-proof the integration with updated API versions.