/**
 * DeepSeek Provider Definition
 */

import { createDeepSeek } from '@ai-sdk/deepseek';
import type { ProviderInfo, ProviderFactory } from '../types.js';

export const deepseekProvider: ProviderInfo = {
  id: 'deepseek',
  name: 'DeepSeek',
  description: 'DeepSeek AI models',
  builtin: true,
  apiKeyEnvVar: 'DEEPSEEK_API_KEY',
  models: [
    {
      id: 'deepseek-chat',
      name: 'DeepSeek Chat',
      capabilities: { vision: false, functionCalling: true, streaming: true },
      contextWindow: 64000,
      maxOutput: 8192,
    },
    {
      id: 'deepseek-coder',
      name: 'DeepSeek Coder',
      capabilities: { vision: false, functionCalling: true, streaming: true },
      contextWindow: 64000,
      maxOutput: 8192,
    },
    {
      id: 'deepseek-reasoner',
      name: 'DeepSeek Reasoner',
      capabilities: { vision: false, functionCalling: false, streaming: true },
      contextWindow: 64000,
      maxOutput: 8192,
    },
  ],
  allowCustomModels: true,
};

export const deepseekFactory: ProviderFactory = ({ apiKey, baseUrl }) => {
  const client = createDeepSeek({ apiKey, baseURL: baseUrl });
  return (model) => client(model);
};
