Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 15x 15x 3x 3x 1x 249x 2x 1x 2x 498x 2x 4x 3x 3x | import { ModelInfo } from "../Provider.js";
import { Capabilities } from "./Capabilities.js";
import { ModelRegistry } from "../../models/ModelRegistry.js";
interface DeepSeekModel {
id: string;
object: "model";
owned_by: string;
}
interface DeepSeekModelListResponse {
object: "list";
data: DeepSeekModel[];
}
export class DeepSeekModels {
constructor(
private readonly baseUrl: string,
private readonly apiKey: string
) {}
async execute(): Promise<ModelInfo[]> {
const response = await fetch(`${this.baseUrl}/models`, {
method: "GET",
headers: {
Authorization: `Bearer ${this.apiKey}`
}
});
if (!response.ok) {
// Fallback to local registry
const localModels = ModelRegistry.all()
.filter((m) => m.provider === "deepseek")
.map((m) => ({
id: m.id,
name: m.name,
provider: "deepseek",
family: m.family ?? "deepseek",
context_window: m.context_window ?? null,
max_output_tokens: m.max_output_tokens ?? null,
modalities: m.modalities,
capabilities: m.capabilities,
pricing: m.pricing,
metadata: m.metadata
}));
return localModels;
}
const json = (await response.json()) as DeepSeekModelListResponse;
const localRegistry = ModelRegistry.all().filter((m) => m.provider === "deepseek");
return json.data.map((m) => {
// Try to find in local registry for enriched data (pricing, limits)
const local = localRegistry.find((l) => l.id === m.id);
Eif (local) {
return {
id: local.id,
name: local.name,
provider: "deepseek", // Ensure literal type
family: local.family ?? "deepseek", // Handle missing family
context_window: local.context_window ?? null,
max_output_tokens: local.max_output_tokens ?? null,
modalities: local.modalities,
capabilities: local.capabilities,
pricing: local.pricing,
metadata: local.metadata
};
}
return {
id: m.id,
name: m.id,
provider: "deepseek",
family: "deepseek",
context_window: Capabilities.getContextWindow(m.id),
max_output_tokens: Capabilities.getMaxOutputTokens(m.id),
modalities: { input: ["text"], output: ["text"] },
capabilities: Capabilities.getCapabilities(m.id),
pricing: {}
};
});
}
}
|