- TypeScript 100%
Upstreams the CLI methods from swamp-club's repo-local claude_cli.ts into the base @keeb/anthropic/claude model: - cli_generate: headless `claude -p` with no tools in an empty temp dir, authenticated by the CLI login; optional jsonSchema for structured output, kept on result.structured - cli_generate_many: bounded-concurrency batch, one cliResult per request, failures recorded with ok:false; duplicate keys are rejected apiKey is now optional (only generate needs it) and marked sensitive; no-op upgrade to 2026.10.15.1. generate checks the response shape, both backends log entry/completion, and claude_test.ts covers both backends with a stubbed fetch and a fake claude on PATH. README and the bundled skill are rewritten for current swamp commands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .claude/skills/anthropic | ||
| extensions/models | ||
| tests/property | ||
| .gitignore | ||
| .swamp.yaml | ||
| CLAUDE.md | ||
| LICENSE.txt | ||
| manifest.yaml | ||
| README.md | ||
@keeb/anthropic
Swamp extension for generating text with Anthropic Claude, via the Messages API or the local claude CLI.
Models
@keeb/anthropic/claude
| Method | Backend | Description |
|---|---|---|
generate |
Messages API | Generate text from prompt. Requires apiKey. |
cli_generate |
claude CLI |
Generate text from prompt; optional jsonSchema for structured output (lands in structured), effort, timeoutSeconds. |
cli_generate_many |
claude CLI |
Run a batch of requests ({key, prompt, systemPrompt?, jsonSchema?}) with bounded concurrency; one cliResult per request. |
Global arguments: apiKey (only for generate), model, systemPrompt, maxTokens (only for generate)
The cli_* methods run claude -p headless with no tools, in an empty temp directory (so no repo CLAUDE.md or settings leak in), authenticated by the CLI's own login. They never read apiKey. Claude Code must be installed and logged in on the host that runs the method.
Install
swamp extension pull @keeb/anthropic
Usage
With an API key:
swamp model create @keeb/anthropic/claude claude --global-arg model=claude-opus-5-5
swamp behavior run claude generate --input prompt="Summarize the release notes"
With the local claude login (no key):
swamp behavior run claude cli_generate --input prompt="Summarize the release notes"
generate and cli_generate write the result resource (response, structured?, model, timestamp), readable downstream via data.latest("claude", "result").attributes.response. cli_generate_many writes cliResult instances named cli-<batch>-<key> with ok, response, structured, error, costUsd, and durationMs; a failed request is recorded with ok: false rather than failing the batch.
License
MIT