Skip to main content

claude-local

A lightweight local emulator for the Anthropic Claude API, built for testing and local development.

Install it as a LocalStack extension to intercept Claude API calls within your LocalStack-powered test environment — no API key, no network, no credits consumed.

Quick start

LocalStack extension

# Install into a running LocalStack instance
pip install localstack-claude
localstack extensions install localstack-claude

# Or dev mode
make ls-dev

Then point your SDK at:

ANTHROPIC_BASE_URL=http://claude.localhost.localstack.cloud:4566
ANTHROPIC_API_KEY=test-key

API coverage

Endpoint Status
POST /v1/messages ✅
POST /v1/messages (streaming) ✅
GET /v1/models ✅
GET /v1/models/{id} ✅
POST /v1/messages/batches 🔜

Supported models

All current Claude models are recognized (by versioned ID or alias):

  • claude-opus-4-7 / claude-opus-4-7-20250514
  • claude-sonnet-4-6 / claude-sonnet-4-6-20250514
  • claude-haiku-4-5 / claude-haiku-4-5-20251001
  • claude-3-5-sonnet-20241022, claude-3-5-haiku-20241022
  • claude-3-opus-20240229, claude-3-sonnet-20240229, claude-3-haiku-20240307

Response behaviour

The emulator does not call a real LLM. It returns a deterministic response that can be configured:

# Environment variable (set before startup)
CLAUDE_LOCAL_RESPONSE="My custom response"

# Runtime override (POST to the control plane)
curl -s -X POST http://localhost:5002/_claude/config \
  -H "Content-Type: application/json" \
  -d '{"response": "My custom response"}'

Tool use

Force a tool call response by sending the X-Claude-Local-Tool: <tool_name> header, or by setting tool_choice to {"type": "any"} in the request.

Snapshot testing

claude-local ships with snapshot tests that record real Anthropic API responses and verify the emulator produces structurally identical output (using localstack-snapshot).

# Install deps
pip install -e ".[dev,snapshot]"

# Record real API responses
ANTHROPIC_API_KEY=sk-ant-... pytest -m snapshot --snapshot-update

# Verify emulator parity (no key needed)
pytest -m snapshot

Development

make install-dev   # install with dev deps
make test          # run all tests
make run           # start emulator on port 5002
make lint          # ruff check

License

Apache 2.0

Metadata

Release files for localstack-claude 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for localstack-claude 0.1.0
File Size Uploaded Provenance Actions
localstack_claude-0.1.0.tar.gz 26.9 kB Without provenance Details for localstack_claude-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for localstack-claude 0.1.0
File Interpreter ABI Platform Actions
localstack_claude-0.1.0-py3-none-any.whl Python 3 none any Details for localstack_claude-0.1.0-py3-none-any.whl

Total release size: 44.3 kB

Release files / localstack_claude-0.1.0.tar.gz

Download URL localstack_claude-0.1.0.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
389678907f42f8f2bcd0cbaceb7cfe596cd12f9bc27bb4526f59344f44a3e624
BLAKE2b-256 checksum
How to use checksums
e34b4e29f009e109a7d1d9875f0a1d09fda81dba6875dfc4a618a013333eed55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / localstack_claude-0.1.0-py3-none-any.whl

Download URL localstack_claude-0.1.0-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd14a2f1e1b28377f14a7984ccfa8858fe744272a65472d47b18d9ea9e439364
BLAKE2b-256 checksum
How to use checksums
751a3227b5b7eeae3d042add39141d4496d2d4875cc0e0a8bea980c5286c1c82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for localstack-claude 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page