Default to DeepSeek V4.1 Flash, show API cost in USD, and re-analyze after replacing BOM and netlist.

V4.1 is natively multimodal so every stage uses deepseek-flash; pricing and the UI now surface dollars instead of empty credits. KiCad netlists and neighborhood fingerprints land in the same cut so a second run can keep the project and skip unchanged ICs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-10 20:55:35 +02:00
co-authored by Cursor
parent d454cf75af
commit 61f85f519b
29 changed files with 1174 additions and 118 deletions
+12 -2
View File
@@ -38,11 +38,21 @@ from backend.services.llm.types import (
log = logging.getLogger(__name__)
_VISION_HINT = "vision"
# V4.1 Flash is natively multimodal. Legacy flash / vision-exp names
# still route there. v4-pro does not accept images until it is retired
# onto Flash (2026-09-14).
_VISION_MODELS = {
"deepseek-flash",
"deepseek-v4-flash",
"deepseek-v4-flash-vision-exp",
}
def _is_vision_model(model: str) -> bool:
return _VISION_HINT in model.lower()
name = (model or "").strip().lower()
if name in _VISION_MODELS or "vision" in name:
return True
return name.startswith("deepseek-flash")
def _to_openai_tool(t: ToolSchema) -> dict:
+15 -8
View File
@@ -11,15 +11,22 @@ from __future__ import annotations
# DeepSeek: https://api-docs.deepseek.com/quick_start/pricing
# Anthropic: https://docs.anthropic.com/en/docs/about-claude/pricing
# Google: https://ai.google.dev/pricing
# Last updated: 2026-08-27
# Last updated: 2026-09-10
#
# DeepSeek: peak weekday rates (conservative). Off-peak is 50% of these.
# Cache-hit input is billed via CACHE_RATES["deepseek"]["read"] as a
# multiplier on the miss input rate (0.006 / 0.30 = 0.02).
_DEEPSEEK_FLASH = {"input": 0.30, "output": 1.20}
_DEEPSEEK_PRO = {"input": 1.32, "output": 3.96}
PRICING: dict[str, dict[str, dict[str, float]]] = {
"deepseek": {
# Peak-hour rates (conservative). Off-peak is 50% of these.
# Cache-hit input is billed via CACHE_RATES["deepseek"]["read"].
"deepseek-v4-flash": {"input": 0.44, "output": 1.32},
"deepseek-v4-flash-vision-exp": {"input": 0.44, "output": 1.32},
"deepseek-v4-pro": {"input": 1.32, "output": 3.96},
"default": {"input": 0.44, "output": 1.32},
"deepseek-flash": _DEEPSEEK_FLASH,
"deepseek-v4-flash": _DEEPSEEK_FLASH,
"deepseek-v4-flash-vision-exp": _DEEPSEEK_FLASH,
# Billed at Pro until 2026-09-14 04:00 UTC, then routed to Flash.
"deepseek-v4-pro": _DEEPSEEK_PRO,
"default": _DEEPSEEK_FLASH,
},
"anthropic": {
"claude-opus-4-6": {"input": 5.00, "output": 25.00},
@@ -63,7 +70,7 @@ PRICING: dict[str, dict[str, dict[str, float]]] = {
# normal input pass)
# read: cost when a cached prefix is *reused* (much cheaper)
CACHE_RATES: dict[str, dict[str, float]] = {
"deepseek": {"create": 1.00, "read": 0.032},
"deepseek": {"create": 1.00, "read": 0.02},
"anthropic": {"create": 1.25, "read": 0.10},
"gemini": {"create": 1.00, "read": 0.25},
}