annotation-studio / model_catalog.py
pepijn223's picture
pepijn223 HF Staff
Fix skipped videos without a runtime limit; calibrate video pricing (#2)
578dc0f
Raw History Blame Contribute Delete
11.4 kB
"""Curated, vision-tested HF routes. Server-owned pricing and request parameters.
This is a practical selection, not a universal quality ranking. Keep checked_at
and smoke tests current when changing any route. Never infer vision support from
model family names or silently substitute a similarly named checkpoint.
"""
from copy import deepcopy
DEFAULT_MODEL = "qwen38-27b"
MODELS = {
"qwen38-27b": {
"key": "qwen38-27b",
"name": "Qwen3.8 27B",
"model_id": "Qwen/Qwen3.8-27B",
"provider": "novita",
"provider_name": "Novita",
"route": "Qwen/Qwen3.8-27B:novita",
"input_rate": 0.42,
"output_rate": 3,
"cached_input_rate": 0.085,
"context_length": 1000000,
"concurrency": 32,
"generation_options": {"chat_template_kwargs": {"enable_thinking": False}},
"featured": True,
"description": "Current default · tested on 33 robot episodes",
"checked_at": "2026-09-25",
"vision_test": "Two-image JSON smoke test passed",
"concurrency_note": "32 simultaneous vision requests tested",
"model_url": "https://huggingface.co/Qwen/Qwen3.8-27B",
"pricing_url": "https://novita.ai/pricing",
},
"qwen36-27b": {
"key": "qwen36-27b",
"name": "Qwen3.6 27B",
"model_id": "Qwen/Qwen3.6-27B",
"provider": "ovhcloud",
"provider_name": "OVHcloud",
"route": "Qwen/Qwen3.6-27B:ovhcloud",
"input_rate": 0.47,
"output_rate": 3.19,
"cached_input_rate": 0.47,
"context_length": 262144,
"concurrency": 8,
"generation_options": {"reasoning_effort": "none"},
"featured": True,
"description": "Earlier Qwen generation · native vision",
"checked_at": "2026-09-25",
"vision_test": "Two-image JSON smoke test passed",
"concurrency_note": "Conservative setting; sustained concurrency not benchmarked",
"model_url": "https://huggingface.co/Qwen/Qwen3.6-27B",
"pricing_url": "https://router.huggingface.co/v1/models",
},
"gemma4-31b": {
"key": "gemma4-31b",
"name": "Gemma 4 31B",
"model_id": "google/gemma-4-31B-it",
"provider": "novita",
"provider_name": "Novita",
"route": "google/gemma-4-31B-it:novita",
"input_rate": 0.14,
"output_rate": 0.4,
"cached_input_rate": 0.14,
"context_length": 262144,
"concurrency": 8,
"generation_options": {},
"featured": True,
"description": "Compact vision model · lower token cost",
"checked_at": "2026-09-25",
"vision_test": "Two-image JSON smoke test passed",
"concurrency_note": "Conservative setting; sustained concurrency not benchmarked",
"model_url": "https://huggingface.co/google/gemma-4-31B-it",
"pricing_url": "https://novita.ai/pricing",
},
"qwen38-flash-next": {
"key": "qwen38-flash-next",
"name": "Qwen3.8 Flash Next",
"model_id": "Qwen/Qwen3.8-Flash-Next",
"provider": "featherless-ai",
"provider_name": "Featherless",
"route": "Qwen/Qwen3.8-Flash-Next:featherless-ai",
"input_rate": 0.15,
"output_rate": 0.5,
"cached_input_rate": 0.03,
"context_length": 262144,
"concurrency": 2,
"generation_options": {"chat_template_kwargs": {"enable_thinking": False}},
"featured": False,
"description": "Original action-phase prompt development model",
"checked_at": "2026-09-25",
"vision_test": "Two-image JSON smoke test passed",
"concurrency_note": "2 simultaneous requests tested on this account",
"model_url": "https://huggingface.co/Qwen/Qwen3.8-Flash-Next",
"pricing_url": "https://featherless.ai/models/Qwen/Qwen3.8-Flash-Next",
},
"glm53-flash": {
"key": "glm53-flash",
"name": "GLM 5.3 Flash",
"model_id": "zai-org/GLM-5.3-Flash",
"provider": "novita",
"provider_name": "Novita",
"route": "zai-org/GLM-5.3-Flash:novita",
"input_rate": 0.15,
"output_rate": 0.5,
"cached_input_rate": 0.03,
"context_length": 1048576,
"concurrency": 8,
"generation_options": {"thinking": {"type": "disabled"}},
"featured": False,
"description": "Low-cost multimodal option",
"checked_at": "2026-09-25",
"vision_test": "Two-image JSON smoke test passed",
"concurrency_note": "Conservative setting; sustained concurrency not benchmarked",
"model_url": "https://huggingface.co/zai-org/GLM-5.3-Flash",
"pricing_url": "https://novita.ai/pricing",
},
"kimi-k3": {
"key": "kimi-k3",
"name": "Kimi K3",
"model_id": "moonshotai/Kimi-K3",
"provider": "baseten",
"provider_name": "Baseten",
"route": "moonshotai/Kimi-K3:baseten",
"input_rate": 3,
"output_rate": 15,
"cached_input_rate": 0.3,
"context_length": 1048576,
"concurrency": 8,
"generation_options": {"reasoning_effort": "none"},
"featured": False,
"description": "Premium multimodal option · higher token cost",
"checked_at": "2026-09-25",
"vision_test": "Two-image JSON smoke test passed",
"concurrency_note": "Conservative setting; sustained concurrency not benchmarked",
"model_url": "https://huggingface.co/moonshotai/Kimi-K3",
"pricing_url": "https://www.baseten.co/library/kimi-k3/",
},
"minimax-m3": {
"key": "minimax-m3",
"name": "MiniMax M3",
"model_id": "MiniMaxAI/MiniMax-M3",
"provider": "novita",
"provider_name": "Novita",
"route": "MiniMaxAI/MiniMax-M3:novita",
"input_rate": 0.3,
"output_rate": 1.2,
"cached_input_rate": 0.06,
"context_length": 1000000,
"concurrency": 8,
"generation_options": {},
"featured": False,
"description": "Multimodal option with fast generation",
"checked_at": "2026-09-25",
"vision_test": "Two-image JSON smoke test passed",
"concurrency_note": "Conservative setting; sustained concurrency not benchmarked",
"model_url": "https://huggingface.co/MiniMaxAI/MiniMax-M3",
"pricing_url": "https://novita.ai/pricing",
"pricing_tiers": [
{"min_input_tokens": 524288, "input_rate": 0.6, "output_rate": 2.4, "cached_input_rate": 0.12}
],
"pricing_note": "Base rates shown. Requests with 524,288 or more input tokens cost twice as much.",
},
"gemma4-26b": {
"key": "gemma4-26b",
"name": "Gemma 4 26B A4B",
"model_id": "google/gemma-4-26B-A4B-it",
"provider": "novita",
"provider_name": "Novita",
"route": "google/gemma-4-26B-A4B-it:novita",
"input_rate": 0.13,
"output_rate": 0.4,
"cached_input_rate": 0.13,
"context_length": 262144,
"concurrency": 8,
"generation_options": {},
"featured": False,
"description": "Efficient mixture-of-experts vision model",
"checked_at": "2026-09-25",
"vision_test": "Two-image JSON smoke test passed",
"concurrency_note": "Conservative setting; sustained concurrency not benchmarked",
"model_url": "https://huggingface.co/google/gemma-4-26B-A4B-it",
"pricing_url": "https://novita.ai/pricing",
},
"qwen3-vl-235b": {
"key": "qwen3-vl-235b",
"name": "Qwen3 VL 235B",
"model_id": "Qwen/Qwen3-VL-235B-A22B-Instruct",
"provider": "novita",
"provider_name": "Novita",
"route": "Qwen/Qwen3-VL-235B-A22B-Instruct:novita",
"input_rate": 0.3,
"output_rate": 1.5,
"cached_input_rate": 0.3,
"context_length": 131072,
"concurrency": 8,
"generation_options": {},
"featured": False,
"description": "Large dedicated vision-language model",
"checked_at": "2026-09-25",
"vision_test": "Two-image JSON smoke test passed",
"concurrency_note": "Conservative setting; sustained concurrency not benchmarked",
"model_url": "https://huggingface.co/Qwen/Qwen3-VL-235B-A22B-Instruct",
"pricing_url": "https://novita.ai/pricing",
},
}
UNAVAILABLE = []
# Robot → human demonstration videos. Both media models run on fal through HF Inference Providers
# and are billed per request to the signed-in account, so the Space reserves a fixed quoted price.
HUMAN_VIDEO = {
"provider": "fal-ai",
"provider_name": "fal",
"edit_model": "Qwen/Qwen-Image-Edit-2509",
# Lower guidance keeps the scene's colours; fal's default oversaturates.
"edit_guidance_scale": 1.5,
"video_model": "MiniMaxAI/MiniMax-H3",
# MiniMax-H3 is mapped under the image-text-to-video task on fal.
"video_task": "image-text-to-video",
"resolution": "480P",
"duration_s": 5,
# fal list prices. The edit is billed per output megapixel (fal returns 1024x1024), the video
# per second of output.
"edit_usd_per_megapixel": 0.03,
"edit_megapixels": 1.05,
"video_usd_per_second": 0.05,
# Reserved before each request and reconciled to the price above on success.
"edit_usd": 0.04,
"video_usd": 0.30,
# Default simultaneous media requests per job (user-selectable up to 32).
"concurrency": 8,
# Estimation only, calibrated on the first Studio video run (3 ReBot episodes, 159.7 s,
# 33 subtasks): subtasks ≈ 1 per episode + 1 per 5.3 s. The two VLM calls per video used
# about 1,750 input and 550 output tokens together. A video takes up to ~3 min on fal.
"subtasks_per_episode": 1,
"seconds_per_subtask": 5.3,
"vlm_input_tokens": 1750,
"vlm_output_tokens": 550,
"minutes_per_video": 3,
"checked_at": "2026-09-30",
"pricing_url": "https://fal.ai/models/minimax/h3/image-to-video",
}
# 0 = one video for every subtask.
HUMAN_VIDEO_SEGMENT_CHOICES = (0, 1, 2, 3, 5, 8)
HUMAN_VIDEO_PARALLEL_CHOICES = (1, 4, 8, 16, 32)
def model_profile(key=DEFAULT_MODEL):
if key not in MODELS:
raise ValueError("Choose a supported vision model from the model selector.")
return deepcopy(MODELS[key])
def human_video_profile():
return deepcopy(HUMAN_VIDEO)
def human_video_segment_cost(profile=None):
"""Expected fal charge for one video (edit + animation) at list prices."""
profile = profile or HUMAN_VIDEO
return (
profile["edit_usd_per_megapixel"] * profile["edit_megapixels"]
+ profile["video_usd_per_second"] * profile["duration_s"]
)
def human_video_segment_reservation(profile=None):
"""Conservative amount held from the spending target while one video is in flight."""
profile = profile or HUMAN_VIDEO
return profile["edit_usd"] + profile["video_usd"]
def public_models():
return {
"default": DEFAULT_MODEL,
"models": [model_profile(k) for k in MODELS],
"unavailable": deepcopy(UNAVAILABLE),
"human_video": {
**human_video_profile(),
"segment_choices": list(HUMAN_VIDEO_SEGMENT_CHOICES),
"parallel_choices": list(HUMAN_VIDEO_PARALLEL_CHOICES),
"segment_usd": human_video_segment_cost(),
},
}