Agent skill · writing content · jeremylongshore
clade-model-inference
Stream Claude responses, use system prompts, handle multi-turn conversations,
Why this skill is useful
Provides specific implementation patterns for streaming and structured output using the Claude Messages API that the AI wouldn't reliably generate on its own.
What it needs
Requires anthropic account access. About 2k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.
What this skill does
Anthropic Messages API — Streaming & Advanced Patterns Overview The Messages API is the only inference endpoint. Every Claude interaction goes through client.messages.create(). This skill covers streaming, system prompts, vision, and structured output. Prerequisites Completed clade-install-auth Familiarity with clade-hello-world Instructions Step 1: Streaming Responses Step 2: Vision — Sending Images Step 3: JSON / Structured Output Python Streaming Output Non-streaming: Full Message object with content, usage, stopreason Streaming events: messagestart — message metadata contentblockstart — new content block beginning contentblockdelta — incremental text (textdelta) or tool input (inputjsondelta) messagedelta — final stopreason and usage messagestop — stream complete Error Handling Error Cause Solution ------- ------- ---------- overloadederror (529) Anthropic API temporarily overloaded Retry with exponential backoff; use client.messages.create with built-in retries ratelimiterror (429) Exceeded RPM or TPM Check retry-after header. See clade-rate-limits invalidrequesterror Image too large or bad format Max 20 images per request. Supported: PNG, JPEG, GIF, WebP. Max 5MB each Key Parameters Parameter Type Description ----------- ------ ------------- model string Required. Model ID (e.g. claude-sonnet-4-20250514) maxtokens int Required. Maximum output tokens (1–8192 typical) messages array Required. Alternating user/assistant messages system string Optional. System prompt for behavior/persona temperature float Optional. 0.0–1.0, default 1.0 topp float Optional. Nucleus sampling threshold stopsequences string[] Optional. Custom stop strings stream boolean Optional. Enable SSE streaming Examples See Step 1 (streaming), Step 2 (vision with base64 images), and Step 3 (structured JSON output) above. Python streaming example included. Resources Messages API Streaming Vision Next Steps See clade-embeddings-search for tool use and function calling patterns.
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/clade-model-inference