# Anthropic Messages API Twin — anthropic.twins.la A digital twin of the public Anthropic Messages API. Synthetic responses only — the twin never calls api.anthropic.com. The shape matches the real API verbatim, so consumer SDKs work without modification. ## Authentication Twin Plane: HTTP Basic (tenant_id:tenant_secret) Bootstrap a tenant first: POST /_twin/tenants -> {tenant_id, tenant_secret} Twin Plane Admin: Bearer token (set by deployment owner) Authorization: Bearer Or: X-Twin-Admin-Token: Provider (data plane): x-api-key: sk-ant-twin-... (mint via POST /_twin/accounts) anthropic-version: 2023-06-01 (any value accepted) Optional: anthropic-beta: prompt-caching-2024-07-31 anthropic-beta: extended-thinking-2025-01-15 ## Key Endpoints Twin Plane (no auth): GET /_twin/health GET /_twin/scenarios GET /_twin/settings GET /_twin/references GET /_twin/agent-instructions POST /_twin/tenants Twin Plane (Basic tenant_id:tenant_secret): POST /_twin/accounts — kind=api_key — returns {api_key} once GET /_twin/accounts — list api keys (masked) GET /_twin/messages — message history for this tenant GET /_twin/logs POST /_twin/feedback GET /_twin/feedback Provider (x-api-key + anthropic-version): POST /v1/messages — full or SSE streaming via stream:true POST /v1/messages/count_tokens GET /v1/models GET /v1/models/ ## Quick Start (local) 1. pip install twins-anthropic twins-anthropic-local python -m twins_anthropic_local 2. Bootstrap a tenant: curl -X POST http://localhost:8080/_twin/tenants \ -H "Content-Type: application/json" \ -d '{"friendly_name": "Dev"}' # -> { tenant_id, tenant_secret } 3. Mint an api key: curl -X POST http://localhost:8080/_twin/accounts \ -u "TENANT_ID:TENANT_SECRET" \ -H "Content-Type: application/json" \ -d '{"kind":"api_key","friendly_name":"Demo Key"}' # -> { api_key, api_key_id, ... } 4. Call the Messages API: curl -X POST http://localhost:8080/v1/messages \ -H "x-api-key: $API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{"model":"claude-3-5-sonnet-latest","max_tokens":64, "messages":[{"role":"user","content":"hi"}]}' # -> { id, type:"message", role:"assistant", content:[{type:"text",...}], ... } ## Reference GitHub: https://github.com/twins-la/anthropic Project overview: https://twins.la All twins: https://github.com/twins-la/twins-la