Skip to content

Commit de132ca

Browse files
authored
feat: add configurable API model IDs for DeepSeek V4 Flash and Pro models (#4)
1 parent 89e1139 commit de132ca

3 files changed

Lines changed: 31 additions & 1 deletion

File tree

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,25 @@
116116
"minimum": 0,
117117
"description": "Maximum number of output tokens per request. Set to 0 to use the API default (no limit). Useful for controlling costs."
118118
},
119+
"deepseek-copilot.modelIdOverrides": {
120+
"type": "object",
121+
"default": {
122+
"deepseek-v4-flash": "deepseek-v4-flash",
123+
"deepseek-v4-pro": "deepseek-v4-pro"
124+
},
125+
"description": "Override the API model ID sent for each DeepSeek model. Defaults are prefilled with official DeepSeek IDs; change them only when using a compatible third-party API that uses different model names.",
126+
"additionalProperties": false,
127+
"properties": {
128+
"deepseek-v4-flash": {
129+
"type": "string",
130+
"description": "API model ID for DeepSeek V4 Flash"
131+
},
132+
"deepseek-v4-pro": {
133+
"type": "string",
134+
"description": "API model ID for DeepSeek V4 Pro"
135+
}
136+
}
137+
},
119138
"deepseek-copilot.visionModel": {
120139
"type": "string",
121140
"default": "",

src/auth.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,17 @@ export class AuthManager {
9090
return config.get<string>('baseUrl') || 'https://api.deepseek.com';
9191
}
9292

93+
/**
94+
* Resolve the API model ID to send to the DeepSeek endpoint.
95+
* Users can override the default IDs via settings to support compatible APIs.
96+
*/
97+
getApiModelId(vscodeModelId: string): string {
98+
const config = vscode.workspace.getConfiguration('deepseek-copilot');
99+
const overrides = config.get<Record<string, string>>('modelIdOverrides');
100+
const override = overrides?.[vscodeModelId]?.trim();
101+
return override || vscodeModelId;
102+
}
103+
93104
/**
94105
* Get max tokens limit (0 = no limit).
95106
*/

src/provider/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export class DeepSeekChatProvider implements vscode.LanguageModelChatProvider {
231231
return new Promise<void>((resolve, reject) => {
232232
client.streamChatCompletion(
233233
{
234-
model: modelInfo.id,
234+
model: this.authManager.getApiModelId(modelInfo.id),
235235
messages: deepseekMessages,
236236
stream: true,
237237
tools,

0 commit comments

Comments
 (0)