Skip to content

Commit bf3d4ed

Browse files
QUSETIONSclaude
andcommitted
feat: DeepSeek V4 Pro model support
- Added deepseek-v4-pro[1m] to BUILTIN_MODELS as CUSTOM provider - DeepSeek API auto-detection via DEEPSEEK_API_KEY env var - Auto-routes to https://api.deepseek.com/v1 when key present - Fallback to CUSTOM_API_BASE_URL / OPENAI_API_KEY if set 736 passed, 2 skipped Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 0cd95a4 commit bf3d4ed

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

minicode/model_registry.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ def _aliases(name: str) -> list[str]:
296296
_register(ModelInfo("deepseek/deepseek-chat", Provider.OPENROUTER,
297297
context_window=128_000, max_output_tokens=8_192,
298298
pricing_input=0.14, pricing_output=0.28))
299+
_register(ModelInfo("deepseek-v4-pro[1m]", Provider.CUSTOM,
300+
display_name="DeepSeek V4 Pro",
301+
context_window=128_000, max_output_tokens=8_192,
302+
pricing_input=0.10, pricing_output=0.40))
299303
_register(ModelInfo("qwen/qwen3-235b-a22b", Provider.OPENROUTER,
300304
context_window=128_000, max_output_tokens=8_192,
301305
pricing_input=0.22, pricing_output=0.88))
@@ -334,7 +338,15 @@ def detect_provider(model: str, runtime: dict | None = None) -> Provider:
334338
# Default to OpenRouter for vendor-prefixed models
335339
return Provider.OPENROUTER
336340

337-
# 2. OpenAI detection
341+
# 2. DeepSeek direct API detection
342+
if model_lower.startswith("deepseek") or "deepseek" in model_lower:
343+
if os.environ.get("DEEPSEEK_API_KEY"):
344+
return Provider.CUSTOM
345+
# If registered as CUSTOM in BUILTIN_MODELS, use that
346+
if model in BUILTIN_MODELS and BUILTIN_MODELS[model].provider == Provider.CUSTOM:
347+
return Provider.CUSTOM
348+
349+
# 3. OpenAI detection
338350
openai_prefixes = ("gpt-4", "gpt-3.5", "o1-", "o3-", "chatgpt-")
339351
openai_exact = {"gpt-4o", "gpt-4o-mini", "gpt-4-turbo", "o1", "o1-mini", "o3-mini"}
340352
if model_lower in openai_exact or any(model_lower.startswith(p) for p in openai_prefixes):
@@ -439,12 +451,16 @@ def build_provider_config(model: str, runtime: dict | None = None) -> ProviderCo
439451
)
440452

441453
if provider == Provider.CUSTOM:
454+
# Check for DeepSeek-specific env vars first
455+
deepseek_key = os.environ.get("DEEPSEEK_API_KEY", "")
442456
base_url = (
443457
os.environ.get("CUSTOM_API_BASE_URL", "")
458+
or (deepseek_key and "https://api.deepseek.com/v1" or "")
444459
or runtime.get("customBaseUrl", "")
445460
).rstrip("/")
446461
api_key = (
447462
os.environ.get("CUSTOM_API_KEY", "")
463+
or deepseek_key
448464
or os.environ.get("OPENAI_API_KEY", "")
449465
or runtime.get("customApiKey", "")
450466
)

0 commit comments

Comments
 (0)