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 @@ -49,16 +49,41 @@ describe('DeepSeekOpenAICompatibleProvider', () => {
expect(result).toBe(true);
});

it('returns false for non deepseek baseUrl', () => {
it('returns false when neither baseUrl nor model match deepseek', () => {
const config = {
...mockContentGeneratorConfig,
baseUrl: 'https://api.example.com/v1',
model: 'gpt-4o',
} as ContentGeneratorConfig;

const result =
DeepSeekOpenAICompatibleProvider.isDeepSeekProvider(config);
expect(result).toBe(false);
});

it('returns true for deepseek model on a non-deepseek baseUrl (e.g. sglang) — issue #3613', () => {
const config = {
...mockContentGeneratorConfig,
baseUrl: 'https://my-sglang.example.com:8000/v1',
model: 'deepseek-v4-pro',
} as ContentGeneratorConfig;

const result =
DeepSeekOpenAICompatibleProvider.isDeepSeekProvider(config);
expect(result).toBe(true);
});

it('matches model name case-insensitively', () => {
const config = {
...mockContentGeneratorConfig,
baseUrl: 'https://my-vllm.example.com/v1',
model: 'DeepSeek-R1',
} as ContentGeneratorConfig;

const result =
DeepSeekOpenAICompatibleProvider.isDeepSeekProvider(config);
expect(result).toBe(true);
});
});

describe('buildRequest', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,17 @@
contentGeneratorConfig: ContentGeneratorConfig,
): boolean {
const baseUrl = contentGeneratorConfig.baseUrl ?? '';
if (baseUrl.toLowerCase().includes('api.deepseek.com')) {
return true;
}

return baseUrl.toLowerCase().includes('api.deepseek.com');
// DeepSeek models served behind any OpenAI-compatible endpoint (sglang,
// vllm, ollama, etc.) share the same content-format constraint that the
// official api.deepseek.com endpoint has. Detect them by model name so
// the buildRequest flattening below kicks in.
// See https://github.com/QwenLM/qwen-code/issues/3613
const model = contentGeneratorConfig.model ?? '';
return model.toLowerCase().includes('deepseek');
}

/**
Expand Down
Loading