Anthropic Messages API → AWS Bedrock proxy, built with workers-rs (WASM). Receives standard Anthropic-format requests and forwards them to Bedrock Claude models with SigV4 signing. Zero logging.
POST https://<worker-domain>/v1/messages?caching=true
x-api-key: <accessKeyId>:<secretAccessKey>:<region> (IAM)
or <bearerApiKey>:<region> (Bedrock API key)
content-type: application/json
body: Anthropic Messages format, plus "model": "<Bedrock modelId or inference profile ARN>"
modelis removed from the body and moved into the Bedrock URL path (percent-encoded, so ARNs work).anthropic_version: "bedrock-2023-05-31"is injected.stream: true→/invoke-with-response-stream; the AWSvnd.amazon.eventstreambinary framing is re-encoded as SSE (event: <type>\ndata: <json>\n\n), matching Anthropic's streaming shape.
?caching=true— injectcache_control: {type:"ephemeral"}breakpoints:- last text block of the
systemarray (shared system/character prefix) - last text block of the two most recent assistant messages (rolling conversation cache)
- 3 breakpoints max, within Anthropic's 4-breakpoint limit.
Verify cache hits via
usage.cache_creation_input_tokens/usage.cache_read_input_tokensin the response.
- last text block of the
?thinking=adaptive|enabled&thinkingBudget=N— extended thinking passthrough.?effort=low|medium|high|xhigh|max—output_config.effortpassthrough.
No serviceTier/flex support (removed intentionally; some models reject it).
npx wrangler deploy(wrangler deploy runs cargo install worker-build && worker-build --release
via the [build] command in wrangler.toml.)
curl -s 'https://<worker>/v1/messages?caching=true' \
-H 'x-api-key: AKIA...:SECRET...:us-west-2' \
-H 'content-type: application/json' \
-d '{
"model": "us.anthropic.claude-opus-4-6-v1",
"max_tokens": 256,
"system": [{"type":"text","text":"<long shared prefix>"}],
"messages": [{"role":"user","content":"hello"}]
}' | jq .usage