153 lines
4.0 KiB
Python
153 lines
4.0 KiB
Python
from dataclasses import dataclass
|
|
from typing import Optional
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class QwenAPIModel:
|
|
model_id: str
|
|
supports_vision: bool = False
|
|
endpoint: str = "generation"
|
|
supports_thinking_control: bool = False
|
|
retirement_date: Optional[str] = None
|
|
replacement: Optional[str] = None
|
|
|
|
@property
|
|
def ui_label(self) -> str:
|
|
if self.retirement_date is None:
|
|
return self.model_id
|
|
|
|
replacement = f"; use {self.replacement}" if self.replacement else ""
|
|
return (
|
|
f"{self.model_id} (deprecated: offline scheduled "
|
|
f"{self.retirement_date}{replacement})"
|
|
)
|
|
|
|
|
|
QWEN_API_MODEL_SPECS = (
|
|
QwenAPIModel(
|
|
"qwen3.8-max",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
supports_thinking_control=True,
|
|
),
|
|
QwenAPIModel("qwen3.8-2.4t-a95b", supports_thinking_control=True),
|
|
QwenAPIModel(
|
|
"qwen3.7-plus",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
supports_thinking_control=True,
|
|
),
|
|
QwenAPIModel(
|
|
"qwen3.7-flash",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
supports_thinking_control=True,
|
|
),
|
|
QwenAPIModel("qwen3.7-max", supports_thinking_control=True),
|
|
QwenAPIModel(
|
|
"qwen3.7-max-2026-06-08",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
supports_thinking_control=True,
|
|
),
|
|
QwenAPIModel(
|
|
"qwen3.7-plus-2026-05-26",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
supports_thinking_control=True,
|
|
),
|
|
QwenAPIModel(
|
|
"qwen3.7-flash-2026-07-15",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
supports_thinking_control=True,
|
|
),
|
|
QwenAPIModel("qwen3.7-max-2026-05-20", supports_thinking_control=True),
|
|
QwenAPIModel(
|
|
"qwen3.6-plus",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
supports_thinking_control=True,
|
|
),
|
|
QwenAPIModel(
|
|
"qwen3.6-flash",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
supports_thinking_control=True,
|
|
),
|
|
QwenAPIModel(
|
|
"qwen3.6-plus-2026-04-02",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
supports_thinking_control=True,
|
|
),
|
|
QwenAPIModel(
|
|
"qwen3.6-flash-2026-04-16",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
supports_thinking_control=True,
|
|
),
|
|
QwenAPIModel(
|
|
"qwen3.6-35b-a3b",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
supports_thinking_control=True,
|
|
),
|
|
QwenAPIModel("qwen-plus"),
|
|
QwenAPIModel("qwen-max"),
|
|
QwenAPIModel("qwen-plus-latest"),
|
|
QwenAPIModel(
|
|
"qwen-vl-max",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
retirement_date="2026-10-10",
|
|
replacement="qwen3.7-plus",
|
|
),
|
|
QwenAPIModel(
|
|
"qwen-vl-plus",
|
|
supports_vision=True,
|
|
endpoint="multimodal",
|
|
retirement_date="2026-10-10",
|
|
replacement="qwen3.7-plus",
|
|
),
|
|
QwenAPIModel(
|
|
"qwen-turbo",
|
|
retirement_date="2026-10-10",
|
|
replacement="qwen3.7-flash",
|
|
),
|
|
)
|
|
|
|
QWEN_API_RETIRED_MODEL_IDS = {
|
|
"qwen-vl-max-latest",
|
|
"qwen-vl-max-2025-08-13",
|
|
"qwen-vl-max-2025-04-08",
|
|
"qwen-max-latest",
|
|
}
|
|
|
|
QWEN_API_MODEL_REGISTRY = {
|
|
model.model_id: model for model in QWEN_API_MODEL_SPECS
|
|
}
|
|
QWEN_API_MODELS = [model.ui_label for model in QWEN_API_MODEL_SPECS]
|
|
QWEN_API_MODEL_IDS = set(QWEN_API_MODEL_REGISTRY)
|
|
QWEN_API_VISION_MODEL_IDS = {
|
|
model.model_id for model in QWEN_API_MODEL_SPECS if model.supports_vision
|
|
}
|
|
QWEN_API_MULTIMODAL_ENDPOINT_MODEL_IDS = {
|
|
model.model_id
|
|
for model in QWEN_API_MODEL_SPECS
|
|
if model.endpoint == "multimodal"
|
|
}
|
|
QWEN_API_THINKING_CONTROL_MODEL_IDS = {
|
|
model.model_id
|
|
for model in QWEN_API_MODEL_SPECS
|
|
if model.supports_thinking_control
|
|
}
|
|
|
|
|
|
def normalize_api_model_name(model):
|
|
return model.split(" (", 1)[0]
|
|
|
|
|
|
def get_api_model_spec(model):
|
|
return QWEN_API_MODEL_REGISTRY.get(normalize_api_model_name(model))
|