Borrowing it
Nothing to install: this file belongs to 1710782766/llm_vision. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/1710782766/llm_vision/main/CLAUDE.mdgit clone --depth 1 https://github.com/1710782766/llm_visionWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/1710782766/llm_vision/claude-md)<a href="https://agentmods.dev/instructions/1710782766/llm_vision/claude-md"><img src="https://agentmods.dev/badge/instructions/1710782766/llm_vision/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/1710782766/llm_vision/claude-md"><img src="https://agentmods.dev/badge/instructions/1710782766/llm_vision/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01734 | $0.01734 |
| Opus 5 | $0.00867 | $0.00867 |
| Sonnet 5 | $0.00347 | $0.00347 |
| Haiku 4.5 | $0.00173 | $0.00173 |
Grade A, and why
llm_vision CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 51 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
项目概述
本地 MCP 服务器:为无视觉能力的模型(如 deepseek 系)提供视觉——模型传入本地图片路径,服务器调用阿里 DashScope 视觉模型,返回文字结果。已注册在 .mcp.json(可移植形式,cwd: "."),本项目内任何 Claude Code 会话直接可用 describe_image / extract_text。images/ 目录被 gitignore(测试图不入库),冒烟/对比脚本可用参数传入图片路径或自备 images/ 测试图。
常用命令
uv sync # 安装依赖(Python 3.12,uv 管理)
uv run pytest tests/ -q # 全量测试(68 个,多数离线不花钱)
uv run pytest tests/test_dashscope_client.py -v # 单文件测试
uv run python main.py # 启动 MCP 服务器(stdio;Claude Code 会按 .mcp.json 自动拉起)
uv run python scripts/smoke_test.py [图片路径 ...] # 真实 API 冒烟(消耗额度;绕缓存;缺省用 images/ 自备图,无图时提示传路径)
uv run python scripts/compare_models.py qwen3-vl-plus qwen3.7-plus # 模型对比(同样耗额度)
架构
main.py(FastMCP 薄注册)
├── describe_image(image_path, prompt?, perspective="normal") → LLM_VISION_MODEL(默认 qwen3-vl-plus)
├── extract_text(image_path, prompt?) → LLM_VISION_OCR_MODEL(默认 qwen3.5-ocr)
└── 共用 _analyze_image 管线
→ image_cache 命中检查(可选注入,内容寻址,仅存文本回答)
→ image_loader.load_image(路径/扩展名白名单/10MB 校验,base64+MIME 推断;HEIC/HEIF 走 macOS sips 转换)
→ image_preprocess.preprocess_image(超 1568px 等比缩放 / 超 1.5MB 重压,macOS sips 零依赖,临时文件处理后即删;无 sips 平台跳过)
→ dashscope_client.DashscopeClient.chat(超时/网络/5xx 重试,等比递减预算 ≤2×timeout)
- 工具恒返回字符串:成功返回模型回答,失败返回可读中文错误信息,绝不抛异常到客户端。错误消息以「文件不存在」「不支持的图片格式」「图片过大」「视觉模型调用失败」等开头——测试断言依赖这些前缀,改动错误文案需同步测试
- 依赖注入:
DashscopeClient(api_key, timeout, max_retries=2, transport=None)的transport仅测试注入(httpx.MockTransport),生产传 None。测试注入模式:max_retries=0(即时失败,不等待退避)、缓存测试用tmp_path作 cache_dir、重试测试monkeypatch.setattr("time.sleep", ...)跳过退避。新增测试不要发真实请求 - mcp SDK 是 2.0.0:
mcp.server.fastmcp已移除,用from mcp.server import MCPServer as FastMCP;断言工具注册可用mcp._tool_manager(私有接口),端到端验证用 stdio 子进程(tests/test_main.py 里有完整范式) - 模型可配置:环境变量
LLM_VISION_MODEL/LLM_VISION_OCR_MODEL/LLM_VISION_TIMEOUT(默认 120)/LLM_VISION_MAX_RETRIES(默认 2)/LLM_VISION_DESCRIBE_PROMPT/LLM_VISION_OCR_PROMPT/LLM_VISION_CACHE(默认开)/LLM_VISION_CACHE_DIR/LLM_VISION_MAX_EDGE(默认 1568)/LLM_VISION_COMPRESS(默认开)。注意qwen3-vl-plus-latest别名已 404 失效,勿用 - 改默认值需同步 5 处:
config.py的 DEFAULT_* 常量、tests/test_config.py的test_defaults断言、README ×2 环境变量表、CLAUDE.md 本条、docs/model-eval-2026-08-05.md结论——只改常量不同步测试会静默失败(此前踩过) _analyze_image签名约定:第 5、6 参数max_edge/compress_enabled(预处理),第 7 参数cache(ImageCache | None)。cache 默认 None = 不缓存——smoke 脚本天然绕过缓存验证真实 API;错误字符串永不入缓存- 升级模型前先读
docs/model-eval-2026-08-05.md:三模型对比结论(qwen3-vl-plus 唯一零幻觉、qwen3.7-plus 为候选、qwen3.5-omni-plus 有视觉错误),选新模型以它为依据 - 工具 docstring 即 MCP 工具描述:模型靠它理解工具意图,修改 docstring 会改变模型调用行为
- describe_image 双视角:
perspective参数二选一——normal(默认,DEFAULT_NORMAL_DESCRIBE_PROMPT自然描述)与critical(DEFAULT_DESCRIBE_PROMPT审视视角:客观描述 + 主动报告异常 + 区分事实/推测 + 不找补)。docstring 明确写了「用户提及页面/界面问题(不好看/有问题/检查/找 bug)必须用 critical」——视觉模型会把渲染 bug 合理化,审视指令是实测教训(2026-08-06)。显式prompt优先于视角默认;LLM_VISION_DESCRIBE_PROMPT只覆盖 critical 视角。改这两段提示词会改变模型输出风格,评估文档/README 如引用旧文案需同步
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 51 lines · 1,734 tokens per session scan A 3784f9092027
llm_vision CLAUDE.md is an instructions file published in the GitHub repository 1710782766/llm_vision (0 stars, last pushed 1mo ago), licensed MIT. It adds 1,734 tokens to every session, about $0.0087 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.