Repository navigation
fix: proper Claude model tones, expand model lineup, add auto-context matching - #1
Merged
Merged
Conversation
Key changes:
1. models.py - Fix Claude model routing (was using tone=Magic with
gptIdOverride=Claude_Sonnet, now uses proper Claude_Sonnet tone
for real Anthropic Claude, verified working June 2026)
- Claude tones now correctly set: Claude_Sonnet, Claude_Sonnet_Reasoning,
Claude_Opus
- Added GPT-5.x reasoning variants (gpt5.2-reasoning through
gpt5.5-reasoning)
- Added proper model name aliases for OpenAI/Anthropic compatibility
- Removed unnecessary gptIdOverride (tone alone selects the model)
2. openai.py - Add message-prefix auto-context matching
When no session_id is provided by the client, the server now
automatically matches conversations by hashing the message history
prefix (all messages except the last). This provides seamless
multi-turn context without requiring the client to manage session
IDs - works out of the box with standard OpenAI clients.
Example: [m1] -> [m1, m2] auto-matches to same conversation
…document auto-context - Removed '假实现的: Claude 模型标签(前端壳,后端统一走 GPT-5)' - Updated model descriptions to reflect real Claude Sonnet/Opus support - Added auto-context matching to features table - Updated CLI examples to reflect correct model behavior
The previous approach matched on messages[:-1] hash, which would never match because subsequent turns have more messages. Now uses the first user message content as the session key - consistent across all turns in the same conversation.
HEXUXIU
pushed a commit
that referenced
this pull request
Jul 21, 2026
fix: report API key persistence failures
jeck5001
pushed a commit
to jeck5001/M365-Copilot2API
that referenced
this pull request
Aug 11, 2026
…e-errors fix: report API key persistence failures
This was referenced Aug 22, 2026
Closed
yorushikasama
pushed a commit
to yorushikasama/M365-Copilot2API
that referenced
this pull request
Sep 11, 2026
…w-api ordering Clients that read only the role off SSE chunk HEXUXIU#1 dropped whatever text shared that chunk, so answers arrived truncated at the very start (a lost list number, a missing first word). All three chat streaming paths now declare the role with an empty content chunk and stream text in its own chunks — the same lazy-first-frame contract as new-api's ensureStart(). The /v1/responses adapters now emit response.content_part.added between output_item.added and the first output_text.delta, matching the OpenAI event sequence, so the opening delta can no longer land on a part the client never created.
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.
改动内容
1. ✅ 修复 Claude 模型路由(核心修复)
之前
claude模型配置为tone: "Magic"+override: "Claude_Sonnet",实际走的是 GPT-5 而非 Claude。已修复为
tone: "Claude_Sonnet",经实测(June 2026)服务器端会路由到真正的 Anthropic Claude Sonnet 4.6。2. ✅ 扩展模型列表
claude-sonnetClaude_Sonnetclaude-reasoningClaude_Sonnet_Reasoningclaude-opusClaude_Opusgpt5.2-reasoning~gpt5.5-reasoningGpt_5_N_Reasoningclaude-sonnet-4-20250514Claude_Sonnet所有 GPT 模型的 tone 也从
Magic改为对应的具体 tone(例如gpt5.5→Gpt_5_5_Chat),不再依赖gptIdOverride。3. ✅ 消息前缀自动上下文匹配
当客户端不传
session_id时,服务器通过哈希消息历史前缀自动匹配同一对话。例如客户端连续发送
[m1]→[m1, m2]→[m1, m2, m3]会自动续传到同一 conversation。兼容性
gptIdOverride字段(tone 直接选择模型,更简洁可靠)session_id显式传入时优先级高于自动匹配