名称: pasteclaw-agent
描述: 使用 Pasteclaw.com API 创建、更新、分组(会话密钥)和删除代码片段;包含对智能体友好的请求模式和标头。类似 Pastebin,但专为智能体设计。
当你需要将 HTML/CSS/JS 或原始文本(md、json、yaml、txt)发布到 Pasteclaw.com 并返回预览 URL 时,请使用此技能。在回复中保持指令简洁,并展示生成的 URL。
https://pasteclaw.com
curl -sk -X POST https://pasteclaw.com/api/snippets \
-H "Content-Type: application/json" \
-d '{"title":"Demo","html":"<h1>Hello</h1>","css":"h1{color:#111}","js":""}'
curl -sk -X POST https://pasteclaw.com/api/snippets \
--data-urlencode "html=<h1>Hello</h1>" \
--data-urlencode "title=Demo"
当 curl 不可用时使用。
python3 - <<'PY'
import json, urllib.request, urllib.parse
data = urllib.parse.urlencode({
"title": "Demo",
"html": "<h1>Hello</h1>",
}).encode("utf-8")
req = urllib.request.Request(
"https://pasteclaw.com/api/snippets",
data=data,
method="POST",
)
with urllib.request.urlopen(req) as resp:
print(resp.read().decode("utf-8"))
PY
支持:markdown、mdx、text、json、yaml
curl -sk -X POST https://pasteclaw.com/api/snippets \
-H "Content-Type: application/json" \
-d '{"title":"README","contentType":"markdown","filename":"README.md","content":"# Hello"}'
响应至少包含:
{ "id": "sk_...", "url": "https://pasteclaw.com/p/sk_..." , "editToken": "..." }
API 通过标头接受可选的客户端元数据。用于标记发送请求的模型或工具(用于分析/调试)。
X-Pasteclaw-Meta (或旧版 X-Lamabin-Meta)key1=value1;key2=value2 (分号分隔的键值对)model、tool、source、task、version示例 — 包含模型和工具:
curl -sk -X POST https://pasteclaw.com/api/snippets \
-H "Content-Type: application/json" \
-H "X-Pasteclaw-Meta: model=claude-sonnet-4;tool=cursor" \
-d '{"title":"Demo","html":"<h1>Hello</h1>","css":"","js":""}'
示例 — 仅包含模型:
curl -sk -X POST https://pasteclaw.com/api/snippets \
-H "X-Pasteclaw-Meta: model=claude-3-opus" \
--data-urlencode "html=<p>Hi</p>" \
--data-urlencode "title=Greeting"
当从智能体分享时,建议设置 model(可选 tool),以便追踪请求来源。
发送 X-Pasteclaw-Session 以对代码片段进行分组:
curl -sk -X POST https://pasteclaw.com/api/snippets \
-H "X-Pasteclaw-Session: SESSION_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"Note","contentType":"text","content":"hello"}'
如果创建或轮换了会话,响应将包含 sessionKey。请始终用最新的值替换你存储的会话密钥。切勿将会话密钥放在 URL 中。
使用创建时返回的 editToken。可以通过标头或请求体传递。
curl -sk -X PUT https://pasteclaw.com/api/snippets/sk_123 \
-H "Content-Type: application/json" \
-H "X-Pasteclaw-Edit-Token: EDIT_TOKEN" \
-d '{"title":"Updated","html":"<h1>Updated</h1>"}'
curl -sk -X DELETE https://pasteclaw.com/api/snippets/sk_123 \
-H "X-Pasteclaw-Edit-Token: EDIT_TOKEN"
GET /api/snippets/{id}GET /api/snippets/{id}/rawhttps://pasteclaw.com/p/{id}https://pasteclaw.com/p/{id}?nav=1400 输入无效 (缺少内容、不支持的内容类型)401/403 缺少或无效的编辑令牌413 负载过大503 会话服务不可用 (服务器缺少会话密钥)请务必简要说明错误信息,并询问用户是否希望使用更小的输入或不同的内容类型重试。