Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,8 @@ describe('LocalModelResolver custom provider compat overrides', () => {
});

it.each([
'https://api.siliconflow.cn/v1',
'https://api.siliconflow.com/v1',
'https://dashscope.aliyuncs.com/compatible-mode/v1',
'https://dashscope-intl.aliyuncs.com/compatible-mode/v1',
'https://dashscope-us.aliyuncs.com/compatible-mode/v1',
Expand All @@ -1471,6 +1473,11 @@ describe('LocalModelResolver custom provider compat overrides', () => {

it.each([
['https://api.openai.com/v1', 'developer'],
['https://api.deepseek.com/v1', 'system'],
['https://api.siliconflow.cn.example/v1', 'developer'],
['https://gateway.example/api.siliconflow.cn/v1', 'developer'],
['https://api.siliconflow.com.example/v1', 'developer'],
['https://gateway.example/api.siliconflow.com/v1', 'developer'],
['https://api.moonshot.cn/v1', 'system'],
['https://api.moonshot.ai/v1', 'system'],
['https://dashscope.aliyuncs.com.example/v1', 'developer'],
Expand All @@ -1487,6 +1494,8 @@ describe('LocalModelResolver custom provider compat overrides', () => {
});

it.each([
'https://api.siliconflow.cn/v1',
'https://api.siliconflow.com/v1',
'https://dashscope.aliyuncs.com/compatible-mode/v1',
'https://coding.dashscope.aliyuncs.com/v1',
'https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1',
Expand Down
9 changes: 9 additions & 0 deletions third_party/pi-mono/MINIMAX_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ This directory vendors `pi-mono` as source so MiniMax can patch, validate, and s

No upstream source files are changed in the baseline import.

### 2026-09-19 — preserve the system role for SiliconFlow

- Reason: thinking-enabled OpenAI-compatible requests sent the `developer` role, which is absent from SiliconFlow's documented message schema.
- Affected package: `packages/ai` (`@earendil-works/pi-ai`), OpenAI Completions compatibility detection.
- Change: default to the `system` role on the exact `api.siliconflow.cn` and `api.siliconflow.com` hosts. Preserve thinking, explicit compatibility overrides, other request options, and other endpoints.
- References: [official Chat Completions schema](https://docs.siliconflow.com/en/api-reference/chat-completions/chat-completions) and [pi's SiliconFlow provider proposal](https://github.com/earendil-works/pi/pull/8113) (closed without merging).
- Upstream PR: not opened.
- Validation: outgoing-payload regressions in `packages/local-runtime-v2/src/service/model-system/resolution/local-model-resolver.test.ts`, including both official hosts, unrelated hosts, and explicit compatibility overrides.

### 2026-09-19 — preserve the system role for DashScope

- Reason: DashScope endpoints were treated as supporting the `developer` role, causing thinking-enabled OpenAI-compatible conversations to send an unsupported system-prompt role.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,7 @@ function detectCompat(model: Model<"openai-completions">): ResolvedOpenAIComplet
const isDashScope =
/^https?:\/\/(?:dashscope(?:-intl|-us)?|(?:coding(?:-intl)?|cn-hongkong)\.dashscope)\.aliyuncs\.com(?::\d+)?(?:\/|$)/i.test(baseUrl) ||
/^https?:\/\/[a-z0-9-]+\.(?:cn-beijing|cn-hongkong|ap-southeast-1|ap-northeast-1|eu-central-1|us-east-1)\.maas\.aliyuncs\.com(?::\d+)?(?:\/|$)/i.test(baseUrl);
const isSiliconFlow = /^https?:\/\/api\.siliconflow\.(?:cn|com)(?::\d+)?(?:\/|$)/i.test(baseUrl);
const isOpenRouter = provider === "openrouter" || baseUrl.includes("openrouter.ai");
const isCloudflareWorkersAI = provider === "cloudflare-workers-ai" || baseUrl.includes("api.cloudflare.com");
const isCloudflareAiGateway = provider === "cloudflare-ai-gateway" || baseUrl.includes("gateway.ai.cloudflare.com");
Expand Down Expand Up @@ -1129,7 +1130,7 @@ function detectCompat(model: Model<"openai-completions">): ResolvedOpenAIComplet
return {
supportsStore: !isNonStandard,
supportsDeveloperRole:
!isKimiCoding && !isDashScope && (isOpenRouterDeveloperRoleModel || (!isNonStandard && !isOpenRouter)),
!isKimiCoding && !isDashScope && !isSiliconFlow && (isOpenRouterDeveloperRoleModel || (!isNonStandard && !isOpenRouter)),
supportsReasoningEffort:
!isGrok && !isZai && !isMoonshot && !isTogether && !isCloudflareAiGateway && !isNvidia && !isAntLing,
supportsUsageInStreaming: true,
Expand Down
Loading