anth-architecture-variants

Featured

Choose and implement Claude API architecture patterns for different scales: serverless, microservice, event-driven, and edge deployment. Trigger with phrases like "anthropic architecture", "claude serverless", "claude microservice design", "edge claude deployment".

AI & Automation 2,944 stars 440 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Anthropic Architecture Variants ## Overview Four validated architecture patterns for Claude API integrations at different scales and use cases. ## Variant 1: Serverless (AWS Lambda / Cloud Functions) ```python # Best for: < 100 RPM, event-driven, pay-per-invocation # lambda_function.py import anthropic import json def handler(event, context): client = anthropic.Anthropic() # Key from Lambda env var body = json.loads(event["body"]) msg = client.messages.create( model="claude-haiku-4-20250514", # Haiku for Lambda speed max_tokens=512, messages=[{"role": "user", "content": body["prompt"]}] ) return { "statusCode": 200, "body": json.dumps({ "text": msg.content[0].text, "tokens": msg.usage.input_tokens + msg.usage.output_tokens }) } ``` **Trade-offs:** Cold starts add 1-3s. Lambda timeout (15min) limits long generations. No connection pooling between invocations. ## Variant 2: Streaming Microservice (FastAPI + WebSocket) ```python # Best for: chatbots, interactive UIs, real-time responses from fastapi import FastAPI, WebSocket import anthropic app = FastAPI() client = anthropic.Anthropic() @app.websocket("/chat") async def chat_ws(websocket: WebSocket): await websocket.accept() while True: prompt = await websocket.receive_text() with client.messages.stream( model="claude-sonnet-4-20250514", max_tokens=2048, mess...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category