客户端工具

PicFast 提供扁平上传端点 /api/v1/flat/upload,返回简洁的 JSON 响应,非常适合对接第三方上传客户端。以下工具均使用同一接口。

VS Code 插件

官方 PicFast Image Uploader 插件(atbeta.picfast)让你在 VS Code 中直接上传图片。可从 VS Code Marketplace 安装。

功能

  • CodeLens — 在 .md.mdx 文件中,每个本地图片引用上方会出现可点击的上传链接
  • 批量上传 — 在文件中右键选择「上传全部本地图片」一键替换所有引用
  • 快捷键Ctrl+Alt+U / Cmd+Alt+U 批量上传,Ctrl+Alt+V / Cmd+Alt+V 单张上传
  • 双语界面(英文 + 简体中文)

配置

在 VS Code 设置中(Ctrl+, / Cmd+,):

{
  "picfast.baseUrl": "https://picfast.example.com",
  "picfast.apiToken": "img_xxxxxxxx"
}

若不设置 picfast.apiToken,插件将以游客模式运行(需要在实例上启用游客上传)。

CLI 命令行工具

picfast 命令行工具让你在终端里直接上传图片。通过 npm 安装:

npm install -g picfast

或无需安装直接运行:

npx picfast screenshot.png

用法

# 设置服务器地址和 API Token
picfast config set url "https://picfast.example.com"
picfast config set token "img_xxxxxxxx"

# 上传图片
picfast screenshot.png

# 以 Markdown 格式输出
picfast --format markdown screenshot.png

# 以 Markdown 格式输出(短参数)
picfast -m screenshot.png

CLI 支持 darwinlinuxwindowsamd64arm64 架构。npm 包安装时自动下载对应平台的二进制文件。npm 包地址:picfast

PicGo / PicList

  1. 安装 PicGo 或 PicList,在插件设置中搜索并安装 web-uploader 插件。
  2. 在图床设置中选择「自定义 Web 图床」,填入下方配置。
{
  "picBed": {
    "uploader": "picgo-plugin-web-uploader",
    "picgo-plugin-web-uploader": {
      "url": "https://picfast.example.com/api/v1/flat/upload",
      "paramName": "file",
      "jsonPath": "url",
      "customHeader": "{\"Authorization\": \"Bearer <YOUR_API_TOKEN>\"}"
    }
  }
}

uPic

在 uPic 中选择「自定义」图床,按以下配置填写:

字段
URLhttps://picfast.example.com/api/v1/flat/upload
MethodPOST
File Fieldfile
HeaderAuthorization: Bearer <YOUR_API_TOKEN>
URL Path["url"]
Domainhttps://picfast.example.com

Dropshare

在 Dropshare 中选择 Custom API 连接,按以下配置填写:

字段
Upload URLhttps://picfast.example.com/api/v1/flat/upload
MethodPOST
Content Typemultipart/form-data
Form Fieldfile
Header{"Authorization": "Bearer <YOUR_API_TOKEN>"}
Response Content TypeJSON
URL to file%url%

Obsidian

安装社区插件 Image auto upload,选择 PicGo 作为上传服务。粘贴到笔记中的图片将自动上传至 PicFast 并替换为返回的 URL。

API Token

在 PicFast 管理后台的「设置 → API Token」中创建。Token 以 img_ 为前缀,支持权限范围限定(如仅允许上传)。将 Token 填入以上所有工具的 Authorization: Bearer 请求头中。