记忆

image-hosting

把图片上传到 img402.dev 并拿到公开链接,无需账号或 API key,1 MB 以下永久免费。

它能做什么

通过 multipart POST 把图片上传到 img402.dev,即可得到一条公开 CDN 链接。1 MB 及以下的文件永久免费保存;1–10 MB 的文件免费保留 30 天。若要让大文件永久保留,需要走 x402 支付流程,花 0.01 USDC 换取一个上传令牌,再用该令牌重新 POST 图片。支持 PNG、JPEG、GIF、WebP 四种格式,单文件最大 10 MB。响应为 JSON,包含 url、id、contentType、sizeBytes 和 expiresAt;永久文件 expiresAt 为 null,30 天临时期则为时间戳。

什么时候用它

  • 把截图变成可分享的链接发到聊天里
  • 在 Markdown 文档中嵌入图表或示意图
  • 为生成的图片配公开 URL 发到社交平台
  • 把可视化结果托管成可被外链引用的图片资源

技能文档

Image Hosting — img402

Upload an image to img402.dev and get a public URL. No account, no API key, no config.

Most uploads are free and permanent. A median agent screenshot is ~100 KB, well under the 1 MB threshold where free hosting never expires. Reach for a paid tier only when the file is genuinely large.

Pick a tier

UploadPriceRetentionUse when
≤ 1 MB$0PermanentAlmost everything — screenshots, diagrams, charts
1–10 MB$030 daysLarge images you only need short-term
Up to 10 MB$0.01 USDCPermanentLarge images that must outlive the month

* Paid permanence is service-life retention. If img402 ever shuts down, there's a 90-day on-site notice before takedown. See Terms § 2A.

Size is never the reason to pay — 10 MB uploads are free. You pay only to keep an image over 1 MB alive past 30 days.

Quick reference

# Upload (multipart)
curl -s -X POST https://img402.dev/api/free -F image=@/path/to/image.png

# Response — expiresAt is null for images 1MB and under
# {"url":"https://i.img402.dev/aBcDeFgHiJ.png","id":"aBcDeFgHiJ","contentType":"image/png","sizeBytes":182400,"expiresAt":null}

Workflow

  1. Get image: Use an existing file, or generate/download one.
  2. Upload:
    curl -s -X POST https://img402.dev/api/free -F image=@/path/to/image.png
    
  3. Check expiresAt: null means permanent. A timestamp means the file was over 1 MB and will be deleted then.
  4. Use the URL: The url field is a public CDN link. Embed it wherever needed.

If you want a permanent URL and the file is over 1 MB, either shrink it below 1 MB:

sips -Z 1600 /path/to/image.png                                  # macOS — scale longest edge to 1600px
convert /path/to/image.png -resize 1600x1600 /path/to/image.png  # ImageMagick

…or use the paid flow below.

Constraints

  • Max size: 10 MB (every tier)
  • Formats: PNG, JPEG, GIF, WebP
  • Rate limit: 100,000 free uploads/day globally, 1,000/day per IP
  • No auth required

When you need permanence for a file over 1 MB, use the paid flow. Two steps: pay for an upload token via x402, then upload the image with that token.

# Step 1: Get an upload token (requires x402 payment)
POST https://img402.dev/api/upload/token   # $0.01 USDC → permanent, up to 10MB
# → {"token": "a1b2c3...", "expiresAt": "..."}

# Step 2: Upload with the token
curl -s -X POST https://img402.dev/api/upload \
  -H "X-Upload-Token: a1b2c3..." \
  -F image=@/path/to/image.png
# → {"url":"...", "id":"...", "contentType":"...", "sizeBytes":..., "expiresAt":null}

The expiresAt in step 1 is the token's expiry (10 minutes), not the image's. The uploaded image's expiresAt is null — permanent.

POST /api/upload/token/permanent still exists at $1.00 USDC. It's a legacy alias that does exactly what the $0.01 route now does; don't use it for new work.

x402 payment is handled by an x402-capable client (the Payments MCP tool, @x402/client, or any other). The client handles the 402 challenge, signs the on-chain payment, and retries automatically. See https://img402.dev/blog/paying-x402-apis for details.

Retention is fixed at upload

The expiresAt you get back is the commitment for that image. Later pricing changes apply to new uploads only — an image already uploaded keeps the retention it was given, and img402 won't silently extend it.

Public access

Uploaded images are reachable by anyone with the URL — there is no auth on serving. Do not upload screenshots of internal systems, personal information, secrets, API keys, or anything else that shouldn't be public. Since most uploads are now permanent, treat every upload as public and irreversible: to remove an image, email [email protected].

相关技能

把截图上传到 img402.dev,拿到一个可在 GitHub PR、Issue、评论里使用的图片链接。

61 次安装1 星标

把消息转发到任意 OpenAI 兼容的 AI 代理,并跨调用维持多轮会话。

121 次安装6 星标

通过 curl 调用 JSON-RPC API 发布 Web 应用,并获得一个公开访问的网址。

152 次安装8 星标

基于 Pillow 的图像处理工具:缩放、裁剪、水印、格式转换与 Web 优化一次搞定。

91 次安装3 星标

通过单一脚本调用多家官方图像生成 API,支持参考图与批量并发。

156 次安装1 星标

通过文本或参考图生成与编辑图像,支持多模型路由、角色一致性以及电商产品图拍摄。

536 次安装10 星标