360 Secure SkillHub
360 安全技能中心

Guishu GPT Image 2

通过 Guishu Token 的 OpenAI 兼容图像生成接口调用 gpt-image-2 模型,按提示词生成图片。脚本支持尺寸、质量、数量、提示词文件与自定义端点参数,将图片及 prompts.json、request.json、index.html 写入本地目录,并支持 dry-run 预演。

quqi1599
quqi1599
热度 73.12
最近更新 2026-06-22 12:23:41
分类:创作依赖:代码执行 / 第三方 API / 读写文件应用场景:图像生成 / 自动化脚本 / API 集成

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add guishu-gpt-image-2
Metadata
name
guishu-gpt-image-2
description
Generate images with Guishu Token gpt-image-2 through the OpenAI-compatible images endpoint. Use when the user wants Guishu gpt-image-2 image generation, an OpenClaw image skill, scripted image creation, local image output, prompt-to-image tests, customer demos, or a gallery of generated images through https://api.llm-token.cn/v1/images/generations.

Guishu GPT Image 2

Generate images through the Guishu Token OpenAI-compatible image endpoint.

Quick Start

Use the bundled script. It reads the API key from environment variables in this order:

  1. LLM_TOKEN_API_KEY
  2. GUI_SHU_TOKEN_KEY
  3. OPENAI_API_KEY
export LLM_TOKEN_API_KEY="sk-..."
python3 {baseDir}/scripts/generate.py \
  --prompt "a clean product poster for a blue smart speaker, studio lighting" \
  --size 1024x1024 \
  --quality high \
  --n 1

The default endpoint is:

https://api.llm-token.cn/v1/images/generations

The default model is:

gpt-image-2

Workflow

  1. Read references/gpt-image-2-api.md when you need endpoint details, supported request fields, timeout guidance, or customer-facing setup notes.
  2. Prepare one specific image prompt. Keep prompts concrete about subject, style, composition, camera, lighting, color, and output use.
  3. Run scripts/generate.py. Prefer --response-format b64_json so the script can save files locally without depending on temporary URLs.
  4. Inspect the saved output directory. The script writes generated images, prompts.json, request.json, and index.html.
  5. If the request times out after a long wait, do not automatically retry. High-resolution requests can take 70-150 seconds and may still be billable upstream.

Useful Commands

# Dry-run without sending a billable request.
python3 {baseDir}/scripts/generate.py --prompt "test prompt" --dry-run

# Tall portrait.
python3 {baseDir}/scripts/generate.py \
  --prompt "ultra realistic portrait photo, natural light, shallow depth of field" \
  --size 1024x1792 \
  --quality high

# Multiple prompts from a text file, one prompt per line.
python3 {baseDir}/scripts/generate.py --prompt-file ./prompts.txt --n 1

# Custom endpoint if the gateway changes.
python3 {baseDir}/scripts/generate.py \
  --endpoint https://api.llm-token.cn/v1/images/generations \
  --model gpt-image-2 \
  --prompt "minimal app icon, white background"

Safety and Cost Notes

  • Do not print API keys. Prefer environment variables over command-line --api-key.
  • Avoid blind retries after long timeouts. Ask the user before retrying a request that may already have been processed.
  • For casual users, recommend the web UI first: https://image2.gpt-agent.cc/.
  • For automation or agent workflows, use the script and save local outputs.