How it works
A thin gateway between Claude Code and Bedrock.
tokener implements Claude Code's official gateway protocol and runs inside your own AWS account.
The request pipeline
Every request passes through five stages. Responses stream straight back to Claude Code as SSE.
On AWS
An Application Load Balancer in front of ECS Fargate. Keys, usage and policy live in DynamoDB. Metrics go to CloudWatch, alerts to SNS.
Compute
ECS Fargate behind an ALB. Two tasks are plenty for 10 developers, with auto-scaling up to 6 at 60% CPU.
State
DynamoDB for keys, usage and policy. Policy changes reach every task within 30 seconds.
Observability
CloudWatch EMF metrics, a dashboard and alarms, with SNS e-mail alerts for team-wide spend.
Two run modes, same code
| Local | AWS | |
|---|---|---|
| Storage | SQLite | DynamoDB |
| Credentials | Your own AWS credentials or a Bedrock API key | ECS task role |
| Start | npm run local | npx cdk deploy |
Two Bedrock APIs, switchable live
Mantle
The Anthropic Messages API endpoint on Bedrock. Requests are forwarded byte for byte.
Runtime
Classic InvokeModel. The gateway translates the body, converts the AWS event stream into SSE, and calls the model through its inference profile id.
Security
The ECS task role is the only identity that can call Bedrock. Developers hold no AWS credentials.
Tokens are stored as SHA-256 hashes. Logs contain counts, the model and the session id, never prompt content.
Conversation content is never persisted. It is transformed in memory and forwarded.
A per-key allowedModels list restricts which models each developer can use.