Building a Self-Service LLM Gateway with Amazon Bedrock and LiteLLM
An AWS Machine Learning blog post describes a pattern for giving developers self-service access to foundation models through an LLM gateway. LiteLLM runs on AWS Fargate and exposes an OpenAI-compatible API in front of Amazon Bedrock Application Inference Profiles. Developers receive their own API keys and point tools such as Claude Code, Continue, and Cursor at a single base URL. Platform, finance, and security teams gain per-user spend limits, cost attribution, latency monitoring, and consistent access control. The design uses RDS PostgreSQL, ElastiCache for Valkey, Secrets Manager, CloudWatch, and Langfuse, with Claude Sonnet and Haiku as examples. Self-service key issuance requires LiteLLM Enterprise.
According to the AWS Machine Learning Blog, organizations that want to offer AI coding assistants to developers face a familiar tension: developers want minimal setup, while platform, finance, and security teams need visibility and control. The post proposes a centrally managed LLM gateway that sits between coding tools and Amazon Bedrock, giving each group what it needs without burdening developers.
Core architecture
The pattern uses LiteLLM, an open-source proxy, to present an OpenAI-compatible API in front of Amazon Bedrock. LiteLLM runs as a container on AWS Fargate with target-tracking auto scaling on CPU utilization. Traffic reaches it through Amazon Route 53, Amazon CloudFront, and an Application Load Balancer, and each developer authenticates with a personal API key.
Supporting services handle state and secrets. An Amazon RDS PostgreSQL database stores virtual-key metadata and spend tracking. Amazon ElastiCache for Valkey provides response caching and coordinates rate limiting across Fargate tasks. AWS Secrets Manager holds credentials, and Amazon CloudWatch captures requests-per-minute and tokens-per-minute metrics along with quota alarms. Langfuse, an open-source observability tool, adds prompt-level telemetry, latency tracking, and debugging that complement infrastructure metrics.
LiteLLM invokes Amazon Bedrock using a scoped IAM task role, so developers never interact with Bedrock directly. A lightweight portal, which can integrate with corporate single sign-on, lets operations engineers define spend policy while developers provision their own keys within those limits.
Configuration walkthrough
On the developer side, setup is a single change: set the coding tool's provider to OpenAI-compatible, enter the gateway base URL, add a personal key, and choose a model name. Because the protocol is standard, tools including Claude Code, Continue, and Cursor can use the same configuration. The gateway layer then lets administrators swap models, add fallbacks, or migrate providers without touching developer settings.
On the gateway side, a LiteLLM YAML file maps friendly model names, such as a Claude Sonnet and a Claude Haiku identifier, to Bedrock application inference profile ARNs. The post raises an important caveat: when the model is a raw inference-profile ARN, LiteLLM cannot find it in its built-in cost map and defaults cost to zero. That would leave per-key spend at zero and budgets would never be enforced, so per-token input and output costs must be set explicitly in the model info. The sample configuration also sets a rolling seven-day budget window, parallel request limits, timeouts tuned per model (longer for extended thinking), and Redis-protocol caching pointed at Valkey. Master key and database URL should be injected as environment variables from Secrets Manager rather than hardcoded.
Inference profiles and cross-Region inference
Amazon Bedrock Application Inference Profiles create named endpoints per model, giving quota isolation and fine-grained IAM control. They also provide an abstraction between LiteLLM configuration and Bedrock model versioning, and they allow cost attribution. The profiles are managed through AWS CDK.
The post also discusses cross-Region inference (CRIS), which routes requests to Regions with available capacity and broadens model selection. For this pattern, AWS recommends Global cross-Region inference when the chosen models support it and organizational policy permits processing across commercial Regions worldwide, noting potential pricing benefits. Geographic CRIS keeps processing within a defined area, such as US-only Regions, for stricter data residency needs.
Licensing considerations
The LiteLLM AI Gateway is open source and suitable for small pilots, and LiteLLM documents it as free for up to five users, with a license required beyond that. Enterprise adds SSO, audit logs, delegated admin roles, and support. Notably, the free tier supports virtual keys, but the self-service key issuance described in the post requires Enterprise. The post also omits Amazon Bedrock Guardrails for simplicity, though it advises including responsible AI controls such as content filtering and grounding before production.
Industry implications
The pattern reflects a broader enterprise trend: as coding assistants spread, companies want a governance layer that decouples developer tools from model providers. An OpenAI-compatible gateway reduces vendor lock-in for tools like Cursor and Continue, while per-user budgets address the runaway token costs agentic coding tools can generate. It also strengthens Amazon Bedrock's position as the model backend for Anthropic's Claude in enterprise environments, and it highlights LiteLLM and Langfuse as de facto open-source components in the LLM operations stack.