360 Secure SkillHub
360 安全技能中心

OpenRouter Vision Agent

该 Skill 调用 OpenRouter 的 x-ai/grok-4.1-fast 视觉模型,接收图像地址或图片文件与提示词,返回对图像内容的描述、解释与解读。使用 curl 调用聊天补全接口,需要 OPENROUTER_API_KEY,图像数据会发送到 OpenRouter。

gawainchin
gawainchin
热度 36.47
最近更新 2026-05-11 17:44:14
分类:数据依赖:代码执行 / 第三方 API / 内部调用大模型应用场景:摘要总结 / 概念解释

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add openrouter-vision-skill
Metadata
name
openrouter-vision-agent
description
Analyze images using OpenRouter's vision API with x-ai/grok-4.1-fast. Requires OPENROUTER_API_KEY env var or user-provided key. Use when the user asks to describe, explain, or interpret an image, or when image analysis is needed. Triggered by phrases like "analyze this image", "what's in this photo", "describe this picture", "use openrouter vision". ⚠️ Images are sent to openrouter.ai — avoid sending sensitive/untrusted images.

OpenRouter Vision Agent

Analyzes images via OpenRouter using x-ai/grok-4.1-fast.

API Details

  • Model: x-ai/grok-4.1-fast
  • Endpoint: https://openrouter.ai/api/v1/chat/completions
  • Auth: OPENROUTER_API_KEY env var — required
  • Max Tokens: 500–2000 (adjust depending on needed detail)

Image Analysis

Via curl

curl -s https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "x-ai/grok-4.1-fast",
    "max_tokens": 800,
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "<prompt>"},
        {"type": "image_url", "image_url": {"url": "<image_url>"}}
      ]
    }]
  }'

Parameters

Field Value
model x-ai/grok-4.1-fast
messages[].content[].type text + image_url
image_url.url Direct image URL (http/https)
max_tokens 500–2000

Output

Parse choices[0].message.content from the JSON response.

Notes

  • Credential required: OPENROUTER_API_KEY env var must be set. If not available, ask the user for their OpenRouter API key before proceeding.
  • Privacy: Images (including URLs and uploaded files) are sent to openrouter.ai. Do not use this skill with sensitive or private images.
  • Image URLs must be publicly accessible HTTP/HTTPS URLs
  • Supports JPEG, PNG, WebP, and other common formats
  • For local files, upload to a public URL first