记忆

github-image-hosting

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

它能做什么

把图片上传到 img402.dev,返回的链接可直接用于 GitHub Markdown。1 MB 及以下的图片免费且永久保留,无需鉴权,几乎覆盖所有截图场景。1–10 MB 的图片可免费托管 30 天,如需长期保留可通过 x402 支付 $0.01 USDC。文档同时给出了截图、用 `sips` 缩图到 1 MB 以下、以及用 `gh` CLI 把图片嵌入 PR / Issue 的完整流程。

什么时候用它

  • 在 PR 描述里插入 UI 截图
  • 在 Issue 评论中附上设计稿
  • 在 GitHub 讨论里分享架构图
  • 为 README 添加首图

技能文档

Image Upload for GitHub

Upload an image to img402.dev and embed the returned URL in GitHub markdown.

Screenshots are free and permanent. A UI screenshot is typically 100–400 KB, well under the 1 MB threshold where free hosting never expires — so a link you drop in a PR won't rot into a broken image six months later. You almost never need a paid tier here.

Pick a tier

UploadPriceRetentionUse when
≤ 1 MB$0PermanentPR screenshots, issue comments, mockups, README diagrams
1–10 MB$030 daysLarge captures you only need during review
Up to 10 MB$0.01 USDCPermanentLarge README hero images, public blog visuals

* Paid permanence is service-life retention with a 90-day on-site shutdown notice — see Terms § 2A.

Quick reference

# Upload (multipart)
curl -s -X POST https://img402.dev/api/free -F image=@/tmp/screenshot.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 capture a screenshot:
    screencapture -x /tmp/screenshot.png        # macOS — full screen
    screencapture -xw /tmp/screenshot.png       # macOS — frontmost window
    
  2. Upload:
    curl -s -X POST https://img402.dev/api/free -F image=@/tmp/screenshot.png
    
  3. Check expiresAt: null means permanent. A timestamp means the file was over 1 MB and will be deleted then — if the image needs to outlive that, shrink it under 1 MB and re-upload:
    sips -Z 1600 /tmp/screenshot.png  # macOS — scale longest edge to 1600px
    
  4. Embed the returned url in GitHub markdown:
    ![Screenshot description](https://i.img402.dev/aBcDeFgHiJ.png)
    

GitHub integration

Use gh CLI to embed images in PRs and issues:

# Add to PR description
gh pr edit --body "$(gh pr view --json body -q .body)

![Screenshot](https://i.img402.dev/aBcDeFgHiJ.png)"

# Add as PR comment
gh pr comment --body "![Screenshot](https://i.img402.dev/aBcDeFgHiJ.png)"

# Add to issue
gh issue comment 123 --body "![Screenshot](https://i.img402.dev/aBcDeFgHiJ.png)"

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

Tips

  • Prefer PNG for UI screenshots (sharp text). Use JPEG for photos.
  • Keeping screenshots under 1 MB is worth doing on purpose: it's the line between a permanent URL and one that expires in 30 days. sips -Z 1600 usually gets there with no visible quality loss.
  • When adding to a PR body or comment, use gh pr comment or gh pr edit with the image markdown.

For images over 1 MB that need to be permanent, pay via x402 for a token, then upload with it:

# Step 1: Get an upload token
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=@/tmp/screenshot.png
# → {"url":"...", "expiresAt":null}   # null = permanent

POST /api/upload/token/permanent still exists at $1.00 USDC — a legacy alias for what $0.01 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 similar). See https://img402.dev/blog/paying-x402-apis.

Public access

Uploaded images are reachable by anyone with the URL — there is no auth on serving, and most uploads are now permanent. Never upload screenshots containing internal systems, credentials, tokens, or customer data. To remove an image, email [email protected].

常见问题

上传图片需要账号或 API Key 吗?
不需要。免费接口 POST https://img402.dev/api/free 完全免鉴权,匿名上传,响应中直接返回 url、id、contentType、sizeBytes 和 expiresAt。
上传的图片什么时候会过期?
1 MB 及以下的图片不会过期,响应里 expiresAt 为 null;超过 1 MB 用免费接口上传的文件会在 30 天后过期;10 MB 以内想长期保留需通过 x402 支付 $0.01 USDC。
怎么让大文件不失效?
上传前先用 `sips -Z 1600` 之类的命令把图片缩到 1 MB 以下,或者走 x402 token 接口以 $0.01 USDC 永久托管 10 MB 以内的图片。支持 PNG、JPEG、GIF、WebP,全局免费上传上限为每天 100,000 次。

相关技能

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

105 次安装7 星标

通过托管 OAuth 接入 GitHub REST API,覆盖仓库、Issue、PR、Commit、分支与用户等接口。

595 次安装47 星标

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

91 次安装3 星标

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

121 次安装6 星标

把内容转成适合阅读和分享的幻灯片图片,提供多套样式预设,可合并为 PPTX 或 PDF。

110 次安装2 星标

Webhook infrastructure for receiving, queuing, and delivering webhooks. Operate Hookaido webhook ingress, durable webhook queue (SQLite/Postgres), webhook de...

56 次安装1 星标