Skip to main content

roder_api/catalog/
deepseek.rs

1use super::{
2    ModelCatalogEntry, PROVIDER_DEEPSEEK, PROVIDER_KIND_DEEPSEEK, ProviderCatalogEntry, REASONING_HIGH,
3    REASONING_LOW, REASONING_MAX, REASONING_NONE, REASONING_XHIGH, ReasoningOption,
4};
5
6/// Default OpenAI-compatible Chat Completions base URL for DeepSeek Platform.
7pub const DEEPSEEK_DEFAULT_BASE_URL: &str = "https://api.deepseek.com/v1";
8
9/// Default DeepSeek model id (non-thinking chat alias).
10pub const DEEPSEEK_DEFAULT_MODEL: &str = "deepseek-chat";
11
12/// DeepSeek-specific API-key env aliases. `DEEPSEEK_API_KEY` is the primary key.
13pub const DEEPSEEK_ENV_ALIASES: &[&str] = &["RODER_DEEPSEEK_API_KEY"];
14
15pub(crate) const DEEPSEEK_PROVIDER: ProviderCatalogEntry = ProviderCatalogEntry {
16    id: PROVIDER_DEEPSEEK,
17    name: "DeepSeek Platform",
18    kind: PROVIDER_KIND_DEEPSEEK,
19    default_model: DEEPSEEK_DEFAULT_MODEL,
20    base_url: Some(DEEPSEEK_DEFAULT_BASE_URL),
21    env_key: Some("DEEPSEEK_API_KEY"),
22    env_aliases: DEEPSEEK_ENV_ALIASES,
23    requires_auth: true,
24    supports_websockets: false,
25};
26
27/// DeepSeek thinking-mode efforts from the Platform API docs.
28///
29/// Wire values are `low` / `high` / `max` (plus `xhigh`, which DeepSeek maps
30/// per-model). `none` disables thinking via `thinking: { type: "disabled" }`.
31/// Default effort is `high` when thinking is enabled.
32pub const DEEPSEEK_REASONING: &[ReasoningOption] = &[
33    ReasoningOption {
34        effort: REASONING_NONE,
35        description: "Disable DeepSeek thinking mode",
36    },
37    ReasoningOption {
38        effort: REASONING_LOW,
39        description: "Low DeepSeek thinking effort",
40    },
41    ReasoningOption {
42        effort: REASONING_HIGH,
43        description: "High DeepSeek thinking effort (API default)",
44    },
45    ReasoningOption {
46        effort: REASONING_XHIGH,
47        description: "Extra-high DeepSeek thinking effort",
48    },
49    ReasoningOption {
50        effort: REASONING_MAX,
51        description: "Maximum DeepSeek thinking effort",
52    },
53];
54
55pub(crate) const DEEPSEEK_CHAT: ModelCatalogEntry = model(
56    "deepseek-chat",
57    "DeepSeek Chat",
58    "DeepSeek non-thinking chat model alias (currently DeepSeek-V3.2 non-thinking mode).",
59    128_000,
60    8_192,
61    false,
62    REASONING_NONE,
63    DEEPSEEK_REASONING,
64);
65
66pub(crate) const DEEPSEEK_REASONER: ModelCatalogEntry = model(
67    "deepseek-reasoner",
68    "DeepSeek Reasoner",
69    "DeepSeek thinking/reasoner model alias (currently DeepSeek-V3.2 thinking mode).",
70    128_000,
71    64_000,
72    false,
73    REASONING_HIGH,
74    DEEPSEEK_REASONING,
75);
76
77pub(crate) const DEEPSEEK_V4_FLASH: ModelCatalogEntry = model(
78    "deepseek-v4-flash",
79    "DeepSeek V4 Flash",
80    "DeepSeek V4 Flash coding/chat model with optional thinking mode.",
81    128_000,
82    8_192,
83    false,
84    REASONING_HIGH,
85    DEEPSEEK_REASONING,
86);
87
88pub(crate) const DEEPSEEK_V4_PRO: ModelCatalogEntry = model(
89    "deepseek-v4-pro",
90    "DeepSeek V4 Pro",
91    "DeepSeek V4 Pro coding/reasoning model with thinking mode.",
92    128_000,
93    64_000,
94    false,
95    REASONING_HIGH,
96    DEEPSEEK_REASONING,
97);
98
99const fn model(
100    id: &'static str,
101    display_name: &'static str,
102    description: &'static str,
103    context_window: u32,
104    max_output_tokens: u32,
105    supports_images: bool,
106    default_reasoning: &'static str,
107    supported_reasoning: &'static [super::ReasoningOption],
108) -> ModelCatalogEntry {
109    ModelCatalogEntry {
110        id,
111        display_name,
112        description,
113        provider: PROVIDER_DEEPSEEK,
114        default_reasoning,
115        supported_reasoning,
116        context_window,
117        max_context_window: context_window,
118        auto_compact_token_limit: context_window.saturating_mul(9) / 10,
119        supports_compaction: false,
120        supports_images,
121        supports_tools: true,
122        supports_structured: true,
123        edit_tool: Some("edit"),
124        hidden: max_output_tokens == 0,
125    }
126}