Qwen Vision (Image & Video Understanding) Analyze images and videos using Qwen VL and QVQ models. This skill is part of qwencloud/qwencloud-ai . Skill directory Use this skill's internal files to execute and learn. Load reference files on demand when the default path fails or you need details. | Location | Purpose | |----------|---------| | | Image/video understanding, multi-image, thinking mode | | | Visual reasoning (QVQ, chain-of-thought, streaming) | | | OCR text extraction | | | Shared helpers (base64, upload, streaming) | | | Fallback: curl, code generation | | | Curl for base64, multi-…

\n for candidate in candidates:\n m = re.search(pattern, candidate)\n if m:\n agent, skill = m.group(1) or \"default\", m.group(2)\n if len(agent) \u003c= 32 and len(skill) \u003c= 32:\n return json.dumps({\"channel\": \"qwencloud-skill\", \"tags\": {\"t1\": skill, \"t2\": agent}}, separators=(',', ':'))\n return None\n\n\n# ---------------------------------------------------------------------------\n# Section 6: HTTP infrastructure\n# ---------------------------------------------------------------------------\n\n_RETRYABLE_CODES = frozenset({429, 500, 502, 503, 504})\n\n\ndef http_request(\n method: str,\n url: str,\n api_key: str,\n payload: dict[str, Any] | None = None,\n *,\n extra_headers: dict[str, str] | None = None,\n timeout: int = 120,\n retries: int = 2,\n backoff: float = 1.5,\n) -> dict[str, Any]:\n \"\"\"Generic HTTP request with retry and exponential backoff.\n\n Handles JSON serialisation, provider header injection, and retryable\n HTTP codes.\n \"\"\"\n hdrs = get_provider().make_headers(api_key, payload)\n if extra_headers:\n hdrs.update(extra_headers)\n data = json.dumps(payload).encode(\"utf-8\") if payload else None\n last_err = \"\"\n for attempt in range(retries + 1):\n req = urllib.request.Request(url, data=data, headers=hdrs, method=method)\n try:\n with urllib.request.urlopen(req, timeout=timeout) as resp:\n return json.loads(resp.read().decode(\"utf-8\"))\n except urllib.error.HTTPError as exc:\n body = \"\"\n try:\n body = exc.read().decode(\"utf-8\", errors=\"replace\")\n except Exception:\n pass\n if api_key and len(api_key) > 8 and api_key in body:\n body = body.replace(api_key, mask_key(api_key))\n last_err = f\"HTTP {exc.code}: {sanitize_diagnostic(body)[:500]}\"\n if exc.code not in _RETRYABLE_CODES or attempt >= retries:\n if exc.code == 401 and is_token_plan_key(api_key):\n print(\n \"Hint: if this model is not on Token Plan, see supported \"\n \"models at https://docs.qwencloud.com/token-plan\",\n file=sys.stderr,\n )\n raise RuntimeError(last_err) from None\n time.sleep(backoff * (2 ** attempt))\n except urllib.error.URLError as exc:\n last_err = sanitize_diagnostic(str(exc.reason))\n if attempt >= retries:\n raise RuntimeError(f\"Network error: {last_err}\") from None\n time.sleep(backoff * (2 ** attempt))\n raise RuntimeError(last_err)\n\n\ndef http_post(\n url: str,\n api_key: str,\n payload: dict[str, Any],\n *,\n timeout: int = 120,\n retries: int = 2,\n backoff: float = 1.5,\n) -> dict[str, Any]:\n \"\"\"Convenience: non-streaming POST, returns parsed JSON.\"\"\"\n return http_request(\n \"POST\", url, api_key, payload,\n timeout=timeout, retries=retries, backoff=backoff,\n )\n\n\ndef _sse_error_message(\n chunk: Any,\n event_type: str,\n api_key: str,\n) -> Optional[str]:\n \"\"\"Return a safe error message for an SSE error payload, if present.\"\"\"\n error_payload = chunk.get(\"error\") if isinstance(chunk, dict) else None\n has_top_level_error = isinstance(chunk, dict) and (\n not chunk.get(\"choices\")\n and chunk.get(\"code\") is not None\n and chunk.get(\"message\") is not None\n )\n if event_type.lower() != \"error\" and error_payload is None and not has_top_level_error:\n return None\n\n payload = error_payload if error_payload is not None else chunk\n if isinstance(payload, dict):\n code = payload.get(\"code\") or payload.get(\"type\")\n message = payload.get(\"message\")\n if code and message:\n detail = f\"{code}: {message}\"\n elif code or message:\n detail = str(code or message)\n else:\n detail = json.dumps(payload, ensure_ascii=False)\n else:\n detail = str(payload)\n\n if api_key and len(api_key) > 8 and api_key in detail:\n detail = detail.replace(api_key, mask_key(api_key))\n return f\"SSE error: {sanitize_diagnostic(detail)[:500]}\"\n\n\ndef stream_sse(\n url: str,\n api_key: str,\n payload: dict[str, Any],\n *,\n timeout: int = 180,\n) -> Iterator[dict[str, Any]]:\n \"\"\"Streaming POST. Yields parsed SSE ``data:`` chunks.\n\n Automatically sets ``stream: true`` in the payload and sends the\n appropriate ``Accept`` header.\n \"\"\"\n payload[\"stream\"] = True\n hdrs = get_provider().make_headers(api_key, payload)\n hdrs[\"Accept\"] = \"text/event-stream\"\n data = json.dumps(payload).encode(\"utf-8\")\n req = urllib.request.Request(url, data=data, headers=hdrs, method=\"POST\")\n try:\n resp = urllib.request.urlopen(req, timeout=timeout)\n except urllib.error.HTTPError as exc:\n body = \"\"\n try:\n body = exc.read().decode(\"utf-8\", errors=\"replace\")\n except Exception:\n pass\n if api_key and len(api_key) > 8 and api_key in body:\n body = body.replace(api_key, mask_key(api_key))\n raise RuntimeError(f\"HTTP {exc.code}: {sanitize_diagnostic(body)[:500]}\") from None\n except urllib.error.URLError as exc:\n raise RuntimeError(f\"Network error: {sanitize_diagnostic(str(exc.reason))}\") from None\n\n buf = b\"\"\n event_type = \"\"\n try:\n while True:\n raw = resp.read(4096)\n if not raw:\n break\n buf += raw\n while b\"\\n\" in buf:\n line_bytes, buf = buf.split(b\"\\n\", 1)\n line = line_bytes.decode(\"utf-8\", errors=\"replace\").strip()\n if not line:\n event_type = \"\"\n continue\n if line.startswith(\"event:\"):\n event_type = line[6:].strip()\n continue\n if not line.startswith(\"data:\"):\n continue\n json_str = line[5:].strip()\n if json_str == \"[DONE]\":\n return\n try:\n chunk = json.loads(json_str)\n except json.JSONDecodeError:\n if event_type.lower() == \"error\":\n detail = json_str\n if api_key and len(api_key) > 8 and api_key in detail:\n detail = detail.replace(api_key, mask_key(api_key))\n detail = sanitize_diagnostic(detail)[:500]\n raise RuntimeError(f\"SSE error: {detail}\") from None\n pass\n else:\n error_message = _sse_error_message(chunk, event_type, api_key)\n if error_message:\n raise RuntimeError(error_message)\n yield chunk\n event_type = \"\"\n finally:\n resp.close()\n\n\n# ---------------------------------------------------------------------------\n# Section 7: File upload / download\n# ---------------------------------------------------------------------------\n\n_BASE64_FILE_LIMIT = 7 * 1024 * 1024 # 7 MB (base64 adds ~33%; API limit is 10 MB)\n\n\ndef upload_local_file(api_key: str, model: str, fp: Path) -> str:\n \"\"\"Upload a local file to the active provider's temp storage.\n\n Returns a provider-managed URL (e.g. ``oss://`` for DashScope).\n \"\"\"\n return get_provider().upload_file(api_key, model, fp)\n\n\ndef resolve_file(\n value: str,\n *,\n api_key: str | None = None,\n model: str | None = None,\n) -> str:\n \"\"\"Resolve a file reference for API consumption.\n\n URLs (``http``, ``https``, ``data``, and provider-managed schemes)\n pass through unchanged. Local files are handled based on context:\n\n - *api_key* + *model* provided: upload to temp storage.\n - Otherwise: convert to ``data:`` base64 URI (must be \u003c 7 MB).\n \"\"\"\n provider = get_provider()\n pass_through = (\"http://\", \"https://\", \"data:\") + provider.managed_url_schemes()\n if value.startswith(pass_through):\n return value\n if value.startswith(\"file://\"):\n parsed = urllib.parse.urlparse(value)\n if parsed.netloc and parsed.netloc.lower() != \"localhost\":\n raise ValueError(\n f\"Cannot resolve non-local file URI authority {parsed.netloc!r}; \"\n \"only an empty authority or 'localhost' is supported.\"\n )\n value = urllib.request.url2pathname(parsed.path)\n p = Path(value)\n if not (p.exists() and p.is_file()):\n return value\n\n file_size = p.stat().st_size\n\n if api_key and model:\n managed_url = provider.upload_file(api_key, model, p)\n tag = \"48 h TTL\" if managed_url.startswith(\"oss://\") else \"custom OSS\"\n print(sanitize_diagnostic(f\"Uploaded {p.name} -> {managed_url} ({tag})\"), file=sys.stderr)\n return managed_url\n\n if file_size > _BASE64_FILE_LIMIT:\n print(\n f\"Warning: {p.name} is {file_size / 1024 / 1024:.1f} MB -- \"\n \"base64 may exceed the 10 MB API limit. \"\n \"Use --upload-files to auto-upload, or provide an online URL.\",\n file=sys.stderr,\n )\n\n mime = mimetypes.guess_type(p.name)[0] or \"application/octet-stream\"\n b64 = base64.b64encode(p.read_bytes()).decode(\"ascii\")\n return f\"data:{mime};base64,{b64}\"\n\n\ndef download_file(url: str, dest: Path, *, timeout: int = 120) -> Path:\n \"\"\"Download a file from *url* to *dest*, creating parent dirs as needed.\"\"\"\n dest.parent.mkdir(parents=True, exist_ok=True)\n req = urllib.request.Request(url, headers={\"User-Agent\": \"qwencloud-skills\"})\n try:\n with urllib.request.urlopen(req, timeout=timeout) as resp:\n dest.write_bytes(resp.read())\n except urllib.error.URLError as exc:\n raise RuntimeError(f\"Download failed: {sanitize_diagnostic(str(exc))}\") from None\n return dest\n\n\n# ---------------------------------------------------------------------------\n# Section 8: Request / response utilities\n# ---------------------------------------------------------------------------\n\ndef load_request(args: Any) -> dict[str, Any]:\n \"\"\"Load request dict from ``--request`` or ``--file`` CLI argument.\"\"\"\n if getattr(args, \"request\", None):\n return json.loads(args.request)\n if getattr(args, \"file\", None):\n return json.loads(Path(args.file).read_text(encoding=\"utf-8\"))\n raise ValueError(\"Provide --request '{...}' or --file path/to/request.json\")\n\n\ndef save_result(result: dict[str, Any], output_path: str | Path) -> None:\n \"\"\"Write *result* as JSON to *output_path*, creating parent dirs.\"\"\"\n p = Path(output_path)\n p.parent.mkdir(parents=True, exist_ok=True)\n p.write_text(json.dumps(result, ensure_ascii=False, indent=2), encoding=\"utf-8\")\n\n\ndef extract_text(content: Any) -> str:\n \"\"\"Extract plain text from a message ``content`` field.\n\n Handles ``str``, ``list[{type, text}]``, and ``None``.\n \"\"\"\n if isinstance(content, str):\n return content\n if isinstance(content, list):\n for item in content:\n if isinstance(item, dict) and item.get(\"type\") == \"text\":\n text = item.get(\"text\")\n if isinstance(text, str):\n return text\n return json.dumps(content, ensure_ascii=False)\n if content is None:\n return \"\"\n return json.dumps(content, ensure_ascii=False)\n\n\ndef try_parse_json(text: str) -> Any | None:\n \"\"\"Attempt to parse *text* as JSON; return ``None`` on failure.\"\"\"\n text = text.strip()\n if not text:\n return None\n try:\n return json.loads(text)\n except json.JSONDecodeError:\n return None\n\n\n# ---------------------------------------------------------------------------\n# Section 9: Async task polling\n# ---------------------------------------------------------------------------\n\ndef poll_task(\n task_id: str,\n api_key: str,\n *,\n timeout_s: int = 600,\n interval: int = 10,\n verbose: bool = True,\n) -> dict[str, Any]:\n \"\"\"Poll an async task until it reaches a terminal state.\n\n Returns the final result dict. Raises ``TimeoutError`` if\n *timeout_s* is exceeded.\n \"\"\"\n provider = get_provider()\n url = provider.task_poll_url(task_id)\n terminals = provider.terminal_statuses()\n start = time.time()\n poll_count = 0\n while True:\n result = http_request(\"GET\", url, api_key)\n elapsed = int(time.time() - start)\n poll_count += 1\n status = provider.extract_task_status(result)\n if verbose:\n print(f\" [{elapsed}s] task={task_id} status={status}\", file=sys.stderr)\n if status in terminals:\n return result\n if time.time() - start > timeout_s:\n raise TimeoutError(\n f\"Task {task_id} timed out after {timeout_s}s \"\n f\"({poll_count} polls, last status: {status})\"\n )\n time.sleep(interval)\n\n\n# ---------------------------------------------------------------------------\n# Section 10: Update-check signal\n# ---------------------------------------------------------------------------\n\ntry:\n from gossamer import run as _run_update_signal_impl\nexcept ImportError:\n _run_update_signal_impl = None # type: ignore[assignment]\n\n\ndef run_update_signal(caller: str | Path | None = None) -> None:\n \"\"\"Emit update-check signals to stderr (non-blocking, failure-safe).\n\n Parameters\n ----------\n caller : str or Path, optional\n ``__file__`` of the calling script.\n \"\"\"\n if _run_update_signal_impl:\n try:\n _run_update_signal_impl(caller=caller or __file__)\n except Exception:\n pass\n","content_type":"text/x-python; charset=utf-8","language":"python","size":49931,"content_sha256":"fadc836540173f9a5b1dd531f3b266931e181b2cf94c1d5bbae892c15469ed33"},{"filename":"scripts/reason.py","content":"#!/usr/bin/env python3\n\"\"\"Visual reasoning with the configured thinking-capable vision model.\n\nChain-of-thought visual reasoning: the model thinks step-by-step before answering.\nBest for math problems in images, complex chart analysis, video understanding,\nand multi-step visual logic. The current configured default is qwen3.8-max.\nAlways uses streaming so reasoning tokens are returned and QVQ remains compatible.\n\nUsage:\n python scripts/reason.py --request '{\"prompt\":\"Solve this problem\",\"image\":\"math.png\"}'\n python scripts/reason.py --request '{\"prompt\":\"Analyze trends\",\"image\":\"chart.jpg\",\"model\":\"qwen3-vl-plus\"}'\n python scripts/reason.py --request '{\"prompt\":\"What happens?\",\"video\":\"clip.mp4\",\"fps\":2}'\n python scripts/reason.py --request '{\"prompt\":\"Describe\",\"video_frames\":[\"f1.jpg\",\"f2.jpg\"],\"fps\":2}'\n python scripts/reason.py --file request.json --output result.json\n\"\"\"\nfrom __future__ import annotations\n\nimport argparse\nimport json\nimport sys\nfrom pathlib import Path\nfrom typing import Any\n\nsys.path.insert(0, str(Path(__file__).resolve().parent))\n\nfrom vision_lib import ( # noqa: E402\n DiagnosticStream,\n check_token_plan_model_support,\n chat_url,\n get_default_model,\n load_request,\n prompt_update_check_install,\n require_api_key,\n sanitize_diagnostic,\n save_result,\n stream_sse,\n build_content,\n)\n\nDEFAULT_MAX_TOKENS = 8192\n\ndef reason(req: dict[str, Any], api_key: str, *, upload_files: bool = False) -> dict[str, Any]:\n prompt = req.get(\"prompt\")\n if not prompt:\n raise ValueError(\"prompt is required\")\n\n model = req[\"model\"] if \"model\" in req else get_default_model(\"reason\")\n upload_key = api_key if upload_files else None\n upload_model = model if upload_files else None\n\n content = build_content(req, upload_key=upload_key, upload_model=upload_model)\n content.append({\"type\": \"text\", \"text\": prompt})\n\n payload: dict[str, Any] = {\n \"model\": model,\n \"messages\": [{\"role\": \"user\", \"content\": content}],\n \"max_tokens\": req.get(\"max_tokens\", DEFAULT_MAX_TOKENS),\n \"stream\": True,\n \"stream_options\": {\"include_usage\": True},\n }\n\n enable_thinking = req.get(\"enable_thinking\")\n if enable_thinking is not None:\n payload[\"enable_thinking\"] = bool(enable_thinking)\n thinking_budget = req.get(\"thinking_budget\")\n if thinking_budget is not None:\n payload[\"thinking_budget\"] = int(thinking_budget)\n\n reasoning_content = \"\"\n answer_content = \"\"\n usage: dict[str, Any] = {}\n model_name = model\n is_answering = False\n\n diagnostics = DiagnosticStream()\n try:\n for chunk in stream_sse(\n chat_url(), api_key, payload,\n timeout=int(req.get(\"timeout_s\", 300)),\n ):\n if chunk.get(\"usage\"):\n usage = chunk[\"usage\"]\n if chunk.get(\"model\"):\n model_name = chunk[\"model\"]\n\n choices = chunk.get(\"choices\") or []\n if not choices:\n continue\n delta = choices[0].get(\"delta\") or {}\n\n rc = delta.get(\"reasoning_content\") or \"\"\n if rc:\n reasoning_content += rc\n if not is_answering:\n diagnostics.write(rc)\n\n ct = delta.get(\"content\") or \"\"\n if ct:\n if not is_answering:\n is_answering = True\n if reasoning_content:\n diagnostics.write(\"\\n\\n\")\n answer_content += ct\n diagnostics.write(ct)\n finally:\n if reasoning_content or answer_content:\n diagnostics.write(\"\\n\")\n diagnostics.flush()\n\n result: dict[str, Any] = {\n \"text\": answer_content,\n \"model\": model_name,\n \"usage\": usage,\n }\n if reasoning_content:\n result[\"reasoning\"] = reasoning_content\n return result\n\ndef main() -> None:\n prompt_update_check_install()\n parser = argparse.ArgumentParser(\n description=\"Visual reasoning (current configured default: qwen3.8-max; always streaming)\",\n formatter_class=argparse.RawDescriptionHelpFormatter,\n epilog=\"\"\"\\\nrequest JSON fields (--request / --file):\n prompt (required) Reasoning question or instruction\n image Single image URL or local path\n video Video URL or local path\n video_frames Array of frame image URLs/paths (alternative to video)\n fps Frame sampling rate for video (default: auto)\n model Model ID (current configured default: qwen3.8-max)\n enable_thinking true/false — override hybrid thinking (thinking-only models cannot disable it)\n thinking_budget Max thinking tokens\n max_tokens Max output tokens (default: 8192)\n timeout_s Request timeout in seconds (default: 300)\n\ninput types (provide exactly one):\n image Single image reasoning\n video Video reasoning (URL or local file)\n video_frames Video from extracted frames (array of image paths)\n\nmodel examples (current default loads from CDN configuration):\n qwen3.8-max Current default; multimodal, thinking on by default\n qvq-max PAYG visual reasoning specialist; thinking/streaming only\n qwen3-vl-plus General vision with optional thinking mode\n qwen3.5-plus Unified multimodal with thinking on by default\n\noutput:\n Result JSON contains: text (answer), reasoning (chain-of-thought), usage\n\nenvironment variables:\n DASHSCOPE_API_KEY (required) API key — also loaded from .env\n QWEN_API_KEY (alternative) Alias for DASHSCOPE_API_KEY\n QWEN_REGION ap-southeast-1 (default)\n\nexamples:\n # Solve a math problem from image\n python scripts/reason.py --request '{\"prompt\":\"Solve this\",\"image\":\"math.png\"}'\n\n # Chart analysis with thinking\n python scripts/reason.py --request '{\"prompt\":\"Analyze trends\",\"image\":\"chart.jpg\",\n \"model\":\"qwen3-vl-plus\",\"enable_thinking\":true}' --output result.json\n\n # Video reasoning\n python scripts/reason.py --request '{\"prompt\":\"What happens and why?\",\n \"video\":\"clip.mp4\",\"fps\":2}' --print-response\n\"\"\",\n )\n parser.add_argument(\"--request\", help=\"Inline JSON: must contain 'prompt' + image/video input\")\n parser.add_argument(\"--file\", help=\"Path to JSON request file\")\n parser.add_argument(\"--upload-files\", action=\"store_true\",\n help=\"Upload local files to temp storage (oss://) instead of base64\")\n parser.add_argument(\"--output\", default=\"\", help=\"Save result JSON to this path\")\n parser.add_argument(\"--print-response\", action=\"store_true\", help=\"Print result JSON to stdout\")\n args = parser.parse_args()\n\n api_key = require_api_key()\n try:\n req = load_request(args)\n model = req[\"model\"] if \"model\" in req else get_default_model(\"reason\")\n check_token_plan_model_support(model, domain=\"Vision\")\n result = reason(req, api_key, upload_files=args.upload_files)\n except (ValueError, RuntimeError) as e:\n print(sanitize_diagnostic(f\"Error: {e}\"), file=sys.stderr)\n sys.exit(1)\n\n if args.output:\n save_result(result, args.output)\n if args.print_response:\n print(json.dumps(result, ensure_ascii=False, indent=2))\n\nif __name__ == \"__main__\":\n main()\n","content_type":"text/x-python; charset=utf-8","language":"python","size":7315,"content_sha256":"825866b95ebfe5b938ec3b345736cf349cedd054c4c5c6f3ee3ff636af18eca8"},{"filename":"scripts/vision_lib.py","content":"\"\"\"Shared infrastructure for qwencloud-vision scripts.\n\nThin wrapper around qwencloud_lib that re-exports common symbols and adds\nvision-specific helpers (streaming with reasoning content, base64 encoding for\nsmaller files, shared multimodal content builder). Stdlib only -- no pip install\nrequired.\n\"\"\"\nfrom __future__ import annotations\n\nimport sys\n\nif sys.version_info \u003c (3, 9):\n print(f\"Error: Python 3.9+ required (found {sys.version}). \"\n \"Install: https://www.python.org/downloads/\", file=sys.stderr)\n sys.exit(1)\n\nfrom pathlib import Path\nfrom typing import Any\n\nsys.path.insert(0, str(Path(__file__).resolve().parent))\n\n# Re-export shared infrastructure so existing scripts keep working with\n# ``from vision_lib import ...``.\nfrom qwencloud_lib import ( # noqa: E402,F401\n DiagnosticStream,\n chat_url,\n check_token_plan_model_support,\n extract_text,\n has_oss_url,\n http_post,\n load_cdn_model_config,\n load_request,\n native_base_url,\n require_api_key as _require_api_key_base,\n resolve_file,\n run_update_signal,\n sanitize_diagnostic,\n save_result,\n stream_sse,\n try_parse_json,\n upload_local_file,\n)\n\n\n_MODEL_CONFIG_DIR = Path(__file__).resolve().parent.parent / \"cdn\" / \"config\"\n\n\ndef _validate_model_config(config: dict[str, Any]) -> bool:\n defaults = config.get(\"default_models\")\n return (\n isinstance(defaults, dict)\n and all(\n isinstance(defaults.get(task), str) and defaults[task]\n for task in (\"analyze\", \"reason\", \"ocr\")\n )\n )\n\n\ndef get_default_model(task: str) -> str:\n \"\"\"Return the current default model for a vision task.\"\"\"\n config = load_cdn_model_config(\n \"qwencloud-vision-config.json\",\n local_dir=_MODEL_CONFIG_DIR,\n required_keys=(\"default_models\",),\n validator=_validate_model_config,\n )\n model = config[\"default_models\"].get(task)\n if not isinstance(model, str) or not model:\n raise RuntimeError(f\"Invalid vision model configuration: missing default for {task}\")\n return model\n\n# ---------------------------------------------------------------------------\n# Vision-specific credential wrapper\n# ---------------------------------------------------------------------------\n\ndef require_api_key() -> str:\n \"\"\"Load API key with vision domain tagging.\n\n Token Plan keys (``sk-sp-...``) pass through here and are routed to the\n Token Plan endpoint by ``qwencloud_lib``; per-model availability is\n handled by ``check_token_plan_model_support()`` in each script (aligned\n with the qianwen-ai implementation).\n \"\"\"\n return _require_api_key_base(script_file=__file__, domain=\"Vision\")\n\n# ---------------------------------------------------------------------------\n# Update-check signal (convenience)\n# ---------------------------------------------------------------------------\n\ndef prompt_update_check_install() -> None:\n \"\"\"Emit structured signals about update-check skill status to stderr.\"\"\"\n run_update_signal(caller=__file__)\n\n# ---------------------------------------------------------------------------\n# Shared multimodal content builder\n# ---------------------------------------------------------------------------\n\ndef build_content(\n req: dict[str, Any],\n detail: str = \"auto\",\n *,\n upload_key: str | None = None,\n upload_model: str | None = None,\n) -> list[dict[str, Any]]:\n \"\"\"Build multimodal content parts from image/video/video_frames input.\n\n Shared by analyze.py and reason.py. The ``detail`` parameter is only\n applied to image_url items and is ignored for video content.\n\n Supports:\n - ``video_frames``: list of frame image paths/URLs → video content part\n - ``video``: single video URL/path → video_url content part\n - ``images``: list of image paths/URLs → multiple image_url parts\n - ``image``: single image path/URL → one image_url part\n \"\"\"\n parts: list[dict[str, Any]] = []\n\n if req.get(\"video_frames\"):\n frames = [\n resolve_file(str(frame), api_key=upload_key, model=upload_model)\n for frame in req[\"video_frames\"]\n ]\n video_obj: dict[str, Any] = {\"type\": \"video\", \"video\": frames}\n if req.get(\"fps\"):\n video_obj[\"fps\"] = float(req[\"fps\"])\n parts.append(video_obj)\n elif req.get(\"video\"):\n video_url = resolve_file(str(req[\"video\"]), api_key=upload_key, model=upload_model)\n video_obj = {\n \"type\": \"video_url\",\n \"video_url\": {\"url\": video_url},\n }\n if req.get(\"fps\"):\n video_obj[\"fps\"] = float(req[\"fps\"])\n parts.append(video_obj)\n elif req.get(\"images\"):\n for img in req[\"images\"]:\n resolved_url = resolve_file(str(img), api_key=upload_key, model=upload_model)\n parts.append({\"type\": \"image_url\", \"image_url\": {\"url\": resolved_url, \"detail\": detail}})\n elif req.get(\"image\"):\n resolved_url = resolve_file(str(req[\"image\"]), api_key=upload_key, model=upload_model)\n parts.append({\"type\": \"image_url\", \"image_url\": {\"url\": resolved_url, \"detail\": detail}})\n else:\n raise ValueError(\"Provide 'image', 'images', 'video', or 'video_frames'\")\n\n return parts\n","content_type":"text/x-python; charset=utf-8","language":"python","size":5263,"content_sha256":"ede24f207181c22869e5434e741b5b09ad910203b6004080b8eeb515616304df"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Qwen Vision (Image & Video Understanding)","type":"text"}]},{"type":"paragraph","content":[{"text":"Analyze images and videos using Qwen VL and QVQ models. This skill is part of ","type":"text"},{"text":"qwencloud/qwencloud-ai","type":"text","marks":[{"type":"strong"}]},{"text":".","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Skill directory","type":"text"}]},{"type":"paragraph","content":[{"text":"Use this skill's internal files to execute and learn. Load reference files on demand when the default path fails or you need details.","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Location","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Purpose","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"scripts/analyze.py","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Image/video understanding, multi-image, thinking mode","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"scripts/reason.py","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Visual reasoning (QVQ, chain-of-thought, streaming)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"scripts/ocr.py","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"OCR text extraction","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"scripts/vision_lib.py","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Shared helpers (base64, upload, streaming)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"references/execution-guide.md","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Fallback: curl, code generation","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"references/curl-examples.md","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Curl for base64, multi-image, video, OCR","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"references/visual-reasoning.md","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"QVQ and thinking mode details","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"references/prompt-guide.md","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Query prompt templates by task, thinking mode decision","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"references/ocr.md","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"OCR parameters and examples","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"references/sources.md","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Official documentation URLs","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Security","type":"text"}]},{"type":"paragraph","content":[{"text":"NEVER output any API key or credential in plaintext.","type":"text","marks":[{"type":"strong"}]},{"text":" Always use variable references (","type":"text"},{"text":"$QWENCLOUD_API_KEY","type":"text","marks":[{"type":"code_inline"}]},{"text":" in shell, ","type":"text"},{"text":"os.environ[\"QWENCLOUD_API_KEY\"]","type":"text","marks":[{"type":"code_inline"}]},{"text":" in Python). The scripts accept ","type":"text"},{"text":"QWENCLOUD_API_KEY","type":"text","marks":[{"type":"code_inline"}]},{"text":", then ","type":"text"},{"text":"QWEN_API_KEY","type":"text","marks":[{"type":"code_inline"}]},{"text":", then ","type":"text"},{"text":"DASHSCOPE_API_KEY","type":"text","marks":[{"type":"code_inline"}]},{"text":". Any check or detection of credentials must be ","type":"text"},{"text":"non-plaintext","type":"text","marks":[{"type":"strong"}]},{"text":": report only status (e.g. \"set\" / \"not set\", \"valid\" / \"invalid\"), never the value. Never display contents of ","type":"text"},{"text":".env","type":"text","marks":[{"type":"code_inline"}]},{"text":" or config files that may contain secrets.","type":"text"}]},{"type":"paragraph","content":[{"text":"When the API key is not configured, NEVER ask the user to provide it directly.","type":"text","marks":[{"type":"strong"}]},{"text":" Instead, help create a ","type":"text"},{"text":".env","type":"text","marks":[{"type":"code_inline"}]},{"text":" file with a placeholder (","type":"text"},{"text":"QWENCLOUD_API_KEY=sk-your-key-here","type":"text","marks":[{"type":"code_inline"}]},{"text":") and instruct the user to replace it with their actual key from the ","type":"text"},{"text":"QwenCloud Console","type":"text","marks":[{"type":"link","attrs":{"href":"https://home.qwencloud.com/api-keys","title":null}}]},{"text":". Only write the actual key value if the user explicitly requests it.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Key Compatibility","type":"text"}]},{"type":"paragraph","content":[{"text":"Scripts support both ","type":"text"},{"text":"standard QwenCloud API keys","type":"text","marks":[{"type":"strong"}]},{"text":" (","type":"text"},{"text":"sk-...","type":"text","marks":[{"type":"code_inline"}]},{"text":") and ","type":"text"},{"text":"Token Plan keys","type":"text","marks":[{"type":"strong"}]},{"text":" (","type":"text"},{"text":"sk-sp-...","type":"text","marks":[{"type":"code_inline"}]},{"text":"). Token Plan keys are automatically routed to the Token Plan endpoint for supported multimodal models — see the ","type":"text"},{"text":"Token Plan model catalog","type":"text","marks":[{"type":"link","attrs":{"href":"https://alioth-intl.alicdn.com/skills-info/models/references/qwencloud-token-plan-models.md","title":null}}]},{"text":". If CDN access fails, use the ","type":"text"},{"text":"local fallback","type":"text","marks":[{"type":"link","attrs":{"href":"cdn/references/qwencloud-token-plan-models.md","title":null}}]},{"text":".","type":"text"}]},{"type":"paragraph","content":[{"text":"Token Plan: do not use curl; always use the bundled Python scripts.","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"Coding Plan keys (also ","type":"text"},{"text":"sk-sp-","type":"text","marks":[{"type":"code_inline"}]},{"text":" prefix but purchased via Coding Plan subscription) cannot be used for direct API calls. The scripts detect key type at startup and route accordingly. If qwencloud-ops-auth is installed, see its ","type":"text"},{"text":"references/codingplan.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" for current model coverage, endpoint mapping, and error details.","type":"text"}]},{"type":"paragraph","content":[{"text":"Detect the API key type without exposing the key:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python3 -c \"\nimport sys; sys.path.insert(0, 'scripts')\nfrom qwencloud_lib import detect_api_key_type\nprint(detect_api_key_type('scripts/qwencloud_lib.py'))\n\"","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Output","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Meaning","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"token-plan","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Token Plan key detected (","type":"text"},{"text":"sk-sp-","type":"text","marks":[{"type":"code_inline"}]},{"text":" prefix)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"payg","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Standard PAYG key detected","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"not-set","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"No API key found in environment","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Model Selection","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"🚫 CRITICAL — Never override user-specified parameters.","type":"text","marks":[{"type":"strong"}]},{"text":" If the user explicitly specifies a model (in prompt or request JSON), you MUST use exactly that model. Do NOT:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Replace it with a \"better suited\" or newer model (e.g., swapping the user's ","type":"text"},{"text":"qwen3-vl-plus","type":"text","marks":[{"type":"code_inline"}]},{"text":" for ","type":"text"},{"text":"qwen3.7-plus","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"qwen3.8-max","type":"text","marks":[{"type":"code_inline"}]},{"text":" because newer docs \"prefer\" it)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Add parameters the user did not ask for (","type":"text"},{"text":"enable_thinking","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"thinking_budget","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"vl_high_resolution_images","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"detail","type":"text","marks":[{"type":"code_inline"}]},{"text":"), except that the bundled scripts must send ","type":"text"},{"text":"enable_thinking: false","type":"text","marks":[{"type":"code_inline"}]},{"text":" when the user requests ","type":"text"},{"text":"json_mode","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"schema","type":"text","marks":[{"type":"code_inline"}]},{"text":" and omitted the setting","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"\"Optimize\" any explicit user choice","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Selection guidance below applies ","type":"text"},{"text":"only when the user has NOT specified a model","type":"text","marks":[{"type":"strong"}]},{"text":".","type":"text"}]}]},{"type":"paragraph","content":[{"text":"Before selecting, recommending, or defaulting a model, fetch and read the current ","type":"text"},{"text":"QwenCloud vision model catalog","type":"text","marks":[{"type":"link","attrs":{"href":"https://alioth-intl.alicdn.com/skills-info/models/references/qwencloud-vision-models.md","title":null}}]},{"text":". It contains the model list, basic model information, task recommendations, compatibility notes, and defaults. If CDN access fails, use the ","type":"text"},{"text":"local fallback","type":"text","marks":[{"type":"link","attrs":{"href":"cdn/references/qwencloud-vision-models.md","title":null}}]},{"text":".","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User specified a model","type":"text","marks":[{"type":"strong"}]},{"text":" → ","type":"text"},{"text":"MANDATORY: use that exact model","type":"text","marks":[{"type":"strong"}]},{"text":" — do not substitute or \"optimize\" it. Do not add unrequested parameters except for the structured-output compatibility behavior described above; reject a thinking-only model instead of silently replacing it.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Consult the qwencloud-model-selector skill","type":"text","marks":[{"type":"strong"}]},{"text":" when model choice depends on requirement, scenario, or pricing.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"No signal, clear task","type":"text","marks":[{"type":"strong"}]},{"text":" → use the default and task-specific alternatives from the model catalog. Dedicated-script defaults remain independent of key type; Token Plan users should select a compatible model from the catalog when a default is unavailable on their plan.","type":"text"}]}]}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"⚠️ Important","type":"text","marks":[{"type":"strong"}]},{"text":": The model catalog is a ","type":"text"},{"text":"point-in-time snapshot","type":"text","marks":[{"type":"strong"}]},{"text":" and may be outdated. Model availability changes frequently. ","type":"text"},{"text":"Always check the ","type":"text","marks":[{"type":"strong"}]},{"text":"official model list","type":"text","marks":[{"type":"link","attrs":{"href":"https://www.qwencloud.com/models","title":null}},{"type":"strong"}]},{"text":" for the authoritative, up-to-date catalog before making model decisions.","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Model details","type":"text","marks":[{"type":"strong"}]},{"text":": For more information about a specific model, direct the user to its detail page: ","type":"text"},{"text":"https://www.qwencloud.com/models/\u003cmodel-name>","type":"text","marks":[{"type":"code_inline"}]},{"text":" (replace ","type":"text"},{"text":"\u003cmodel-name>","type":"text","marks":[{"type":"code_inline"}]},{"text":" with the exact model ID, e.g. ","type":"text"},{"text":"qwen3.6-plus","type":"text","marks":[{"type":"code_inline"}]},{"text":" → https://www.qwencloud.com/models/qwen3.6-plus). NEVER modify or guess the model name in the URL.","type":"text"}]}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Dynamic model queries","type":"text","marks":[{"type":"strong"}]},{"text":": If the ","type":"text"},{"text":"qwencloud-model-selector","type":"text","marks":[{"type":"strong"}]},{"text":" skill or ","type":"text"},{"text":"QwenCloud CLI","type":"text","marks":[{"type":"strong"}]},{"text":" (","type":"text"},{"text":"qwencloud models info \u003cmodel>","type":"text","marks":[{"type":"code_inline"}]},{"text":") is available, use it for real-time model data. CLI requires authentication — see the ","type":"text"},{"text":"qwencloud-usage","type":"text","marks":[{"type":"strong"}]},{"text":" skill for login flow.","type":"text"}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Execution","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Prerequisites","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"API Key","type":"text","marks":[{"type":"strong"}]},{"text":": Check ","type":"text"},{"text":"QWENCLOUD_API_KEY","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"QWEN_API_KEY","type":"text","marks":[{"type":"code_inline"}]},{"text":", then ","type":"text"},{"text":"DASHSCOPE_API_KEY","type":"text","marks":[{"type":"code_inline"}]},{"text":" using a ","type":"text"},{"text":"non-plaintext","type":"text","marks":[{"type":"strong"}]},{"text":" check only (e.g. in shell: ","type":"text"},{"text":"[ -n \"$QWENCLOUD_API_KEY\" ]","type":"text","marks":[{"type":"code_inline"}]},{"text":"; report only \"set\" or \"not set\", never the key value). If not set: run the * ","type":"text"},{"text":"qwencloud-ops-auth","type":"text","marks":[{"type":"em"}]},{"text":"* skill if available; otherwise guide the user to obtain a key from ","type":"text"},{"text":"QwenCloud Console","type":"text","marks":[{"type":"link","attrs":{"href":"https://home.qwencloud.com/api-keys","title":null}}]},{"text":" and set it via ","type":"text"},{"text":".env","type":"text","marks":[{"type":"code_inline"}]},{"text":" file ( ","type":"text"},{"text":"echo 'QWENCLOUD_API_KEY=sk-your-key-here' >> .env","type":"text","marks":[{"type":"code_inline"}]},{"text":" in project root or current directory) or environment variable. The script searches for ","type":"text"},{"text":".env","type":"text","marks":[{"type":"code_inline"}]},{"text":" in the current working directory and the project root. Skills may be installed independently — do not assume qwencloud-ops-auth is present. ","type":"text"},{"text":"Note","type":"text","marks":[{"type":"strong"}]},{"text":": The script auto-loads ","type":"text"},{"text":".env","type":"text","marks":[{"type":"code_inline"}]},{"text":" from the current directory and the project root (in addition to any exported environment variable). A shell check showing ","type":"text"},{"text":"$QWENCLOUD_API_KEY","type":"text","marks":[{"type":"code_inline"}]},{"text":" as \"not set\" does NOT mean the script will fail — it may still find the key in ","type":"text"},{"text":".env","type":"text","marks":[{"type":"code_inline"}]},{"text":". Treat the shell check as informational only; the authoritative test is simply running the script (it exits with a clear error if no key is found anywhere).","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Python 3.9+ (stdlib only, ","type":"text"},{"text":"no pip install needed","type":"text","marks":[{"type":"strong"}]},{"text":")","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Environment Check","type":"text"}]},{"type":"paragraph","content":[{"text":"Before first execution, verify Python is available:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python3 --version # must be 3.9+","type":"text"}]},{"type":"paragraph","content":[{"text":"If ","type":"text"},{"text":"python3","type":"text","marks":[{"type":"code_inline"}]},{"text":" is unavailable or below 3.9, PAYG may use ","type":"text"},{"text":"Path 2 (curl)","type":"text","marks":[{"type":"strong"}]},{"text":"; Token Plan must install Python 3.9+ instead.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Default: Run Script","type":"text"}]},{"type":"paragraph","content":[{"text":"Script path","type":"text","marks":[{"type":"strong"}]},{"text":": Scripts are in the ","type":"text"},{"text":"scripts/","type":"text","marks":[{"type":"code_inline"}]},{"text":" subdirectory ","type":"text"},{"text":"of this skill's directory","type":"text","marks":[{"type":"strong"}]},{"text":" (the directory containing this SKILL.md). ","type":"text"},{"text":"You MUST first locate this skill's installation directory, then ALWAYS use the full absolute path to execute scripts.","type":"text","marks":[{"type":"strong"}]},{"text":" Do NOT assume scripts are in the current working directory. Do NOT use ","type":"text"},{"text":"cd","type":"text","marks":[{"type":"code_inline"}]},{"text":" to switch directories before execution. Shared infrastructure lives in ","type":"text"},{"text":"scripts/vision_lib.py","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"paragraph","content":[{"text":"Execution note:","type":"text","marks":[{"type":"strong"}]},{"text":" Run all scripts in the ","type":"text"},{"text":"foreground","type":"text","marks":[{"type":"strong"}]},{"text":" — wait for stdout; do not background.","type":"text"}]},{"type":"paragraph","content":[{"text":"Discovery:","type":"text","marks":[{"type":"strong"}]},{"text":" Run ","type":"text"},{"text":"python3 \u003cthis-skill-dir>/scripts/analyze.py --help","type":"text","marks":[{"type":"code_inline"}]},{"text":" (or ","type":"text"},{"text":"reason.py","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"ocr.py","type":"text","marks":[{"type":"code_inline"}]},{"text":") first to see all available arguments.","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Script","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Purpose","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Default Model","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"scripts/analyze.py","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Image understanding, multi-image, video, thinking mode, high-res","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Read the current default from the model catalog above","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"scripts/reason.py","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Visual reasoning with chain-of-thought, video reasoning (always streaming)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Read the current default from the model catalog above","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"scripts/ocr.py","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"OCR text extraction from documents, receipts, tables","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Read the current default from the model catalog above","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"Input type fields","type":"text","marks":[{"type":"strong"}]},{"text":" (use exactly one in ","type":"text"},{"text":"--request","type":"text","marks":[{"type":"code_inline"}]},{"text":" JSON):","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Field","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Use for","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Example","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"image\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Single image (URL or local path)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"image\": \"photo.jpg\"","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"images\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Multi-image comparison (array)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"images\": [\"a.jpg\", \"b.jpg\"]","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"video\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Video file (URL or local path)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"video\": \"clip.mp4\"","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"video_frames\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Video as frame array","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"video_frames\": [\"f1.jpg\", \"f2.jpg\"]","type":"text","marks":[{"type":"code_inline"}]}]}]}]}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"⚠️ Common mistake","type":"text","marks":[{"type":"strong"}]},{"text":": Do NOT use ","type":"text"},{"text":"\"image\"","type":"text","marks":[{"type":"code_inline"}]},{"text":" for video files — use ","type":"text"},{"text":"\"video\"","type":"text","marks":[{"type":"code_inline"}]},{"text":" instead.","type":"text"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Image analysis\npython3 \u003cthis-skill-dir>/scripts/analyze.py \\\n --request '{\"prompt\":\"What is in this image?\",\"image\":\"https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg\"}' \\\n --output output/qwencloud-vision/result.json --print-response\n\n# Video analysis (local file — add --upload-files for files >= 7 MB)\npython3 \u003cthis-skill-dir>/scripts/analyze.py \\\n --request '{\"prompt\":\"Describe what happens in this video\",\"video\":\"clip.mp4\"}' \\\n --upload-files --print-response\n\npython3 \u003cthis-skill-dir>/scripts/reason.py \\\n --request '{\"prompt\":\"Solve this math problem step by step\",\"image\":\"problem.png\"}' \\\n --print-response\n\npython3 \u003cthis-skill-dir>/scripts/ocr.py \\\n --request '{\"image\":\"invoice.jpg\"}' \\\n --print-response","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Argument","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Description","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--request '{...}'","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"JSON request body","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--file path.json","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Load request from file","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--output path","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Save response JSON to path","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--print-response","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Print response to stdout","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--stream","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Enable streaming (auto for thinking/QVQ)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--upload-files","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Upload local files to temp storage (for files > 7 MB)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--schema path.json","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"JSON Schema for structured extraction","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Verify Result","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Exit code ","type":"text"},{"text":"0","type":"text","marks":[{"type":"code_inline"}]},{"text":" + output contains valid JSON with ","type":"text"},{"text":"choices","type":"text","marks":[{"type":"code_inline"}]},{"text":" field → ","type":"text"},{"text":"success","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Non-zero exit, HTTP error, empty response, or JSON with ","type":"text"},{"text":"\"code\"","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"\"message\"","type":"text","marks":[{"type":"code_inline"}]},{"text":" error → ","type":"text"},{"text":"fail","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Post-execution check","type":"text","marks":[{"type":"strong"}]},{"text":": When ","type":"text"},{"text":"--output","type":"text","marks":[{"type":"code_inline"}]},{"text":" is used, verify the response JSON file exists and contains expected content","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"MANDATORY — stderr signal check","type":"text","marks":[{"type":"strong"}]},{"text":": After confirming the result, scan the command's stderr output for ","type":"text"},{"text":"[ACTION_REQUIRED]","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"[UPDATE_AVAILABLE]","type":"text","marks":[{"type":"code_inline"}]},{"text":". If either signal is present, you ","type":"text"},{"text":"MUST","type":"text","marks":[{"type":"strong"}]},{"text":" follow the instructions in ","type":"text"},{"text":"Update Check","type":"text","marks":[{"type":"link","attrs":{"href":"#update-check-mandatory-post-execution","title":null}}]},{"text":" below before responding to the user.","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"On Failure","type":"text"}]},{"type":"paragraph","content":[{"text":"If scripts fail, match the error output against the diagnostic table below to determine the resolution. If no match, read ","type":"text"},{"text":"execution-guide.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/execution-guide.md","title":null}}]},{"text":" for alternative paths: curl commands (Path 2), code generation (Path 3), and autonomous resolution (Path 5).","type":"text"}]},{"type":"paragraph","content":[{"text":"If Python is not available at all","type":"text","marks":[{"type":"strong"}]},{"text":" → PAYG may use Path 2 (curl); Token Plan must install Python 3.9+.","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Error Pattern","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Diagnosis","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Resolution","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"command not found: python3","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Python not on PATH","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Try ","type":"text"},{"text":"python","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"py -3","type":"text","marks":[{"type":"code_inline"}]},{"text":"; install Python 3.9+ if missing","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Python 3.9+ required","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Script version check failed","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Upgrade Python to 3.9+","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"SyntaxError","type":"text","marks":[{"type":"code_inline"}]},{"text":" near type hints","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Python \u003c 3.9","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Upgrade Python to 3.9+","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"QWENCLOUD_API_KEY/QWEN_API_KEY/DASHSCOPE_API_KEY not found","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Missing API key","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Obtain key from ","type":"text"},{"text":"QwenCloud Console","type":"text","marks":[{"type":"link","attrs":{"href":"https://home.qwencloud.com/api-keys","title":null}}]},{"text":"; add to ","type":"text"},{"text":".env","type":"text","marks":[{"type":"code_inline"}]},{"text":": ","type":"text"},{"text":"echo 'QWENCLOUD_API_KEY=sk-...' >> .env","type":"text","marks":[{"type":"code_inline"}]},{"text":"; or run ","type":"text"},{"text":"qwencloud-ops-auth","type":"text","marks":[{"type":"strong"}]},{"text":" if available","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"HTTP 401","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Invalid or mismatched key","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Run ","type":"text"},{"text":"qwencloud-ops-auth","type":"text","marks":[{"type":"strong"}]},{"text":" (non-plaintext check only); verify key is valid","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"SSL: CERTIFICATE_VERIFY_FAILED","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"SSL cert issue (proxy/corporate)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"macOS: run ","type":"text"},{"text":"Install Certificates.command","type":"text","marks":[{"type":"code_inline"}]},{"text":"; else set ","type":"text"},{"text":"SSL_CERT_FILE","type":"text","marks":[{"type":"code_inline"}]},{"text":" env var","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"URLError","type":"text","marks":[{"type":"code_inline"}]},{"text":" / ","type":"text"},{"text":"ConnectionError","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Network unreachable","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Check internet; set ","type":"text"},{"text":"HTTPS_PROXY","type":"text","marks":[{"type":"code_inline"}]},{"text":" if behind proxy","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"HTTP 429","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Rate limited","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Wait and retry with backoff","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"HTTP 5xx","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Server error","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Retry with backoff","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"PermissionError","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Can't write output","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Use ","type":"text"},{"text":"--output","type":"text","marks":[{"type":"code_inline"}]},{"text":" to specify writable directory","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"File Input","type":"text"}]},{"type":"paragraph","content":[{"text":"The API accepts: ","type":"text"},{"text":"HTTP/HTTPS URL","type":"text","marks":[{"type":"strong"}]},{"text":", ","type":"text"},{"text":"Base64 data URI","type":"text","marks":[{"type":"strong"}]},{"text":", and ","type":"text"},{"text":"oss://","type":"text","marks":[{"type":"code_inline"},{"type":"strong"}]},{"text":" URL","type":"text","marks":[{"type":"strong"}]},{"text":". Local file paths are NOT directly supported — scripts handle conversion automatically. ","type":"text"},{"text":"Pass local paths directly; no manual upload step needed.","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"Large file rule: If the local file is >= 7 MB, always add ","type":"text","marks":[{"type":"strong"}]},{"text":"--upload-files","type":"text","marks":[{"type":"code_inline"},{"type":"strong"}]},{"text":".","type":"text","marks":[{"type":"strong"}]},{"text":" Base64 encoding inflates size by ~33% and will exceed the 10 MB API limit. Small files (including short video clips \u003c 7 MB) can use the default base64 path.","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Method","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"When to use","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"How","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Online URL","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"File already hosted","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Pass URL directly — ","type":"text"},{"text":"preferred for large files","type":"text","marks":[{"type":"strong"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Base64","type":"text","marks":[{"type":"strong"}]},{"text":" (default)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Local files \u003c 7 MB (images or short video clips)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Script auto-converts to ","type":"text"},{"text":"data:","type":"text","marks":[{"type":"code_inline"}]},{"text":" URI","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Temp upload","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Local files >= 7 MB","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Add ","type":"text"},{"text":"--upload-files","type":"text","marks":[{"type":"code_inline"}]},{"text":" flag → uploads to DashScope temp storage (","type":"text"},{"text":"oss://","type":"text","marks":[{"type":"code_inline"}]},{"text":" URL, 48h TTL)","type":"text"}]}]}]}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Production","type":"text","marks":[{"type":"strong"}]},{"text":": Default temp storage has ","type":"text"},{"text":"48h TTL","type":"text","marks":[{"type":"strong"}]},{"text":" and ","type":"text"},{"text":"100 QPS upload limit","type":"text","marks":[{"type":"strong"}]},{"text":" — not suitable for production, high-concurrency, or load-testing. To use your own OSS bucket, set ","type":"text"},{"text":"QWEN_TMP_OSS_BUCKET","type":"text","marks":[{"type":"code_inline"}]},{"text":" and ","type":"text"},{"text":"QWEN_TMP_OSS_REGION","type":"text","marks":[{"type":"code_inline"}]},{"text":" in ","type":"text"},{"text":".env","type":"text","marks":[{"type":"code_inline"}]},{"text":", install ","type":"text"},{"text":"pip install alibabacloud-oss-v2","type":"text","marks":[{"type":"code_inline"}]},{"text":", and provide credentials via ","type":"text"},{"text":"QWEN_TMP_OSS_AK_ID","type":"text","marks":[{"type":"code_inline"}]},{"text":" / ","type":"text"},{"text":"QWEN_TMP_OSS_AK_SECRET","type":"text","marks":[{"type":"code_inline"}]},{"text":" or the standard ","type":"text"},{"text":"OSS_ACCESS_KEY_ID","type":"text","marks":[{"type":"code_inline"}]},{"text":" / ","type":"text"},{"text":"OSS_ACCESS_KEY_SECRET","type":"text","marks":[{"type":"code_inline"}]},{"text":". Use a RAM user with least-privilege (","type":"text"},{"text":"oss:PutObject","type":"text","marks":[{"type":"code_inline"}]},{"text":" + ","type":"text"},{"text":"oss:GetObject","type":"text","marks":[{"type":"code_inline"}]},{"text":" on target bucket only). The ","type":"text"},{"text":"--upload-files","type":"text","marks":[{"type":"code_inline"}]},{"text":" flag is still required for vision scripts to trigger upload. If qwencloud-ops-auth is installed, see its ","type":"text"},{"text":"references/custom-oss.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" for the full setup guide.","type":"text"}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Input from Other Skills","type":"text"}]},{"type":"paragraph","content":[{"text":"When the input file comes from another skill's output (e.g., image-gen, video-gen):","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Pass the URL directly","type":"text","marks":[{"type":"strong"}]},{"text":" (e.g., ","type":"text"},{"text":"\"image\": \"\u003cimage_url from image-gen>\"","type":"text","marks":[{"type":"code_inline"}]},{"text":") — do NOT download the URL first","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Downloading and re-passing as a local path wastes bandwidth and triggers unnecessary base64 encoding or OSS upload","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"All URL types are supported: ","type":"text"},{"text":"https://","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"oss://","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"data:","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Thinking Mode","type":"text"}]},{"type":"paragraph","content":[{"text":"Use the vision model catalog linked above for current thinking defaults and model compatibility. Do NOT set ","type":"text"},{"text":"enable_thinking","type":"text","marks":[{"type":"code_inline"}]},{"text":" unless the user explicitly asks to change it — neither to enable it \"because the task looks complex\" nor to disable it \"because the task looks simple\". The sole compatibility exception is structured output: ","type":"text"},{"text":"json_mode","type":"text","marks":[{"type":"code_inline"}]},{"text":" and ","type":"text"},{"text":"schema","type":"text","marks":[{"type":"code_inline"}]},{"text":" require non-thinking mode, so the bundled scripts automatically send ","type":"text"},{"text":"enable_thinking: false","type":"text","marks":[{"type":"code_inline"}]},{"text":" when the setting is omitted and reject explicit ","type":"text"},{"text":"true","type":"text","marks":[{"type":"code_inline"}]},{"text":". Thinking-only models cannot be used for structured output.","type":"text"}]},{"type":"paragraph","content":[{"text":"See ","type":"text"},{"text":"visual-reasoning.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/visual-reasoning.md","title":null}}]},{"text":" for details.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"OCR","type":"text"}]},{"type":"paragraph","content":[{"text":"Use the vision model catalog linked above for the current OCR default, alternatives, and model capabilities. See ","type":"text"},{"text":"ocr.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/ocr.md","title":null}}]},{"text":" for parameters and examples.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Input Limits","type":"text"}]},{"type":"paragraph","content":[{"text":"Images","type":"text","marks":[{"type":"strong"}]},{"text":": BMP/JPEG/PNG/TIFF/WEBP/HEIC. Min 10px sides, aspect ratio \u003c= 200:1. Check the model catalog above for model-specific size limits.","type":"text"}]},{"type":"paragraph","content":[{"text":"Videos","type":"text","marks":[{"type":"strong"}]},{"text":": MP4/AVI/MKV/MOV/FLV/WMV. Check the model catalog above for model-specific duration and size limits. fps range [0.1, 10], default 2.0.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Error Handling","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"HTTP","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Meaning","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Action","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"401","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Invalid or missing API key","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Run ","type":"text"},{"text":"qwencloud-ops-auth","type":"text","marks":[{"type":"strong"}]},{"text":" if available; else prompt user to set key (non-plaintext check only)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"400","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Bad request (invalid format)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Verify messages format and image URL/format","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"429","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Rate limited","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Retry with exponential backoff","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"5xx","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Server error","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Retry with exponential backoff","type":"text"}]}]}]}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Usage & billing","type":"text","marks":[{"type":"strong"}]},{"text":": Use the ","type":"text"},{"text":"qwencloud-usage","type":"text","marks":[{"type":"strong"}]},{"text":" skill to check usage, free tier quota, and billing directly. Alternatively, the user can visit the QwenCloud console: ","type":"text"},{"text":"Usage Analytics","type":"text","marks":[{"type":"link","attrs":{"href":"https://home.qwencloud.com/analytics","title":null}}]},{"text":" | ","type":"text"},{"text":"Pay-as-you-go Billing","type":"text","marks":[{"type":"link","attrs":{"href":"https://home.qwencloud.com/billing/pay-as-you-go","title":null}}]},{"text":" | ","type":"text"},{"text":"Coding Plan Billing","type":"text","marks":[{"type":"link","attrs":{"href":"https://home.qwencloud.com/billing/coding-plan","title":null}}]}]},{"type":"paragraph","content":[{"text":"NEVER fabricate, guess, or construct usage/billing/console URLs.","type":"text","marks":[{"type":"strong"}]},{"text":" Only provide the exact links listed in this skill. If a URL is not listed here, do not invent one.","type":"text"}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Output Location","type":"text"}]},{"type":"paragraph","content":[{"text":"Prefer the ","type":"text"},{"text":"current working directory","type":"text","marks":[{"type":"strong"}]},{"text":". Default subdirectory: ","type":"text"},{"text":"./output/qwencloud-vision/","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"paragraph","content":[{"text":"Write prohibition","type":"text","marks":[{"type":"strong"}]},{"text":": NEVER write output files into this skill's installation directory or any ","type":"text"},{"text":"skills/","type":"text","marks":[{"type":"code_inline"}]},{"text":" hierarchy. All generated content must go to ","type":"text"},{"text":"output/","type":"text","marks":[{"type":"code_inline"}]},{"text":" under the current working directory or a user-specified path.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Token Plan Support","type":"text"}]},{"type":"paragraph","content":[{"text":"Token Plan keys (","type":"text"},{"text":"sk-sp-...","type":"text","marks":[{"type":"code_inline"}]},{"text":") are supported for multimodal models with vision capability.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Supported vision models","type":"text"}]},{"type":"paragraph","content":[{"text":"Fetch and read the current ","type":"text"},{"text":"Token Plan model catalog","type":"text","marks":[{"type":"link","attrs":{"href":"https://alioth-intl.alicdn.com/skills-info/models/references/qwencloud-token-plan-models.md","title":null}}]},{"text":", then use an exact listed vision-capable model. If CDN access fails, use the ","type":"text"},{"text":"local fallback","type":"text","marks":[{"type":"link","attrs":{"href":"cdn/references/qwencloud-token-plan-models.md","title":null}}]},{"text":".","type":"text"}]},{"type":"paragraph","content":[{"text":"These models use the OpenAI-compatible chat API with multimodal message format (image_url content type).","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Defaults","type":"text"}]},{"type":"paragraph","content":[{"text":"When no model is supplied, each script uses its configured default regardless of key type. Check the vision and Token Plan catalogs for current compatibility. An explicitly supplied request model always takes precedence.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Not supported via Token Plan","type":"text"}]},{"type":"paragraph","content":[{"text":"Models not listed as vision-capable in the Token Plan model catalog require a PAYG key. Only with the user's explicit consent, suggest compatible alternatives from the vision catalog. Never silently swap a user-specified model because of key-type restrictions; present the options and let the user choose.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Required header","type":"text"}]},{"type":"paragraph","content":[{"text":"User-Agent: qwencloud-skills","type":"text","marks":[{"type":"code_inline"}]},{"text":" is automatically included.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Update Check (MANDATORY Post-Execution)","type":"text"}]},{"type":"paragraph","content":[{"text":"After script execution, check stderr for action signals. The script automatically detects update status and emits structured signals. You MUST act on them. This section also applies when the user explicitly asks to check for updates.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Signal: ","type":"text"},{"text":"[ACTION_REQUIRED] qwencloud-update-check skill is not installed","type":"text","marks":[{"type":"code_inline"}]}]},{"type":"paragraph","content":[{"text":"When stderr contains this signal, you MUST present the following options to the user and ","type":"text"},{"text":"wait for their response before proceeding","type":"text","marks":[{"type":"strong"}]},{"text":". Do NOT silently skip this.","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"The update-check skill is not installed. It keeps you informed about new qwencloud/qwencloud-ai features and bug fixes.","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Install now","type":"text","marks":[{"type":"strong"}]},{"text":" — I'll run the install command for you","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Skip for now","type":"text","marks":[{"type":"strong"}]},{"text":" — do nothing this time","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Never remind me","type":"text","marks":[{"type":"strong"}]},{"text":" — permanently suppress this prompt","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"After the user responds:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User chooses ","type":"text"},{"text":"1","type":"text","marks":[{"type":"strong"}]},{"text":" → run: ","type":"text"},{"text":"npx skills add QwenCloud/qwencloud-ai --skill qwencloud-update-check -y","type":"text","marks":[{"type":"code_inline"}]},{"text":", then run: ","type":"text"},{"text":"python3 \u003cthis-skill-scripts-dir>/gossamer.py --dismiss","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User chooses ","type":"text"},{"text":"2","type":"text","marks":[{"type":"strong"}]},{"text":" → run: ","type":"text"},{"text":"python3 \u003cthis-skill-scripts-dir>/gossamer.py --dismiss","type":"text","marks":[{"type":"code_inline"}]},{"text":", then continue normally","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User chooses ","type":"text"},{"text":"3","type":"text","marks":[{"type":"strong"}]},{"text":" → run: ","type":"text"},{"text":"python3 \u003cthis-skill-scripts-dir>/gossamer.py --never-install","type":"text","marks":[{"type":"code_inline"}]},{"text":", then continue normally","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Signal: ","type":"text"},{"text":"[UPDATE_AVAILABLE]","type":"text","marks":[{"type":"code_inline"}]}]},{"type":"paragraph","content":[{"text":"When stderr contains this signal, you MUST append a brief update notice to your response, including the version info and the update command shown in the stderr output.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"No signal in stderr","type":"text"}]},{"type":"paragraph","content":[{"text":"If stderr contains neither ","type":"text"},{"text":"[ACTION_REQUIRED]","type":"text","marks":[{"type":"code_inline"}]},{"text":" nor ","type":"text"},{"text":"[UPDATE_AVAILABLE]","type":"text","marks":[{"type":"code_inline"}]},{"text":", no action is needed — the skill is installed and up to date (or cached within 24h).","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Explicit user request","type":"text"}]},{"type":"paragraph","content":[{"text":"When the user explicitly asks to check for updates (e.g. \"check for updates\", \"check version\"):","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Look for ","type":"text"},{"text":"qwencloud-update-check/SKILL.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" in sibling skill directories.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"If found — run: ","type":"text"},{"text":"python3 \u003cqwencloud-update-check-dir>/scripts/check_update.py --print-response","type":"text","marks":[{"type":"code_inline"}]},{"text":" and report the result.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"If not found — present the install options above.","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"References","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"execution-guide.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/execution-guide.md","title":null}}]},{"text":" — Fallback paths (curl, code generation, autonomous)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"curl-examples.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/curl-examples.md","title":null}}]},{"text":" — Curl templates (base64, multi-image, video, OCR)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"api-guide.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/api-guide.md","title":null}}]},{"text":" — API supplementary guide","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"visual-reasoning.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/visual-reasoning.md","title":null}}]},{"text":" — QVQ visual reasoning guide","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"ocr.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/ocr.md","title":null}}]},{"text":" — Qwen-VL-OCR text extraction guide","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"sources.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/sources.md","title":null}}]},{"text":" — Official documentation URLs","type":"text"}]}]}]}]},"metadata":{"date":"2026-11-02","name":"qwencloud-vision","author":"@skillopedia","source":{"stars":44,"repo_name":"qwencloud-ai","origin_url":"https://github.com/QwenCloud/qwencloud-ai/blob/HEAD/skills/vision/qwencloud-vision/SKILL.md","repo_owner":"QwenCloud","body_sha256":"4a49a99403a1145fef1e0d37860045ec0c89f45f1223abc28870c1ca15643a08","cluster_key":"9ff195a6083aabcc6784bf14880087a212d3e5c765d8bd4faa3b7d119759273a","clean_bundle":{"format":"clean-skill-bundle-v1","source":"QwenCloud/qwencloud-ai/skills/vision/qwencloud-vision/SKILL.md","text_bytes":135272,"source_commit":"60542ab371ae2adc04937a3fdbbafe7baad7738c","skills_sh_rank":9050,"attachment_count":17,"text_attachments":17,"attachment_storage":"skill_attachments","binary_attachments":0},"cluster_size":1,"skill_md_path":"skills/vision/qwencloud-vision/SKILL.md","import_metadata":{"date":"2026-11-02","author":"@skillopedia","version":"v1","category":"ai-agent-development","category_label":"AI"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"ai-agent-development","import_tag":"skills-sh-top20k-2026-11","description":"Understand images and videos with Qwen vision models. TRIGGER when: user wants to analyze, describe, or extract information from images or videos, OCR text extraction, chart/table reading, visual reasoning, multi-image comparison, screenshot understanding, video comprehension, or explicitly invokes this skill by name (e.g. use qwencloud-vision). DO NOT TRIGGER when: user wants to generate/create images (use qwencloud-image-generation), generate videos (use qwencloud-video-generation), text-only tasks without visual input, or non-Qwen vision tasks.","compatibility":"Requires Python 3.9+; curl is PAYG-only. Cursor: auto-loaded. Claude Code: read this skill's SKILL.md before first use."}},"renderedAt":1793661678135}

Qwen Vision (Image & Video Understanding) Analyze images and videos using Qwen VL and QVQ models. This skill is part of qwencloud/qwencloud-ai . Skill directory Use this skill's internal files to execute and learn. Load reference files on demand when the default path fails or you need details. | Location | Purpose | |----------|---------| | | Image/video understanding, multi-image, thinking mode | | | Visual reasoning (QVQ, chain-of-thought, streaming) | | | OCR text extraction | | | Shared helpers (base64, upload, streaming) | | | Fallback: curl, code generation | | | Curl for base64, multi-…