将qwen3.5系列替换为qwen3.6系列,新增dashscope调用的kimi-k2.6和deepseek-v3.2,将wan2.6系列替换为wan
1 files added
14 files modified
| | |
| | | |
| | | - **LLM 模型**: deepseek-chat, deepseek-reasoner, gpt-4o, gpt-4, gpt-5, o3, gemini-3-flash-preview, qwen3.5-plus, qwen3.5-max |
| | | - **VLM 评估模型**: qwen3.5-plus, qwen-vl-plus, qwen3.5-max, gemini-2.5-flash-image (性价比最高), gemini-2.0-flash |
| | | - **文生图模型**: doubao-seedream-5-0-260128, jimeng_t2i_v40, wan2.6-t2i, sora_image, gpt-image-1.5, gpt-image-2 |
| | | - **文生图模型**: doubao-seedream-5-0-260128, jimeng_t2i_v40, wan2.6-t2i, sora_image, gpt-image-2 |
| | | - **图生图模型**: doubao-seedream-5-0-260128, jimeng_t2i_v40, wan2.6-image |
| | | - **视频生成模型**: doubao-seedance-2-0-260128, wan2.7-i2v, wan2.6-i2v-flash, kling-v3, kling-v2-6, kling-v2-5-turbo |
| | | - **视频比例**: 16:9, 9:16, 1:1, 4:3, 3:4, 21:9 |
| | |
| | | |
| | | ################################################# API KEYS & URLS ################################################# |
| | | |
| | | # 官方 OpenAI API Key(用于 gpt-image-1.5 等需要直连官方的模型,走 LOCAL_PROXY 代理) |
| | | # 可用模型: gpt-image-1.5(文生图) |
| | | OPENAI_OFFICIAL_API_KEY="your_openai_official_key" |
| | | OPENAI_OFFICIAL_BASE_URL="https://api.openai.com/v1" |
| | | # OpenAI API Key |
| | | # 如果需要走代理,请配置下方的PROXY |
| | | # 可用模型: gpt-image-2(文生图),gpt-5.4(llm, vlm) |
| | | OPENAI_API_KEY="your_openai_official_key" |
| | | OPENAI_BASE_URL="https://api.openai.com/v1" |
| | | |
| | | # Gemini API Configuration |
| | | # 如果需要走代理,请配置下方的PROXY |
| | | # 可用模型: gemini-2.5-flash(LLM), gemini-2.0-flash(LLM), gemini-2.5-flash-image(VLM), gemini-2.0-flash-image(VLM) |
| | | GEMINI_API_KEY="your_gemini_api_key" |
| | | GOOGLE_GEMINI_BASE_URL="https://generativelanguage.googleapis.com/v1beta" |
| | |
| | | # ----------------------------------------------------------------------------------------------------------------- |
| | | |
| | | # http proxy settings |
| | | PROXY="" |
| | | LOCAL_PROXY="http://127.0.0.9090" |
| | | # 如果需要走代理,请配置下方的PROXY,LOCAL_PROXY,HTTP_PROXY,HTTPS_PROXY默认值均为PROXY |
| | | PROXY="http://127.0.0.9090" |
| | | LOCAL_PROXY="" |
| | | HTTP_PROXY="" |
| | | HTTPS_PROXY="" |
| | | |
| | |
| | | # LLM (OpenAI / Gemini) |
| | | OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "") |
| | | OPENAI_BASE_URL = os.getenv("OPENAI_BASE_URL", "https://api.openai.com/v1") |
| | | # 官方 OpenAI API Key(用于 gpt-image-1.5 等必须直连官方的模型) |
| | | OPENAI_OFFICIAL_API_KEY = os.getenv("OPENAI_OFFICIAL_API_KEY", "") |
| | | GEMINI_API_KEY = os.getenv("GEMINI_API_KEY", "") |
| | | GOOGLE_GEMINI_BASE_URL = os.getenv("GOOGLE_GEMINI_BASE_URL", "") |
| | | |
| | |
| | | |
| | | # 代理设置 |
| | | PROXY = os.getenv("PROXY", "") |
| | | LOCAL_PROXY = os.getenv("LOCAL_PROXY", "") |
| | | HTTP_PROXY = os.getenv("HTTP_PROXY", "") |
| | | HTTPS_PROXY = os.getenv("HTTPS_PROXY", "") |
| | | LOCAL_PROXY = os.getenv("LOCAL_PROXY", PROXY) |
| | | HTTP_PROXY = os.getenv("HTTP_PROXY", PROXY) |
| | | HTTPS_PROXY = os.getenv("HTTPS_PROXY", PROXY) |
| | | |
| | | # ========================== |
| | | # 视频生成参数配置 |
| | |
| | | "provider": "openai", |
| | | "type": ["llm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.01813, |
| | | "price_per_1k_output_token": 0.0725 |
| | | }, |
| | | "gpt-4": { |
| | | "name": "GPT-4", |
| | | "provider": "openai", |
| | | "type": ["llm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.02175, |
| | | "price_per_1k_output_token": 0.087 |
| | | "price_per_1k_input_token": 0.018, |
| | | "price_per_1k_output_token": 0.072 |
| | | }, |
| | | "gpt-5": { |
| | | "name": "GPT-5", |
| | | "provider": "openai", |
| | | "type": ["llm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.01813, |
| | | "price_per_1k_output_token": 0.10875 |
| | | "price_per_1k_input_token": 0.02, |
| | | "price_per_1k_output_token": 0.1 |
| | | }, |
| | | "gpt-5.1": { |
| | | "name": "GPT-5.1", |
| | | "gpt-5.4": { |
| | | "name": "GPT-5.4", |
| | | "provider": "openai", |
| | | "type": ["llm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.01813, |
| | | "price_per_1k_output_token": 0.10875 |
| | | }, |
| | | "o3": { |
| | | "name": "OpenAI o3", |
| | | "provider": "openai", |
| | | "type": ["llm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.0145, |
| | | "price_per_1k_output_token": 0.058 |
| | | }, |
| | | "qwen3.5-plus": { |
| | | "name": "Qwen 3.5 Plus", |
| | | "provider": "qwen", |
| | | "type": ["llm", "vlm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.0008, |
| | | "price_per_1k_output_token": 0.002 |
| | | "price_per_1k_input_token": 0.03, |
| | | "price_per_1k_output_token": 0.12 |
| | | }, |
| | | "qwen3.5-max": { |
| | | "name": "Qwen 3.5 Max", |
| | | "qwen3.6-max-preview": { |
| | | "name": "Qwen 3.6 Max Preview", |
| | | "provider": "qwen", |
| | | "type": ["llm", "vlm"], |
| | | "type": ["llm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.006, |
| | | "price_per_1k_output_token": 0.024 |
| | | }, |
| | | "qwen-vl-plus": { |
| | | "name": "Qwen VL Plus", |
| | | "qwen3-max": { |
| | | "name": "Qwen 3 Max", |
| | | "provider": "qwen", |
| | | "type": ["llm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.006, |
| | | "price_per_1k_output_token": 0.024 |
| | | }, |
| | | "deepseek-v3.2": { |
| | | "name": "DeepSeek V3.2 (DashScope)", |
| | | "provider": "qwen", |
| | | "type": ["llm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.002, |
| | | "price_per_1k_output_token": 0.008 |
| | | }, |
| | | "qwen3.6-plus": { |
| | | "name": "Qwen 3.6 Plus", |
| | | "provider": "qwen", |
| | | "type": ["vlm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.0008, |
| | | "price_per_1k_output_token": 0.002 |
| | | }, |
| | | "gemini-3-flash-preview": { |
| | | "name": "Gemini 3 Flash Preview", |
| | | "provider": "gemini", |
| | | "type": ["llm", "vlm"], |
| | | "qwen3.6-flash": { |
| | | "name": "Qwen 3.6 Flash", |
| | | "provider": "qwen", |
| | | "type": ["vlm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.00181, |
| | | "price_per_1k_output_token": 0.01088 |
| | | "price_per_1k_input_token": 0.0001, |
| | | "price_per_1k_output_token": 0.0001 |
| | | }, |
| | | "gemini-3-pro-preview": { |
| | | "name": "Gemini 3 Pro Preview", |
| | | "kimi-k2.6": { |
| | | "name": "Kimi K2.6", |
| | | "provider": "qwen", |
| | | "type": ["vlm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.001, |
| | | "price_per_1k_output_token": 0.003 |
| | | }, |
| | | "gemini-2.5-flash": { |
| | | "name": "Gemini 2.5 Flash", |
| | | "provider": "gemini", |
| | | "type": ["llm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.002, |
| | | "price_per_1k_output_token": 0.01 |
| | | }, |
| | | "gemini-2.0-flash": { |
| | | "name": "Gemini 2.0 Flash", |
| | | "provider": "gemini", |
| | | "type": ["llm", "vlm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.0145, |
| | | "price_per_1k_output_token": 0.087 |
| | | "price_per_1k_input_token": 0.002, |
| | | "price_per_1k_output_token": 0.01 |
| | | }, |
| | | "gemini-2.5-flash-image": { |
| | | "name": "Gemini 2.5 Flash Image", |
| | | "provider": "gemini", |
| | | "type": ["vlm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.00218, |
| | | "price_per_1k_output_token": 0.01813 |
| | | }, |
| | | "gemini-2.5-pro-image": { |
| | | "name": "Gemini 2.5 Pro Image", |
| | | "provider": "gemini", |
| | | "type": ["vlm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.00906, |
| | | "price_per_1k_output_token": 0.0725 |
| | | }, |
| | | "gemini-3-pro-image-preview": { |
| | | "name": "Gemini 3 Pro Image Preview", |
| | | "provider": "gemini", |
| | | "type": ["vlm"], |
| | | "concurrency": 10, |
| | | "price_per_1k_input_token": 0.0145, |
| | | "price_per_1k_output_token": 0.087 |
| | | "price_per_1k_input_token": 0.002, |
| | | "price_per_1k_output_token": 0.01 |
| | | }, |
| | | "jimeng_t2i_v40": { |
| | | "name": "JiMeng T2I V4.0", |
| | | "provider": "jimeng", |
| | | "type": ["t2i", "i2i"], |
| | | "concurrency": 1, |
| | | "concurrency": 2, |
| | | "price_per_image": 0.22 |
| | | }, |
| | | "wan2.6-t2i": { |
| | | "name": "Wan 2.6 T2I", |
| | | "provider": "dashscope", |
| | | "type": ["t2i"], |
| | | "type": ["t2i", "i2i"], |
| | | "concurrency": 5, |
| | | "price_per_image": 0.2 |
| | | }, |
| | | "wan2.6-image": { |
| | | "name": "Wan 2.6 Image", |
| | | "provider": "dashscope", |
| | | "type": ["i2i"], |
| | | "concurrency": 5, |
| | | "price_per_second": 0.2 |
| | | }, |
| | | "doubao-seedream-5-0-260128": { |
| | | "name": "Seedream 5.0", |
| | |
| | | "concurrency": 3, |
| | | "price_per_image": 1.45 |
| | | }, |
| | | "gpt-image-1.5": { |
| | | "name": "GPT Image 1.5", |
| | | "gpt-image-2": { |
| | | "name": "GPT Image 2", |
| | | "provider": "openai", |
| | | "type": ["t2i"], |
| | | "concurrency": 3, |
| | | "price_per_image": 1.09 |
| | | }, |
| | | "gpt-image-2": { |
| | | "name": "GPT Image 2.0", |
| | | "provider": "openai", |
| | | "type": ["t2i"], |
| | | "concurrency": 5, |
| | | "price_per_image": 1.5 |
| | | }, |
| | | "wan2.6-i2v-flash": { |
| | | "name": "Wan 2.6 I2V Flash", |
| | | "provider": "dashscope", |
| | | "type": ["video"], |
| | | "concurrency": 3, |
| | | "price_per_second": 0.6 |
| | | }, |
| | | "wan2.6-i2v": { |
| | | "name": "Wan 2.6 I2V", |
| | | "provider": "dashscope", |
| | | "type": ["video"], |
| | | "concurrency": 3, |
| | | "concurrency": 5, |
| | | "price_per_second": 0.6 |
| | | }, |
| | | "wan2.7-i2v": { |
| | |
| | | "type": ["video"], |
| | | "concurrency": 5, |
| | | "price_per_second": 0.8 |
| | | }, |
| | | "jimeng_ti2v_v30_pro": { |
| | | "name": "JiMeng Ti2V V30 Pro", |
| | | "provider": "jimeng", |
| | | "type": ["video"], |
| | | "concurrency": 3, |
| | | "price_per_second": 0.4 |
| | | }, |
| | | "kling-v3": { |
| | | "name": "Kling V3", |
| | |
| | | "type": ["video"], |
| | | "concurrency": 10, |
| | | "price_per_second": 0.5 |
| | | }, |
| | | "jimeng_ti2v_v30_pro": { |
| | | "name": "JiMeng Ti2V V30 Pro", |
| | | "provider": "jimeng", |
| | | "type": ["video"], |
| | | "concurrency": 3, |
| | | "price_per_second": 0.4 |
| | | } |
| | | } |
| | | } |
| | |
| | | dashscope_base_url=settings.DASHSCOPE_BASE_URL, |
| | | gpt_api_key=os.getenv("OPENAI_API_KEY"), |
| | | gpt_base_url=os.getenv("OPENAI_BASE_URL"), |
| | | gpt_official_api_key=settings.OPENAI_OFFICIAL_API_KEY, |
| | | local_proxy=settings.LOCAL_PROXY, |
| | | ark_api_key=settings.ARK_API_KEY, |
| | | ark_base_url=settings.ARK_BASE_URL, |
| | |
| | | dashscope_base_url=settings.DASHSCOPE_BASE_URL, |
| | | gpt_api_key=os.getenv("OPENAI_API_KEY"), |
| | | gpt_base_url=os.getenv("OPENAI_BASE_URL"), |
| | | gpt_official_api_key=settings.OPENAI_OFFICIAL_API_KEY, |
| | | local_proxy=settings.LOCAL_PROXY, |
| | | ark_api_key=settings.ARK_API_KEY, |
| | | ark_base_url=settings.ARK_BASE_URL, |
| | |
| | | jimeng_secret_key: Optional[str] = None, |
| | | gpt_api_key: Optional[str] = None, |
| | | gpt_base_url: Optional[str] = None, |
| | | gpt_official_api_key: Optional[str] = None, |
| | | local_proxy: Optional[str] = None, |
| | | ark_api_key: Optional[str] = None, |
| | | ark_base_url: Optional[str] = None): |
| | |
| | | self.gpt_client = ImageGPT( |
| | | api_key=gpt_api_key, |
| | | base_url=gpt_base_url, |
| | | official_api_key=gpt_official_api_key or '', |
| | | local_proxy=local_proxy or '' |
| | | local_proxy=local_proxy |
| | | ) |
| | | |
| | | # Initialize Image Processor for downloads |
| | |
| | | """ |
| | | OpenAI 图片生成客户端 |
| | | 支持模型: |
| | | - sora_image → Images API(通过代理/中转服务器) |
| | | - gpt-image-1.5 → Responses API(直连官方,走本地代理) |
| | | - sora_image → Images API |
| | | - gpt-image-2 → Responses API |
| | | """ |
| | | def __init__(self, base_url="", api_key="", timeout=300, |
| | | official_api_key="", local_proxy=""): |
| | | # 普通客户端(可连接代理/中转服务器,用于 sora_image 等) |
| | | if base_url: |
| | | self.client = OpenAI(api_key=api_key, base_url=base_url, timeout=timeout) |
| | | else: |
| | | self.client = OpenAI(api_key=api_key, timeout=timeout) |
| | | def __init__(self, |
| | | api_key: str = None, |
| | | base_url: str = None, |
| | | local_proxy: str = None, |
| | | timeout: float = 300.0): |
| | | """ |
| | | OpenAI 图片生成客户端 |
| | | :param api_key: API Key |
| | | :param base_url: 自定义 Base URL(如果传入,则不使用本地代理) |
| | | :param timeout: 超时时间 |
| | | """ |
| | | self.api_key = api_key or os.getenv("OPENAI_API_KEY") |
| | | self.timeout = timeout |
| | | |
| | | kwargs = {"api_key": self.api_key, "timeout": self.timeout} |
| | | |
| | | self.base_url = base_url |
| | | if not self.base_url and local_proxy: |
| | | kwargs["http_client"] = httpx.Client( |
| | | proxy=local_proxy, |
| | | timeout=self.timeout, |
| | | ) |
| | | if self.base_url: |
| | | kwargs["base_url"] = self.base_url |
| | | |
| | | self.client = OpenAI(**kwargs) |
| | | self.max_attempts = 10 |
| | | self.image_processor = ImageProcessor() |
| | | |
| | | # 官方直连客户端(仅 gpt-image-1.5 等需要直连官方 API 的模型使用) |
| | | self._official_client = None |
| | | self._official_api_key = official_api_key |
| | | self._local_proxy = local_proxy |
| | | self._timeout = timeout |
| | | |
| | | def _get_official_client(self): |
| | | """懒加载官方 OpenAI 客户端,通过本地代理访问""" |
| | | if self._official_client is None: |
| | | if not self._official_api_key: |
| | | raise ValueError("使用 gpt-image-1.5 需要设置 OPENAI_OFFICIAL_API_KEY(官方 OpenAI API Key)") |
| | | kwargs = {"timeout": self._timeout} |
| | | if self._local_proxy: |
| | | kwargs["http_client"] = httpx.Client( |
| | | proxy=self._local_proxy, |
| | | timeout=self._timeout, |
| | | ) |
| | | self._official_client = OpenAI(api_key=self._official_api_key, **kwargs) |
| | | return self._official_client |
| | | |
| | | def generate_image(self, prompt, size="1024x1024", quality="standard", model=None, |
| | | save_dir=None, image_urls=None): |
| | |
| | | prompt: 图片描述提示词 |
| | | size: 图片尺寸 |
| | | quality: 图片质量 |
| | | model: 模型名称 (sora_image / gpt-image-1.5) |
| | | model: 模型名称 (sora_image / gpt-image-2) |
| | | save_dir: 保存目录(不传则返回 URL 或 base64) |
| | | image_urls: 参考图片 URL 列表(仅 gpt-image-1.5 支持) |
| | | image_urls: 参考图片 URL 列表(仅 gpt-image-2 支持) |
| | | """ |
| | | if model is None: |
| | | model = "sora_image" |
| | | |
| | | print(f"Generating image with model '{model}'... Prompt: {prompt[:50]}...") |
| | | |
| | | # gpt-image-1.5 走官方 Responses API |
| | | if model == "gpt-image-1.5": |
| | | # gpt-image-2 走官方 Responses API |
| | | if model == "gpt-image-2": |
| | | return self._generate_image_official(prompt, size=size, quality=quality, |
| | | save_dir=save_dir, image_urls=image_urls) |
| | | |
| | |
| | | |
| | | def _generate_image_official(self, prompt, size="1024x1024", quality="standard", |
| | | save_dir=None, image_urls=None): |
| | | """通过官方 Responses API 生成图片 (gpt-image-1.5),走本地代理""" |
| | | client = self._get_official_client() |
| | | """通过 Responses API 生成图片 (gpt-image-2)""" |
| | | client = self.client |
| | | |
| | | # 构建 input content |
| | | content = [{"type": "input_text", "text": prompt}] |
| | |
| | | while attempts < self.max_attempts: |
| | | try: |
| | | response = client.responses.create( |
| | | model="gpt-image-1.5", |
| | | model="gpt-image-2", |
| | | input=[{"role": "user", "content": content}], |
| | | tools=[{"type": "image_generation", "size": size, "quality": quality}], |
| | | ) |
| | |
| | | text_output = " ".join( |
| | | getattr(o, "text", "") for o in response.output if hasattr(o, "text") |
| | | ).strip() |
| | | print(f"gpt-image-1.5: 未返回图片。模型回复: {text_output[:200]}") |
| | | print(f"gpt-image-2: 未返回图片。模型回复: {text_output[:200]}") |
| | | except Exception as e: |
| | | last_error = e |
| | | print(f"gpt-image-1.5 Error: {e}. Retrying in 10s.") |
| | | print(f"gpt-image-2 Error: {e}. Retrying in 10s.") |
| | | time.sleep(10) |
| | | attempts += 1 |
| | | |
| | | raise Exception(f"gpt-image-1.5: 达到最大重试次数。Last error: {last_error}") |
| | | raise Exception(f"gpt-image-2: 达到最大重试次数。Last error: {last_error}") |
| | | |
| | | def _generate_image_legacy(self, prompt, size="1024x1024", quality="standard", |
| | | model="sora_image", save_dir=None): |
| | |
| | | print("=== GPT 图片生成可用性测试 ===") |
| | | api_key = Config.OPENAI_API_KEY |
| | | base_url = Config.OPENAI_BASE_URL |
| | | official_key = Config.OPENAI_OFFICIAL_API_KEY |
| | | local_proxy = Config.LOCAL_PROXY |
| | | |
| | | if not api_key and not official_key: |
| | | print("✗ OPENAI_API_KEY 和 OPENAI_OFFICIAL_API_KEY 均未设置,跳过") |
| | | if not api_key: |
| | | print("✗ OPENAI_API_KEY 未设置,跳过") |
| | | sys.exit(1) |
| | | |
| | | print(f" API Key: {api_key[:6]}***{api_key[-4:] if api_key else '(未设置)'}") |
| | | print(f" API Key: {api_key[:6]}***") |
| | | print(f" Base URL: {base_url}") |
| | | print(f" Official Key: {official_key[:6]}***{official_key[-4:] if official_key else '(未设置)'}") |
| | | print(f" Local Proxy: {local_proxy or '(未设置)'}") |
| | | |
| | | client = ImageGPT(api_key=api_key, base_url=base_url, |
| | | official_api_key=official_key, local_proxy=local_proxy) |
| | | client = ImageGPT(api_key=api_key, base_url=Config.OPENAI_BASE_URL, local_proxy=Config.LOCAL_PROXY) |
| | | |
| | | # 1. sora_image 图片生成(仅尝试 1 次) |
| | | if api_key: |
| | | img_prompt = "一只橘猫躺在阳光下的窗台上" |
| | | print(f"\n[1/2] Prompt: {img_prompt}") |
| | | client.max_attempts = 1 |
| | | t0 = time.time() |
| | | save_dir = "result/image/test_avail" |
| | | os.makedirs(save_dir, exist_ok=True) |
| | | try: |
| | | path = client.generate_image(prompt=img_prompt, size="1024x1024", model="gpt-image-2", save_dir=save_dir) |
| | | elapsed = time.time() - t0 |
| | | print(f"✓ 生成成功 ({elapsed:.1f}s): {path}") |
| | | except Exception as e: |
| | | elapsed = time.time() - t0 |
| | | print(f"✗ 图片生成失败 ({elapsed:.1f}s): {e}\n") |
| | | else: |
| | | print("\n[1/2] 跳过(OPENAI_API_KEY 未设置)") |
| | | img_prompt = "一只橘猫躺在阳光下的窗台上" |
| | | print(f"\n[1/2] Prompt: {img_prompt}") |
| | | client.max_attempts = 1 |
| | | t0 = time.time() |
| | | save_dir = "result/image/test_avail" |
| | | os.makedirs(save_dir, exist_ok=True) |
| | | try: |
| | | path = client.generate_image(prompt=img_prompt, size="1024x1024", model="sora_image", save_dir=save_dir) |
| | | elapsed = time.time() - t0 |
| | | print(f"✓ 生成成功 ({elapsed:.1f}s): {path}") |
| | | except Exception as e: |
| | | elapsed = time.time() - t0 |
| | | print(f"✗ 图片生成失败 ({elapsed:.1f}s): {e}\n") |
| | | |
| | | # 2. gpt-image-1.5 图片生成(官方 API + 本地代理) |
| | | if official_key: |
| | | img_prompt = "A cute orange cat lying on a sunny windowsill, watercolor style" |
| | | print(f"\n[2/2 gpt-image-1.5] Prompt: {img_prompt}") |
| | | client.max_attempts = 1 |
| | | t0 = time.time() |
| | | save_dir = "result/image/test_avail" |
| | | os.makedirs(save_dir, exist_ok=True) |
| | | try: |
| | | path = client.generate_image(prompt=img_prompt, size="1024x1024", |
| | | model="gpt-image-1.5", save_dir=save_dir) |
| | | elapsed = time.time() - t0 |
| | | print(f"✓ 生成成功 ({elapsed:.1f}s): {path}") |
| | | except Exception as e: |
| | | elapsed = time.time() - t0 |
| | | print(f"✗ gpt-image-1.5 失败 ({elapsed:.1f}s): {e}") |
| | | else: |
| | | print("\n[2/2 gpt-image-1.5] 跳过(OPENAI_OFFICIAL_API_KEY 未设置)") |
| | | # 2. gpt-image-2 图片生成 |
| | | img_prompt = "A cute orange cat lying on a sunny windowsill, watercolor style" |
| | | print(f"\n[2/2] Prompt: {img_prompt}") |
| | | client.max_attempts = 1 |
| | | t0 = time.time() |
| | | save_dir = "result/image/test_avail" |
| | | os.makedirs(save_dir, exist_ok=True) |
| | | try: |
| | | path = client.generate_image(prompt=img_prompt, size="1024x1024", |
| | | model="gpt-image-2", save_dir=save_dir) |
| | | elapsed = time.time() - t0 |
| | | print(f"✓ 生成成功 ({elapsed:.1f}s): {path}") |
| | | except Exception as e: |
| | | elapsed = time.time() - t0 |
| | | print(f"✗ gpt-image-2 失败 ({elapsed:.1f}s): {e}") |
| | |
| | | from tool.llm_gemini import Gemini |
| | | from tool.llm_deepseek import DeepSeek |
| | | from tool.llm_dashscope import QwenLLM |
| | | from tool.vlm_dashscope import QwenVLClient |
| | | except ImportError: |
| | | from llm_gpt import GPT |
| | | from llm_gemini import Gemini |
| | | from llm_deepseek import DeepSeek |
| | | from llm_dashscope import QwenLLM |
| | | from vlm_dashscope import QwenVLClient |
| | | |
| | | from config import Config |
| | | |
| | |
| | | |
| | | return text.translate(translation_table) |
| | | |
| | | def query(self, prompt, image_urls=[], model="gemini-3-flash-preview", safe_content=True, task_id=None, web_search=False): |
| | | def query(self, prompt, image_urls=[], model="qwen3.6-max-preview", safe_content=True, task_id=None, web_search=False): |
| | | """ |
| | | Query the LLM with a prompt and optional image URLs. |
| | | Selects the backend (GPT or Gemini) based on the model name. |
| | |
| | | prompt = self.full_to_half(prompt) |
| | | |
| | | if not model: |
| | | model = "gemini-3-flash-preview" |
| | | model = "qwen3.6-max-preview" |
| | | |
| | | if Config.PRINT_MODEL_INPUT: |
| | | print("---- LLM QUERY REQUEST ----") |
| | |
| | | result = "" |
| | | model_lower = model.lower() |
| | | if model_lower.startswith("gemini"): |
| | | # Gemini client handles its own credentials internally in the current implementation, |
| | | # but we pass args for consistency/future compatibility. |
| | | # Note: Gemini doesn't have built-in web search parameter, user needs to use Function Calling |
| | | client = Gemini(base_url=self.gemini_base_url, api_key=self.gemini_api_key) |
| | | result = client.query(prompt, image_urls=image_urls, model=model) |
| | | elif model_lower.startswith("deepseek"): |
| | | client = DeepSeek(base_url=self.deepseek_base_url, api_key=self.deepseek_api_key) |
| | | elif "gpt" in model_lower: |
| | | # OpenAI series models |
| | | client = GPT( |
| | | base_url=self.gpt_base_url, |
| | | api_key=self.gpt_api_key, |
| | | local_proxy=Config.LOCAL_PROXY |
| | | ) |
| | | result = client.query(prompt, image_urls=image_urls, model=model, web_search=web_search) |
| | | elif "qwen" in model_lower: |
| | | # Qwen models via DashScope Generation API (text-only mode) |
| | | elif "kimi" in model_lower or "qwen3.6-plus" in model_lower or "qwen3.6-flash" in model_lower: |
| | | # DashScope VLM models (using MultiModalConversation API) |
| | | dashscope_vl_client = QwenVLClient(api_key=self.dashscope_api_key) |
| | | result = dashscope_vl_client.chat(text=prompt, images=[], model=model, stream=False) |
| | | elif "deepseek-v3.2" in model_lower: |
| | | # DeepSeek v3.2 (通过 DashScope Generation API) |
| | | client = QwenLLM(api_key=self.dashscope_api_key) |
| | | result = client.query(prompt, image_urls=image_urls, model=model, web_search=web_search) |
| | | elif model_lower.startswith("deepseek") and "v3.2" not in model_lower: |
| | | # Original DeepSeek provider |
| | | client = DeepSeek(base_url=self.deepseek_base_url, api_key=self.deepseek_api_key) |
| | | result = client.query(prompt, image_urls=image_urls, model=model, web_search=web_search) |
| | | else: |
| | | # OpenAI 系列: gpt-4, gpt-4o, gpt-5, gpt-5.1, o3 等 |
| | | client = GPT(base_url=self.gpt_base_url, api_key=self.gpt_api_key) |
| | | # Default to Qwen models / deepseek-v3.2 via DashScope Generation API |
| | | client = QwenLLM(api_key=self.dashscope_api_key) |
| | | result = client.query(prompt, image_urls=image_urls, model=model, web_search=web_search) |
| | | |
| | | if safe_content: |
| | |
| | | :param base_url: DashScope API Base URL (可选) |
| | | """ |
| | | self.api_key = api_key or os.getenv("DASHSCOPE_API_KEY") |
| | | self.base_url = base_url or os.getenv("DASHSCOPE_BASE_URL", "https://dashscope.aliyuncs.com/api/v1") |
| | | self.base_url = base_url or os.getenv("DASHSCOPE_BASE_URL") |
| | | |
| | | if not self.api_key: |
| | | print("Warning: DASHSCOPE_API_KEY is not set.") |
| | | |
| | | if dashscope: |
| | | dashscope.api_key = self.api_key |
| | | if self.base_url: |
| | | dashscope.base_http_api_url = self.base_url |
| | | |
| | | self.max_attempts = 3 |
| | | self.max_tokens = 8000 |
| | |
| | | raise RuntimeError("dashscope package not installed. Run: pip install dashscope") |
| | | |
| | | if not model: |
| | | model = "qwen3.5-vl" |
| | | |
| | | # Map common model names to DashScope API names |
| | | model_mapping = { |
| | | "qwen3.5-plus": "qwen-plus", |
| | | "qwen3.5-max": "qwen-max", |
| | | "qwen2.5-plus": "qwen-plus", |
| | | "qwen2.5-max": "qwen-max", |
| | | } |
| | | api_model = model_mapping.get(model.lower(), model) |
| | | model = "qwen3.5-plus" |
| | | |
| | | messages = [{"role": "system", "content": "You are a helpful assistant."}] |
| | | messages.append({"role": "user", "content": prompt}) |
| | |
| | | try: |
| | | # Build request parameters |
| | | request_params = { |
| | | "model": api_model, |
| | | "model": model, |
| | | "messages": messages, |
| | | "result_format": "message", |
| | | "stream": False, |
| | |
| | | if web_search: |
| | | request_params["enable_search"] = True |
| | | |
| | | response = Generation.call(**request_params) |
| | | response = Generation.call(api_key=self.api_key, **request_params) |
| | | |
| | | if response.status_code == 200: |
| | | if response.output.choices and response.output.choices[0].message.content: |
| | | return response.output.choices[0].message.content |
| | | choice = response.output.choices[0] |
| | | if choice.message.content: |
| | | return choice.message.content |
| | | elif hasattr(choice.message, 'reasoning_content') and choice.message.reasoning_content: |
| | | return choice.message.reasoning_content |
| | | else: |
| | | print("Received an empty response from Qwen. Retrying.") |
| | | time.sleep(2) |
| | |
| | | from config import Config |
| | | |
| | | # 支持的模型列表 |
| | | MODELS = ["qwen3.5-plus", "qwen3.5-max"] |
| | | |
| | | print("=== Qwen LLM (DashScope) 可用性测试 ===") |
| | | MODELS = ["qwen3.6-max-preview", "qwen3-max", "deepseek-v3.2"] |
| | | |
| | | print("=== DashScope LLM 可用性测试 ===") |
| | | api_key = os.getenv("DASHSCOPE_API_KEY", "") |
| | | if not api_key: |
| | | print("✗ DASHSCOPE_API_KEY 未设置,跳过") |
| | |
| | | class GPT: |
| | | """ |
| | | OpenAI 文本生成客户端 |
| | | 可选模型:gpt-4o 等 |
| | | 可选模型:gpt-4o, |
| | | """ |
| | | def __init__(self, base_url="", api_key="", timeout=300): |
| | | if base_url: |
| | | self.client = OpenAI(api_key=api_key, base_url=base_url, timeout=timeout) |
| | | else: |
| | | self.client = OpenAI(api_key=api_key, timeout=timeout) |
| | | def __init__(self, base_url="", api_key="", local_proxy=None, timeout=300): |
| | | import httpx |
| | | self.api_key = api_key or os.getenv("OPENAI_API_KEY") |
| | | self.timeout = timeout |
| | | |
| | | kwargs = {"api_key": self.api_key, "timeout": self.timeout} |
| | | |
| | | # 代理逻辑: |
| | | # 1. 如果传入了 base_url,则不使用本地代理 |
| | | # 2. 如果没传入 base_url,则使用默认值并尝试开启本地代理 |
| | | self.base_url = base_url |
| | | if not self.base_url and local_proxy: |
| | | kwargs["http_client"] = httpx.Client( |
| | | proxy=local_proxy, |
| | | timeout=self.timeout, |
| | | ) |
| | | if self.base_url: |
| | | kwargs["base_url"] = self.base_url |
| | | |
| | | self.client = OpenAI(**kwargs) |
| | | self.max_attempts = 10 |
| | | self.max_tokens = 8000 |
| | | |
| | |
| | | from config import Config |
| | | |
| | | # 支持的模型列表 |
| | | MODELS = ["gpt-4o", "gpt-4o-mini", "gpt-4.1", "gpt-4.1-mini", "gpt-5"] |
| | | MODELS = ["gpt-4o", "gpt-5", "gpt-5.4"] |
| | | |
| | | print("=== GPT 文本生成可用性测试 ===") |
| | | api_key = Config.OPENAI_API_KEY |
| | |
| | | try: |
| | | from tool.vlm_dashscope import QwenVLClient |
| | | from tool.vlm_gemini import GeminiVLClient |
| | | from tool.vlm_gpt import GPTVLClient |
| | | except ImportError: |
| | | from vlm_dashscope import QwenVLClient |
| | | from vlm_gemini import GeminiVLClient |
| | | from vlm_gpt import GPTVLClient |
| | | |
| | | class VLM: |
| | | def __init__(self, |
| | |
| | | dashscope_base_url: Optional[str] = None, |
| | | gemini_api_key: Optional[str] = None, |
| | | gemini_base_url: Optional[str] = None, |
| | | gpt_api_key: Optional[str] = None, |
| | | gpt_base_url: Optional[str] = None, |
| | | local_proxy: Optional[str] = None): |
| | | """ |
| | | Unified VLM (Vision Language Model) Client |
| | |
| | | api_key=gemini_api_key, |
| | | base_url=gemini_base_url |
| | | ) |
| | | # Initialize GPT Client |
| | | self.gpt_client = GPTVLClient( |
| | | api_key=gpt_api_key, |
| | | base_url=gpt_base_url, |
| | | local_proxy=local_proxy |
| | | ) |
| | | |
| | | def query(self, |
| | | prompt: str, |
| | | image_paths: Optional[List[str]] = None, |
| | | model: str = "qwen3.5-plus", |
| | | model: str = "qwen3.6-plus", |
| | | session_id: Optional[str] = None) -> str: |
| | | if Config.PRINT_MODEL_INPUT: |
| | | print("---- VLM REQUEST ----") |
| | |
| | | # Determine backend provider |
| | | model_lower = model.lower() |
| | | is_gemini = "gemini" in model_lower |
| | | is_gpt = "gpt" in model_lower |
| | | |
| | | if is_gemini: |
| | | # 处理图片路径 |
| | |
| | | else: |
| | | processed_images.append(p) # 传递原始路径,内部会处理 |
| | | return self.gemini_client.chat(text=prompt, images=processed_images, model=model) |
| | | elif is_gpt: |
| | | return self.gpt_client.chat(text=prompt, images=image_paths or [], model=model) |
| | | else: |
| | | # Qwen (DashScope) - 需要将 base64 保存为临时文件 |
| | | # DashScope (Qwen/Kimi) - 需要将 base64 保存为临时文件 |
| | | file_urls = [] |
| | | import tempfile |
| | | import base64 as b64 |
| | |
| | | from config import Config |
| | | |
| | | # 支持的 VLM 模型列表 |
| | | MODELS = ["qwen3.5-plus", "qwen-vl-plus", "qwen3.5-max"] |
| | | MODELS = ["qwen3.6-plus", "qwen3.6-flash", "kimi-k2.6"] |
| | | |
| | | print("=== Qwen VL (DashScope) 多模态可用性测试 ===") |
| | | api_key = getattr(Config, "DASHSCOPE_API_KEY", None) or os.getenv("DASHSCOPE_API_KEY", "") |
| | |
| | | img_path = '' |
| | | abs_img_path = os.path.abspath(img_path) |
| | | if not os.path.exists(img_path): |
| | | img_path = "backend/code/result/image/test_avail/test_input.png" |
| | | img_path = "code/result/image/test_avail/test_input.png" |
| | | abs_img_path = os.path.abspath(img_path) |
| | | if not os.path.exists(img_path): |
| | | print("✗ 测试图片不存在,跳过") |
| New file |
| | |
| | | # -*- coding: utf-8 -*- |
| | | """ |
| | | OpenAI GPT 多模态大模型 API 客户端 |
| | | 支持 gpt-4o, gpt-5.4 (未来版本) 等视觉模型 |
| | | |
| | | 逻辑: |
| | | - 如果未传入 base_url,使用官方 URL 并启用本地代理 |
| | | - 如果传入 base_url,则直接使用,不启用代理 |
| | | """ |
| | | |
| | | import os |
| | | import time |
| | | import base64 |
| | | import httpx |
| | | from openai import OpenAI |
| | | from typing import Dict, List, Optional |
| | | |
| | | class GPTVLClient: |
| | | """ |
| | | GPT VLM 客户端,支持多模态对话 |
| | | """ |
| | | def __init__(self, |
| | | api_key: Optional[str] = None, |
| | | base_url: Optional[str] = None, |
| | | local_proxy: Optional[str] = None, |
| | | timeout: float = 60.0): |
| | | """ |
| | | GPT 多模态客户端 |
| | | :param api_key: OpenAI API Key |
| | | :param base_url: 自定义 Base URL(如果传入,则不使用本地代理) |
| | | :param timeout: 超时时间 |
| | | """ |
| | | # 优先使用传入的 api_key,否则从环境变量读取 |
| | | self.api_key = api_key or os.getenv("OPENAI_API_KEY") |
| | | self.timeout = timeout |
| | | |
| | | kwargs = {"api_key": self.api_key, "timeout": self.timeout} |
| | | |
| | | # 代理逻辑: |
| | | # 1. 如果传入了 base_url,则不使用本地代理 |
| | | # 2. 如果没传入 base_url,则使用默认值并尝试开启本地代理 |
| | | self.base_url = base_url |
| | | local_proxy = local_proxy |
| | | if not self.base_url and local_proxy: |
| | | kwargs["http_client"] = httpx.Client( |
| | | proxy=local_proxy, |
| | | timeout=self.timeout, |
| | | ) |
| | | if self.base_url: |
| | | kwargs["base_url"] = self.base_url |
| | | self.client = OpenAI(**kwargs) |
| | | self.max_attempts = 5 |
| | | self.max_tokens = 4096 |
| | | |
| | | def _encode_image(self, image_path: str) -> str: |
| | | """将本地图片编码为 base64""" |
| | | abs_path = os.path.abspath(image_path) |
| | | with open(abs_path, "rb") as f: |
| | | return base64.b64encode(f.read()).decode("utf-8") |
| | | |
| | | def _get_mime_type(self, image_path: str) -> str: |
| | | """根据文件扩展名获取 MIME 类型""" |
| | | ext = os.path.splitext(image_path)[1].lower() |
| | | mime_types = { |
| | | ".jpg": "image/jpeg", |
| | | ".jpeg": "image/jpeg", |
| | | ".png": "image/png", |
| | | ".webp": "image/webp", |
| | | ".gif": "image/gif" |
| | | } |
| | | return mime_types.get(ext, "image/jpeg") |
| | | |
| | | def chat(self, text: str, images: List[str], model: str = "gpt-5.4", |
| | | parameters: Optional[Dict] = None) -> str: |
| | | """ |
| | | 使用 GPT 进行多模态对话(文本+图片) |
| | | :param text: 文本内容 |
| | | :param images: 图片路径列表(支持本地路径或URL) |
| | | :param model: 模型名(如 gpt-4o, gpt-5.4) |
| | | :param parameters: 其他API参数 |
| | | :return: API响应内容 |
| | | """ |
| | | if not self.api_key: |
| | | raise ValueError("OPENAI_API_KEY 未设置") |
| | | |
| | | # 构建消息格式 |
| | | content: list = [{"type": "text", "text": text}] |
| | | |
| | | # 处理图片 |
| | | if images: |
| | | for img_path in images: |
| | | if img_path.startswith("data:"): |
| | | # Base64 数据 URL |
| | | content.append({ |
| | | "type": "image_url", |
| | | "image_url": {"url": img_path} |
| | | }) |
| | | elif img_path.startswith("http"): |
| | | # URL 图片 |
| | | content.append({ |
| | | "type": "image_url", |
| | | "image_url": {"url": img_path} |
| | | }) |
| | | else: |
| | | # 本地图片 - 转为 base64 |
| | | mime_type = self._get_mime_type(img_path) |
| | | base64_data = self._encode_image(img_path) |
| | | data_url = f"data:{mime_type};base64,{base64_data}" |
| | | content.append({ |
| | | "type": "image_url", |
| | | "image_url": {"url": data_url} |
| | | }) |
| | | |
| | | messages = [{"role": "user", "content": content}] |
| | | |
| | | attempts = 0 |
| | | while attempts < self.max_attempts: |
| | | try: |
| | | response = self.client.chat.completions.create( |
| | | model=model, |
| | | messages=messages, |
| | | max_tokens=self.max_tokens, |
| | | temperature=parameters.get("temperature", 0.7) if parameters else 0.7 |
| | | ) |
| | | |
| | | if response.choices and len(response.choices) > 0: |
| | | return response.choices[0].message.content |
| | | |
| | | except Exception as e: |
| | | print(f"GPTVL 请求错误: {e}") |
| | | attempts += 1 |
| | | if attempts < self.max_attempts: |
| | | time.sleep(2 * attempts) # 指数退避 |
| | | |
| | | raise Exception("GPTVL: 达到最大重试次数,仍未获得有效响应。") |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | import sys |
| | | sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | from config import Config |
| | | |
| | | print("=== GPT VL 多模态可用性测试 ===") |
| | | if not Config.OPENAI_API_KEY: |
| | | print("✗ 未设置 OPENAI_API_KEY,跳过") |
| | | sys.exit(1) |
| | | client = GPTVLClient(api_key=Config.OPENAI_API_KEY, base_url=Config.OPENAI_BASE_URL, local_proxy=Config.LOCAL_PROXY) |
| | | |
| | | # 支持的 VLM 模型列表,包含用户要求的 gpt-5.4 |
| | | MODELS = ["gpt-5.4"] |
| | | |
| | | img_path = "code/result/image/test_avail/test_input.png" |
| | | if not os.path.exists(img_path): |
| | | print(f"✗ 测试图片不存在: {img_path}") |
| | | else: |
| | | text = "请描述这张图片的内容" |
| | | for model in MODELS: |
| | | print(f"\n--- 测试模型: {model} ---") |
| | | print(f"输入文本: {text}") |
| | | print(f"输入图片: {img_path}") |
| | | t0 = time.time() |
| | | try: |
| | | result = client.chat(text=text, images=[img_path], model=model) |
| | | elapsed = time.time() - t0 |
| | | if result: |
| | | print(f"✓ 返回结果 ({elapsed:.1f}s): {result[:200]}") |
| | | else: |
| | | print(f"✗ 返回空结果 ({elapsed:.1f}s)") |
| | | except Exception as e: |
| | | print(f"✗ 失败: {e}") |
| | |
| | | provider: 'qwen', |
| | | label: 'Qwen (DashScope)', |
| | | models: [ |
| | | { id: 'qwen3.5-plus', label: 'qwen3.5-plus', default: true }, |
| | | { id: 'qwen3.5-max', label: 'qwen3.5-max' }, |
| | | { id: 'qwen3.6-max-preview', label: 'qwen3.6-max-preview', default: true }, |
| | | { id: 'qwen3-max', label: 'qwen3-max' }, |
| | | { id: 'deepseek-v3.2', label: 'deepseek-v3.2 (DashScope)' }, |
| | | ], |
| | | }, |
| | | { |
| | |
| | | label: 'OpenAI', |
| | | models: [ |
| | | { id: 'gpt-4o', label: 'gpt-4o' }, |
| | | { id: 'gpt-4', label: 'gpt-4' }, |
| | | { id: 'gpt-5', label: 'gpt-5' }, |
| | | { id: 'gpt-5.1', label: 'gpt-5.1' }, |
| | | { id: 'o3', label: 'o3' }, |
| | | { id: 'gpt-5.4', label: 'gpt-5.4' }, |
| | | ], |
| | | }, |
| | | { |
| | | provider: 'gemini', |
| | | label: 'Gemini', |
| | | models: [ |
| | | { id: 'gemini-3-flash-preview', label: 'gemini-3-flash-preview' }, |
| | | { id: 'gemini-3-pro-preview', label: 'gemini-3-pro-preview' }, |
| | | { id: 'gemini-2.5-flash', label: 'gemini-2.5-flash' }, |
| | | { id: 'gemini-2.0-flash', label: 'gemini-2.0-flash' }, |
| | | ], |
| | | }, |
| | | ]; |
| | |
| | | /* ─── 文生图 ─── */ |
| | | export const T2I_PROVIDERS: ProviderGroup[] = [ |
| | | { |
| | | provider: 'seedream', |
| | | label: 'Seedream', |
| | | provider: 'dashscope', |
| | | label: 'DashScope', |
| | | models: [ |
| | | { id: 'doubao-seedream-5-0-260128', label: 'Seedream 5.0', default: true }, |
| | | { id: 'doubao-seedream-4-5-251128', label: 'Seedream 4.5' }, |
| | | { id: 'doubao-seedream-4-0-250828', label: 'Seedream 4.0' }, |
| | | { id: 'wan2.6-t2i', label: 'wan2.6-t2i', default: true }, |
| | | ], |
| | | }, |
| | | { |
| | |
| | | ], |
| | | }, |
| | | { |
| | | provider: 'dashscope', |
| | | label: 'DashScope', |
| | | provider: 'seedream', |
| | | label: 'Seedream', |
| | | models: [ |
| | | { id: 'wan2.6-t2i', label: 'wan2.6-t2i' }, |
| | | { id: 'doubao-seedream-5-0-260128', label: 'Seedream 5.0' }, |
| | | { id: 'doubao-seedream-4-5-251128', label: 'Seedream 4.5' }, |
| | | { id: 'doubao-seedream-4-0-250828', label: 'Seedream 4.0' }, |
| | | ], |
| | | }, |
| | | { |
| | |
| | | label: 'OpenAI', |
| | | models: [ |
| | | { id: 'sora_image', label: 'sora_image' }, |
| | | { id: 'gpt-image-1.5', label: 'gpt-image-1.5' }, |
| | | { id: 'gpt-image-2', label: 'gpt-image-2.0' }, |
| | | { id: 'gpt-image-2', label: 'gpt-image-2' }, |
| | | ], |
| | | }, |
| | | ]; |
| | |
| | | /* ─── 图生图 ─── */ |
| | | export const I2I_PROVIDERS: ProviderGroup[] = [ |
| | | { |
| | | provider: 'seedream', |
| | | label: 'Seedream', |
| | | provider: 'dashscope', |
| | | label: 'DashScope', |
| | | models: [ |
| | | { id: 'doubao-seedream-5-0-260128', label: 'Seedream 5.0', default: true }, |
| | | { id: 'doubao-seedream-4-5-251128', label: 'Seedream 4.5' }, |
| | | { id: 'doubao-seedream-4-0-250828', label: 'Seedream 4.0' }, |
| | | { id: 'wan2.6-t2i', label: 'wan2.6-t2i', default: true }, |
| | | ], |
| | | }, |
| | | { |
| | |
| | | ], |
| | | }, |
| | | { |
| | | provider: 'dashscope', |
| | | label: 'DashScope', |
| | | provider: 'seedream', |
| | | label: 'Seedream', |
| | | models: [ |
| | | { id: 'wan2.6-image', label: 'wan2.6-image' }, |
| | | { id: 'doubao-seedream-5-0-260128', label: 'Seedream 5.0' }, |
| | | { id: 'doubao-seedream-4-5-251128', label: 'Seedream 4.5' }, |
| | | { id: 'doubao-seedream-4-0-250828', label: 'Seedream 4.0' }, |
| | | ], |
| | | }, |
| | | { |
| | | provider: 'openai', |
| | | label: 'OpenAI', |
| | | models: [ |
| | | { id: 'gpt-image-2', label: 'gpt-image-2' }, |
| | | ], |
| | | }, |
| | | ]; |
| | |
| | | export const VLM_PROVIDERS: ProviderGroup[] = [ |
| | | { |
| | | provider: 'qwen', |
| | | label: 'Qwen (DashScope)', |
| | | label: 'Qwen/Kimi (DashScope)', |
| | | models: [ |
| | | { id: 'qwen-vl-plus', label: 'qwen-vl-plus', default: true }, |
| | | { id: 'qwen3.5-plus', label: 'qwen3.5-plus' }, |
| | | { id: 'qwen3.5-max', label: 'qwen3.5-max' }, |
| | | { id: 'qwen3.6-plus', label: 'qwen3.6-plus', default: true }, |
| | | { id: 'qwen3.6-flash', label: 'qwen3.6-flash' }, |
| | | { id: 'kimi-k2.6', label: 'kimi-k2.6' }, |
| | | ], |
| | | }, |
| | | { |
| | | provider: 'openai', |
| | | label: 'OpenAI', |
| | | models: [ |
| | | { id: 'gpt-5.4', label: 'gpt-5.4' }, |
| | | ], |
| | | }, |
| | | { |
| | |
| | | label: 'Gemini (Google)', |
| | | models: [ |
| | | { id: 'gemini-2.5-flash-image', label: 'gemini-2.5-flash-image' }, |
| | | { id: 'gemini-2.5-pro-image', label: 'gemini-2.5-pro-image' }, |
| | | { id: 'gemini-3-pro-preview', label: 'gemini-3-pro-preview' }, |
| | | { id: 'gemini-3-pro-image-preview', label: 'gemini-3-pro-image-preview' }, |
| | | { id: 'gemini-2.0-flash', label: 'gemini-2.0-flash' }, |
| | | ], |
| | | }, |
| | | ]; |