gemini-vision-router
Route image vision through Gemini REST as a vision fallback.
- License 许可
- MIT
- 最近更新
- 2026-10-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- gemini-vision-router
- author
- curator
- license
- MIT
- version
- 1.0.0
- platforms
- [ "linux", "macos", "windows" ]
- description
- Route image vision through Gemini REST as a vision fallback.
03 SKILL.md 正文
Gemini Vision Router (fallback when native vision fails)
vision_analyze can fail two ways: it can't read file:// local paths (404),
and the backend often returns 429 Too Many Requests. Gemini's REST vision
API uses a separate quota and can read local images as base64 — route image
understanding through it instead.
Key location
The Gemini API key lives in the Gemini CLI config (do NOT print it):
/home/deeone/.gemini/settings.json → security.auth.apiKey.
Minimal working call
import json, base64, urllib.request, urllib.error
with open("/home/deeone/.gemini/settings.json") as f:
KEY = json.load(f)["security"]["auth"]["apiKey"]
with open(IMG, "rb") as f:
b64 = base64.b64encode(f.read()).decode()
url = f"https://generativelanguage.googleapis.com/v1beta/models/{MODEL}:generateContent?key={KEY}"
body = json.dumps({
"contents": [{"parts": [
{"text": PROMPT},
{"inline_data": {"mime_type": "image/png", "data": b64}},
]}]
}).encode()
req = urllib.request.Request(url, data=body, headers={"Content-Type": "application/json"})
with urllib.request.urlopen(req, timeout=60) as r:
resp = json.loads(r.read().decode())
text = "".join(p.get("text","") for p in resp["candidates"][0]["content"]["parts"])
Working models (verified)
gemini-flash-latest— vision works (used successfully this session).gemini-2.5-flash,gemini-2.0-flash— also valid vision models.gemini-1.5-flash— gone for new users (404); avoid.- List available:
GET https://generativelanguage.googleapis.com/v1beta/models?key=KEYthen filtersupportedGenerationMethodscontaininggenerateContent.
Pitfalls
- Never echo the key to chat/terminal — read it programmatically and only print the description.
- Image generation (separate from vision) via
gemini-2.5-flash-image,gemini-3-*-image,nano-banana-*often 429s even when vision is fine. For generating images, prefer NotebookLMinfographic create(separate quota) — seenotebooklm-visual-workflow. responseModalities: ["IMAGE","TEXT"]is for image generation; for vision you only needpartswithtext+inline_data.- No
aspectRatiofield ingenerationConfigfor these models — put orientation in the prompt text instead (it 400s otherwise).
04 同仓库更多 Skills
blocked-page-recovery
Use when a fetch fails: 403/429, paywall, WAF, bot wall.
gemini-vision-fallback
Vision fallback: Gemini REST API if vision_analyze blocked.
twitter-cli
Use twitter-cli for ALL Twitter/X operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, user lookups. Invoke whenever user requests any Twitter interaction.
prism-scan
Structural analysis through dynamically generated cognitive lenses. Generates the optimal analytical lens for the specific code/artifact, then executes it. Finds conservation laws, structural invariants, and concrete bugs that vanilla analysis misses. Use on any code file, system design, or text artifact.
prism-reflect
Constraint transparency: analyzes an artifact structurally, then analyzes what its own analysis concealed. Produces a conservation law AND a constraint report showing what was maximized, what was sacrificed, and what to investigate next. The only AI skill that knows what it can't see.
prism-full
Full Prism: multi-pass structural analysis with mandatory adversarial self-correction. Designs custom analytical passes, executes them with chaining, then attacks its own findings before synthesizing. Use for maximum depth on important code or artifacts.