← 返回
内容创作 Key 中文

Grok Image API

Work with OpenAI-compatible image generation and image editing endpoints. Use when the user wants to generate images from prompts, edit images with prompts a...
与OpenAI兼容的图像生成和编辑接口协作。用于用户想要根据提示生成或编辑图像的场景。
xiaolozee
内容创作 clawhub v1.1.1 1 版本 100000 Key: 需要
★ 0
Stars
📥 627
下载
💾 11
安装
1
版本
#grok#image#latest

概述

Grok Image API

Use this skill to work with image endpoints that expose:

  • POST /v1/images/generations
  • POST /v1/images/edits

Prefer practical workflows: generate or edit an image, save the result locally, and then send or reuse the saved file.

Quick start

Prefer the bundled script:

  • scripts/grok_image_api.py generate for text-to-image
  • scripts/grok_image_api.py edit for image editing
  • scripts/grok_image_api.py probe to verify the endpoint is reachable

Default environment variables:

  • IMAGE_API_BASE_URL
  • IMAGE_API_KEY

Workflow

  1. Identify the task: generate or edit.
  2. Load credentials through environment variables.
  3. For generation, send JSON to /v1/images/generations.
  4. For editing, send multipart form data to /v1/images/edits with image and optional mask.
  5. Save the returned image locally. If the API returns a URL, download it locally by default.
  6. If the user is on QQ and wants the image delivered, reply with a tag pointing to the local file or returned URL.

Generation

Example:

IMAGE_API_BASE_URL="https://example.com/v1" \
IMAGE_API_KEY="..." \
python3 scripts/grok_image_api.py generate \
  --style anime \
  --preset-size portrait \
  --prompt "a cozy cyberpunk tea shop at night" \
  --out /tmp/generated.png

Use --size or --preset-size, --style, --model, --n, and --extra key=value when needed.

Editing

Example:

IMAGE_API_BASE_URL="https://example.com/v1" \
IMAGE_API_KEY="..." \
python3 scripts/grok_image_api.py edit \
  --image /absolute/path/input.png \
  --style cute \
  --prompt "replace the background with a sunset beach" \
  --out /tmp/edited.png

Add --mask /absolute/path/mask.png if the API supports masked edits.

Notes

  • Assume this service is not a full chat-completions endpoint.
  • Do not call unrelated routes unless the user explicitly says they exist.
  • Avoid echoing secrets back to the user.
  • Prefer local saved files for messaging channels that can upload local images.
  • Default output directory is a local output/grok-images/ folder when --out is omitted.

References

Read references/api-notes.md when you need a compact reminder of request/response patterns, presets, and output behavior.

版本历史

共 1 个版本

  • v1.1.1 当前
    2026-03-29 16:42 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

content-creation

Humanizer

biostartechnology
消除AI写作痕迹,使文本更自然真实。基于维基百科"AI写作特征"指南,识别并修正夸张象征、宣传用语、肤浅-ing分析、模糊归因、破折号滥用、三项排比、AI词汇、负面平行结构及冗长连接词等模式。
★ 857 📥 199,223
content-creation

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 141 📥 41,008
content-creation

AdMapix

fly0pants
广告情报与应用数据分析助手,支持搜索广告素材、分析应用排名、下载量、收入及市场洞察,用于广告素材和竞品分析。
★ 294 📥 136,391