claude-api-in-prototypes
GitHub提供在HTML原型中直接调用Claude API的内置助手,无需SDK或密钥。支持文本与消息数组格式,具备模型配置、工具调用及循环执行能力,适用于快速原型开发中的AI功能集成。
Trigger Scenarios
Install
npx skills add asgeirtj/system_prompts_leaks --skill claude-api-in-prototypes -g -y
SKILL.md
Frontmatter
{
"name": "claude-api-in-prototypes",
"description": "Call Claude from your HTML artifacts via window.claude.complete",
"user-invocable": true
}
Claude API in prototypes
Your HTML artifacts can call Claude via a built-in helper. No SDK or API key needed.
<script>
(async () => {
const text = await window.claude.complete("Summarize this: ...");
// or with a messages array:
const text2 = await window.claude.complete({
messages: [{ role: 'user', content: '...' }],
});
})();
</script>
Calls default to claude-haiku-4-5 with a 1024-token output cap. The body may also set model (haiku/sonnet families only), max_tokens (up to 32000), system, tool_choice, and client tools — standard Messages API shapes, except each tool also carries run: async (input) => string and the helper executes tool calls in-page and loops (max 8 model calls), resolving with the final text. Handler throws become is_error tool_results. Server tools (web search etc.) are rejected; no streaming; rate-limited 15 calls/minute per user, loop iterations included. Shared artifacts run under the viewer's quota.
Version History
- 481967c Current 2026-08-20 17:02


