---
name: asgeirtj-claude-api-in-prototypes
description: "Call Claude from your HTML artifacts via window.claude.complete"
license: "CC0-1.0"
metadata:
  decimalai-skill-id: "cf901406-c9b6-4d60-8fc7-f7a7f89d67c1"
  decimalai-version-id: "628be1a3-bf81-4cb9-957a-5bb38604e53d"
  decimalai-version: "1"
  decimalai-body-sha256: "4754bc6ea39afc4f78b7f8f2ceb21cd25d7512960363096ab8cb85c13cb5a52f"
  decimalai-name: "asgeirtj/claude-api-in-prototypes"
  decimalai-format: "1"
  decimalai-invocation: "model"
  decimalai-category: "frontend"
  decimalai-source: "https://app.decimal.ai/s/asgeirtj-claude-api-in-prototypes@1/SKILL.md"
---
# Claude API in prototypes

Your HTML artifacts can call Claude via a built-in helper. No SDK or API key needed.

```html
<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.
