Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

feat: add DeepSeek compatibility

NextAlexc0dc09fb5d00
diff --git a/src/core/capture/ai/__tests__/validate.test.ts b/src/core/capture/ai/__tests__/validate.test.ts
index 1004cc3..2e850af 100644
--- a/src/core/capture/ai/__tests__/validate.test.ts
+++ b/src/core/capture/ai/__tests__/validate.test.ts
@@ -59,6 +59,14 @@ describe('validateApiKey', () => {
expect(init.headers.Authorization).toBe('Bearer gsk-key');
});
+ it('checks a deepseek key against deepseek, not openai', async () => {
+ fetchMock.mockResolvedValue({ ok: true, status: 200 });
+ expect(await validateApiKey('deepseek', 'sk-deepseek')).toEqual({ valid: true });
+ const [url, init] = fetchMock.mock.calls[0];
+ expect(url).toBe('https://api.deepseek.com/models');
+ expect(init.headers.Authorization).toBe('Bearer sk-deepseek');
+ });
+
it('gives up rather than spinning forever when a host never answers', async () => {
fetchMock.mockResolvedValue({ ok: true, status: 200, json: () => Promise.resolve(null) });
await validateApiKey('openai', 'sk-key');
diff --git a/src/core/capture/ai/models.ts b/src/core/capture/ai/models.ts
index a0407ee..779c77c 100644
--- a/src/core/capture/ai/models.ts
+++ b/src/core/capture/ai/models.ts
@@ -36,6 +36,15 @@ export const AI_PROVIDERS: Record<string, AIProviderConfig> = {
models: [],
baseUrl: true,
},
+ deepseek: {
+ label: 'DeepSeek',
+ defaultModel: 'deepseek-v4-flash',
+ models: [
+ { id: 'deepseek-v4-flash', label: 'DeepSeek V4 Flash' },
+ { id: 'deepseek-v4-pro', label: 'DeepSeek V4 Pro' },
+ { id: 'deepseek-v4-flash-vision-exp', label: 'DeepSeek V4 Flash Vision Exp' },
+ ],
+ },
};
export type AIProviderKey = keyof typeof AI_PROVIDERS;
diff --git a/src/core/capture/ai/provider.ts b/src/core/capture/ai/provider.ts
index da882ae..4a4b3ae 100644
--- a/src/core/capture/ai/provider.ts
+++ b/src/core/capture/ai/provider.ts
@@ -7,5 +7,6 @@ export function createModel(provider: string, model: string, apiKey: string, bas
const baseURL = baseUrl?.trim();
return createOpenAI(baseURL ? { apiKey, baseURL } : { apiKey })(model);
}
+ if (provider === 'deepseek') return createOpenAI({ apiKey, baseURL: 'https://api.deepseek.com', name: 'deepseek' })(model);
return createOpenAI({ apiKey })(model);
}
diff --git a/src/core/capture/ai/validate.ts b/src/core/capture/ai/validate.ts
index c421506..04a8d9e 100644
--- a/src/core/capture/ai/validate.ts
+++ b/src/core/capture/ai/validate.ts
@@ -28,6 +28,10 @@ const ENDPOINTS: Record<string, { url?: string; baseUrl?: boolean; headers: (key
baseUrl: true,
headers: (key) => ({ Authorization: `Bearer ${key}` }),
},
+ deepseek: {
+ url: 'https://api.deepseek.com/models',
+ headers: (key) => ({ Authorization: `Bearer ${key}` }),
+ },
};
function endpointUrl(provider: string, baseUrl?: string): string | null {
diff --git a/src/core/guides/types.ts b/src/core/guides/types.ts
index 4c85e8f..f7f874a 100644
--- a/src/core/guides/types.ts
+++ b/src/core/guides/types.ts
@@ -59,7 +59,7 @@ export interface Screenshot {
export interface Settings {
aiApiKey: string;
- aiProvider: 'openai' | 'anthropic' | 'openaiCompatible';
+ aiProvider: 'openai' | 'anthropic' | 'openaiCompatible' | 'deepseek';
aiModel: string;
aiBaseUrl?: string;
voiceEnabled: boolean;