| """Add publisher_url to all models/*.json files.""" | |
| import json | |
| from pathlib import Path | |
| MODELS_DIR = Path(__file__).resolve().parent.parent / "src" / "models" | |
| # Publisher URL mapping by model ID | |
| # Format: model_id -> publisher_url (the company that CREATED the model) | |
| PUBLISHER_MAP = { | |
| # === Lightning (InferencePort) === | |
| "lightning": "inferenceport.ai", | |
| "lightning-image-turbo": "inferenceport.ai", | |
| "lightning-texture-quality": "inferenceport.ai", | |
| # === Anthropic (Claude) === | |
| "claude-haiku-4.5": "anthropic.com", | |
| # === Mistral === | |
| "codestral-2508": "mistral.ai", | |
| "codestral-latest": "mistral.ai", | |
| "mistral-large-3": "mistral.ai", | |
| "mistral-small-3.2": "mistral.ai", | |
| "mistral-small-4": "mistral.ai", | |
| # === Cohere === | |
| "command-a": "cohere.com", | |
| "command-r-plus": "cohere.com", | |
| # === DeepSeek === | |
| "deepseek-v3.2": "deepseek.com", | |
| "deepseek-v4-flash": "deepseek.com", | |
| "deepseek-v4-flash-lightning": "deepseek.com", | |
| "deepseek-v4-pro": "deepseek.com", | |
| "deepseek-v4-flash-vision-exp": "deepseek.com", | |
| # === Google / DeepMind === | |
| "gemini-2.5-flash": "deepmind.google", | |
| "gemini-2.5-flash-lite": "deepmind.google", | |
| "gemini-2.5-flash-thinking": "deepmind.google", | |
| "gemini-3.5-flash": "deepmind.google", | |
| "gemini-3.5-flash-lite": "deepmind.google", | |
| "gemini-3.5-flash-thinking": "deepmind.google", | |
| "gemini-3.7-flash": "deepmind.google", | |
| "gemini-3.7-flash-thinking": "deepmind.google", | |
| "gemini-3.8-flash": "deepmind.google", | |
| "gemma-4-26b-a4b-it": "google.com", | |
| "gemma3-270m": "google.com", | |
| "imagen-4.0-fast": "deepmind.google", | |
| "imagen-4.0-preview": "deepmind.google", | |
| "gemini-3-pro-image": "deepmind.google", | |
| # === Z.ai (GLM) === | |
| "glm-5.2": "z.ai", | |
| "glm-5.3": "z.ai", | |
| "glm-5.3-flash": "z.ai", | |
| # === OpenAI === | |
| "gpt-5.6-luna": "openai.com", | |
| "gpt-5.6-terra": "openai.com", | |
| "gpt-5.6-sol": "openai.com", | |
| "gpt-oss-120b": "openai.com", | |
| "gpt-oss-20b": "openai.com", | |
| "gptimage": "openai.com", | |
| "gptimage-1.5": "openai.com", | |
| "gpt-image-2": "openai.com", | |
| "gpt-image-2.5-sunburst": "openai.com", | |
| "gpt-image-2.5-flare": "openai.com", | |
| # === xAI (Grok) === | |
| "grok-4-fast-reasoning": "x.ai", | |
| "grok-4-fast-non-reasoning": "x.ai", | |
| "grok-4.1-fast-non-reasoning": "x.ai", | |
| "grok-4.1-fast-reasoning": "x.ai", | |
| "grok-4.20-non-reasoning": "x.ai", | |
| "grok-4.20-reasoning": "x.ai", | |
| "grok-4.3": "x.ai", | |
| "grok-4.5": "x.ai", | |
| "grok-4.6": "x.ai", | |
| "grok-4.7": "x.ai", | |
| # === Moonshot AI (Kimi) === | |
| "kimi-k2.6": "moonshot.ai", | |
| "kimi-k2.7-code": "moonshot.ai", | |
| "kimi-k3": "moonshot.ai", | |
| # === Meta === | |
| "meta-llama/llama-prompt-guard-2-22m": "meta.com", | |
| "meta-llama/llama-prompt-guard-2-86m": "meta.com", | |
| "muse-glimmer-30b": "meta.com", | |
| "muse-spark-1.2": "meta.com", | |
| # === Xiaomi (Mimo) === | |
| "mimo-v2.5": "xiaomi.com", | |
| "mimo-v2.5-lightning": "xiaomi.com", | |
| "mimo-v2.5-pro": "xiaomi.com", | |
| # === MiniMax === | |
| "minimax-m3": "minimax.io", | |
| # === NVIDIA === | |
| "nemotron-3-super": "nvidia.com", | |
| "nemotron-3-ultra": "nvidia.com", | |
| "nemotron-3-ultra-lightning": "nvidia.com", | |
| "asset-harvester": "nvidia.com", | |
| # === Alibaba (Qwen) === | |
| "qwen3-32b": "qwen.ai", | |
| "qwen3.6-27b": "qwen.ai", | |
| "qwen3.8-2.4t-a95b": "qwen.ai", | |
| "qwen3.8-27b": "qwen.ai", | |
| "qwen3.7-flash": "qwen.ai", | |
| "qwen3.7-max": "qwen.ai", | |
| "qwen3.7-plus": "qwen.ai", | |
| "qwen3.8-max": "qwen.ai", | |
| "qwen-image-2.0": "qwen.ai", | |
| "qwen-image-2.0-pro": "qwen.ai", | |
| # === Perplexity === | |
| "sonar": "perplexity.ai", | |
| "sonar-pro": "perplexity.ai", | |
| "sonar-reasoning-pro": "perplexity.ai", | |
| # === Poolside === | |
| "laguna-s-2.1": "poolside.ai", | |
| # === Inception (Mercury) === | |
| "mercury-2": "inceptionlabs.ai", | |
| "mercury-2.5-preview": "inceptionlabs.ai", | |
| # === Meituan (LongCat) === | |
| "longcat-2.0": "longcat.ai", | |
| # === Amazon (Nova) === | |
| "nova-2-lite-v1": "aws.amazon.com", | |
| "nova-micro-v1": "aws.amazon.com", | |
| "nova-canvas": "aws.amazon.com", | |
| "nova-reel": "aws.amazon.com", | |
| # === Black Forest Labs (Flux) === | |
| "flux": "bfl.ai", | |
| "flux-1-kontext-pro": "bfl.ai", | |
| "flux-2-dev": "bfl.ai", | |
| "flux-2-flex": "bfl.ai", | |
| "flux-2-klein": "bfl.ai", | |
| "flux-2-pro": "bfl.ai", | |
| "flux-3": "bfl.ai", | |
| # === Ideogram === | |
| "ideogram-v4-turbo": "ideogram.ai", | |
| "ideogram-v4-balanced": "ideogram.ai", | |
| "ideogram-v4-quality": "ideogram.ai", | |
| # === ByteDance (Seedream/Seedance) === | |
| "seedream-4.0": "bytedance.com", | |
| "seedream-5.0-lite": "bytedance.com", | |
| "seedance-2.5-480p": "bytedance.com", | |
| "seedance-2.5-720p": "bytedance.com", | |
| # === Alibaba (Wan/HappyHorse) === | |
| "wan2.6-image": "wan.video", | |
| "wan-fast": "wan.video", | |
| "wan2.7-t2v": "wan.video", | |
| "happyhorse-1.1": "happyhorse.com", | |
| "happyhorse-1.0-t2v": "happyhorse.com", | |
| # === Kuaishou (Kling) === | |
| "kling-2.1-standard": "kuaishou.com", | |
| "kling-2.1-pro": "kuaishou.com", | |
| "kling-2.1-master": "kuaishou.com", | |
| # === MiniMax (Hailuo) === | |
| "hailuo-02": "minimax.io", | |
| "minimax-h3-512p-lora-finetune": "minimax.io", | |
| "minimax-h3-768p": "minimax.io", | |
| # === Shengshu (Vidu) === | |
| "vidu-q1": "vidu.com", | |
| "vidu-q3": "vidu.com", | |
| "vidu-2.0": "vidu.com", | |
| "vidu-q3-turbo": "vidu.com", | |
| # === PixVerse === | |
| "pixverse-v5": "pixverse.ai", | |
| # === Stability AI === | |
| "stable-audio-3-medium": "stability.ai", | |
| "tripoSR": "stability.ai", | |
| "sf3d": "stability.ai", | |
| "dreamshaper-8-lcm": "stability.ai", | |
| # === ElevenLabs === | |
| "elevenlabs/eleven-text-to-sound-v2": "elevenlabs.io", | |
| # === Taalas === | |
| "llama-3.1-8b-ultrafast-expiremental": "taalas.com", | |
| # === Pruna AI === | |
| "pruna-p-image": "pruna.ai", | |
| "pruna-p-image-edit": "pruna.ai", | |
| # === Cerebras === | |
| "gemma-4-31b": "cerebras.ai", | |
| # === Z-Image === | |
| "zimage": "inferenceport.ai", | |
| # === Microsoft (Trellis) === | |
| "trellis2": "microsoft.com", | |
| } | |
| # For image.json, the "lightning" and "lightning-texture-quality" entries | |
| # and the "zimage" entry need publisher_url at the top-level dict key level too. | |
| def add_publisher_to_text_json(): | |
| path = MODELS_DIR / "text.json" | |
| data = json.loads(path.read_text(encoding="utf-8")) | |
| # Add to lightning entry | |
| if "lightning" in data: | |
| data["lightning"]["publisher_url"] = "inferenceport.ai" | |
| # Add to each override | |
| for entry in data.get("overrides", []): | |
| model_id = entry.get("id", "") | |
| if model_id in PUBLISHER_MAP: | |
| entry["publisher_url"] = PUBLISHER_MAP[model_id] | |
| else: | |
| print(f"WARNING: No publisher for text model: {model_id}") | |
| path.write_text(json.dumps(data, indent=4, ensure_ascii=False) + "\n", encoding="utf-8") | |
| print(f"Updated {path}") | |
| def add_publisher_to_image_json(): | |
| path = MODELS_DIR / "image.json" | |
| data = json.loads(path.read_text(encoding="utf-8")) | |
| # Add to top-level router entries (lightning, lightning-texture-quality) | |
| for key, value in data.items(): | |
| if key == "overrides": | |
| continue | |
| if isinstance(value, dict) and value.get("id"): | |
| model_id = value["id"] | |
| if model_id in PUBLISHER_MAP: | |
| value["publisher_url"] = PUBLISHER_MAP[model_id] | |
| else: | |
| print(f"WARNING: No publisher for image router model: {model_id}") | |
| # Add to each override | |
| for entry in data.get("overrides", []): | |
| model_id = entry.get("id", "") | |
| if model_id in PUBLISHER_MAP: | |
| entry["publisher_url"] = PUBLISHER_MAP[model_id] | |
| else: | |
| print(f"WARNING: No publisher for image model: {model_id}") | |
| path.write_text(json.dumps(data, indent=4, ensure_ascii=False) + "\n", encoding="utf-8") | |
| print(f"Updated {path}") | |
| def add_publisher_to_list_json(filename): | |
| path = MODELS_DIR / filename | |
| data = json.loads(path.read_text(encoding="utf-8")) | |
| for entry in data: | |
| model_id = entry.get("id", "") | |
| if model_id in PUBLISHER_MAP: | |
| entry["publisher_url"] = PUBLISHER_MAP[model_id] | |
| else: | |
| print(f"WARNING: No publisher for {filename} model: {model_id}") | |
| path.write_text(json.dumps(data, indent=4, ensure_ascii=False) + "\n", encoding="utf-8") | |
| print(f"Updated {path}") | |
| def main(): | |
| add_publisher_to_text_json() | |
| add_publisher_to_image_json() | |
| add_publisher_to_list_json("video.json") | |
| add_publisher_to_list_json("audio.json") | |
| add_publisher_to_list_json("3d.json") | |
| # Legacy GPT-4 file (may be a JSON fragment, not valid JSON) | |
| legacy_path = MODELS_DIR / "gpt4-legacy.old.json" | |
| if legacy_path.exists(): | |
| raw_text = legacy_path.read_text(encoding="utf-8").strip() | |
| # Try to parse as JSON first | |
| try: | |
| data = json.loads(raw_text) | |
| if isinstance(data, list): | |
| entries = data | |
| elif isinstance(data, dict): | |
| entries = list(data.values()) | |
| else: | |
| entries = [] | |
| except json.JSONDecodeError: | |
| # It's a JSON fragment (array elements without wrapping []) | |
| entries = [] | |
| try: | |
| # Wrap in array to parse | |
| data = json.loads(f"[{raw_text}]") | |
| entries = data if isinstance(data, list) else [] | |
| except json.JSONDecodeError: | |
| print(f"WARNING: Could not parse legacy file {legacy_path}") | |
| entries = [] | |
| for entry in entries: | |
| if isinstance(entry, dict): | |
| model_id = entry.get("id", "") | |
| if model_id in PUBLISHER_MAP: | |
| entry["publisher_url"] = PUBLISHER_MAP[model_id] | |
| else: | |
| print(f"WARNING: No publisher for legacy model: {model_id}") | |
| # Write back as valid JSON array | |
| legacy_path.write_text(json.dumps(entries, indent=4, ensure_ascii=False) + "\n", encoding="utf-8") | |
| print(f"Updated {legacy_path}") | |
| if __name__ == "__main__": | |
| main() | |
Xet Storage Details
- Size:
- 10.2 kB
- Xet hash:
- 0910f1fe94df84dc3f8ba7a30e23fd1415630b78f1da13e88a18948921140a57
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.