Skip to content

Commit e06c550

Browse files
CopilotVizards
andauthored
fix(auth): allow compatible provider API tokens (#34)
Remove the hard `sk-` prefix validation from API key input so users can configure DeepSeek-compatible third-party provider tokens with custom base URLs. Keep empty input validation and trimmed storage behavior, update the API key prompt copy to clarify that official DeepSeek keys usually start with `sk-`, and relax README setup wording accordingly. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Vizards <13443193+Vizards@users.noreply.github.com>
1 parent 6b4c152 commit e06c550

3 files changed

Lines changed: 7 additions & 11 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ Pure VS Code API + Node.js built-ins. No Python, no Docker, no local proxy serve
5959

6060
- VS Code 1.116 or later. This extension relies on non-public Copilot Chat APIs that may break on newer VS Code versions — [report an issue](https://github.com/Vizards/deepseek-v4-for-copilot/issues) if you hit one.
6161
- GitHub Copilot subscription (Free / Pro / Enterprise — the free tier works)
62-
- DeepSeek API key from [platform.deepseek.com](https://platform.deepseek.com)
62+
- DeepSeek API key from [platform.deepseek.com](https://platform.deepseek.com), or a compatible provider token when using a custom `deepseek-copilot.baseUrl`
6363

6464
### Usage
6565

6666
1. Install from the VS Code Marketplace
6767
2. Run **DeepSeek: Set API Key** from the Command Palette (`Cmd+Shift+P`)
68-
3. Paste your key (starts with `sk-`)
68+
3. Paste your key or compatible provider token (official DeepSeek keys usually start with `sk-`)
6969
4. Open Copilot Chat, click the model picker, pick **DeepSeek V4 Pro** or **DeepSeek V4 Flash**
7070
5. That's it — chat away
7171

src/auth.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ export class AuthManager {
6666
if (!value?.trim()) {
6767
return t('auth.emptyValidation');
6868
}
69-
if (!value.startsWith('sk-')) {
70-
return t('auth.prefixValidation');
71-
}
7269
return undefined;
7370
},
7471
});

src/i18n.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ const zh: Translations = {
2424

2525
// API Key
2626
'auth.apiKeyRequiredDetail': '请先配置 API Key',
27-
'auth.prompt': '请输入 DeepSeek API Key',
28-
'auth.placeholder': 'sk-...',
27+
'auth.prompt': '请输入 DeepSeek API Key 或兼容服务令牌。官方 DeepSeek Key 通常以 "sk-" 开头。',
28+
'auth.placeholder': 'sk-... 或服务商令牌',
2929
'auth.emptyValidation': 'API Key 不能为空',
30-
'auth.prefixValidation': 'API Key 应以 "sk-" 开头',
3130
'auth.saved': 'API Key 已安全保存。',
3231
'auth.removed': 'API Key 已移除。',
3332
'auth.notConfigured': 'API Key 未配置,请在命令面板运行 "DeepSeek: 设置 API Key"。',
@@ -64,10 +63,10 @@ const en: Translations = {
6463

6564
// API Key
6665
'auth.apiKeyRequiredDetail': 'Please run DeepSeek: Set API Key to configure.',
67-
'auth.prompt': 'Enter your DeepSeek API key',
68-
'auth.placeholder': 'sk-...',
66+
'auth.prompt':
67+
'Enter your DeepSeek API key or compatible provider token. Official DeepSeek keys usually start with "sk-".',
68+
'auth.placeholder': 'sk-... or provider token',
6969
'auth.emptyValidation': 'API key cannot be empty',
70-
'auth.prefixValidation': 'API key should start with "sk-"',
7170
'auth.saved': 'DeepSeek API key saved.',
7271
'auth.removed': 'DeepSeek API key removed.',
7372
'auth.notConfigured':

0 commit comments

Comments
 (0)