Files
librechat.ai/content/docs/configuration/pre_configured_ai/bedrock_inference_profiles.mdx
Danny Avila 9e1a0db393 rel/v0.8.3-rc1-v2 (#504)
* chore: update GitHub Actions workflow to use latest action version for improved stability

* chore: update roadmap references and enhance documentation for AWS Bedrock inference profiles

- Updated footer menu and card icons to reflect the 2026 roadmap.
- Adjusted default values in changelog and configuration documentation for `maxRecursionLimit`.
- Added comprehensive documentation for AWS Bedrock inference profiles, including setup, configuration, and examples.
- Introduced Agents API documentation for programmatic access to LibreChat agents.
- Enhanced existing documentation for clarity and consistency across various sections.

* feat: release Config v1.3.4 with new features and updates

- Introduced `create` field in `interface.prompts` and `interface.agents` for enhanced user control.
- Added `interface.remoteAgents` configuration for managing remote agent permissions.
- Updated `endpoints.bedrock` with `models` and `inferenceProfiles` for better customization.
- Included Moonshot as a known endpoint for AI integration.
- Introduced new agent capabilities: `deferred_tools` and `programmatic_tools`.
- Removed deprecated `forcePrompt` setting from configurations.
- Updated default model lists and added support for new models.
- Enhanced `modelSpecs` with `artifacts` field and `effort` parameter for Anthropic models.

* refactor: update BlogHeader to use usePathname for route handling

- Replaced useRouter with usePathname for improved routing in BlogHeader component.
- Simplified page retrieval logic by directly using pathname for matching routes.

* feat: add changelog for v0.8.3-rc1 release with new features and fixes

- Introduced several enhancements including event-driven lazy tool loading, token usage tracking, and programmatic tool calling UI.
- Added support for new models and providers, including Claude Opus 4.6 and Moonshot.
- Implemented various bug fixes and improvements for better user experience and performance.

* chore: nextjs artifact

* first draft roadmap

* feat: enhance BlogPage with Open Graph image support and layout improvements

- Added support for Open Graph images in blog entries to improve visual presentation.
- Refactored article layout for better structure and readability, including adjustments to the display of metadata and content.
- Updated styles for improved user experience during hover interactions.

* feat: enhance BlogPage with date formatting and layout adjustments

- Added a new dateFormatted field to entries for improved date display.
- Implemented a date formatter for consistent date presentation.
- Refactored article layout to use a grid system for better responsiveness.
- Updated styles for article links and metadata for enhanced user experience.

* feat: add responsive image sizes to BlogPage for improved layout

- Included sizes attribute for Open Graph images to enhance responsiveness on different screen sizes.

* feat: update feature titles and descriptions for clarity

- Changed titles for "Forking Messages and Conversations" to "Forking Chats" and "Memory" to "User Memory" for better alignment with functionality.
- Updated descriptions for "Message Search" and "Upload as Text" to enhance understanding of features.

* chore: update configuration version to 1.3.4 across multiple documentation files

- Updated the version number in `librechat.yaml` examples to reflect the latest release (1.3.4) in various configuration and feature documentation files.

* feat: enhance User Memory documentation for clarity and detail

- Updated the description to clarify that User Memory is a key/value store that operates on every chat request.
- Added a callout to distinguish between key/value storage and conversation memory.
- Expanded on the functionality of the memory agent, including its execution process and user control features.
- Introduced a section on future improvements for the memory agent's efficiency and relevance.

* feat: update title and description for NGINX documentation

- Changed the title from "Secure Deployment with Nginx" to "NGINX" for brevity.
- Updated the description to provide a clearer overview of the guide's purpose in securing LibreChat deployment with Nginx as a reverse proxy and HTTPS.

* feat: update 2026 roadmap with key accomplishments and future plans

- Celebrated LibreChat's 3rd anniversary with a summary of achievements from 2025, including growth in GitHub stars and community engagement.
- Clarified the timeline for open-sourcing the Code Interpreter API by the end of Q1.
- Revised notes on the v1 Admin Panel's core capabilities and community-driven items for better clarity and detail.

* feat: enhance blog and author components with Open Graph image support

- Added optional `ogImagePosition` field to blog entries for better image placement control.
- Updated BlogPage and individual post pages to utilize the new `ogImagePosition` for responsive image styling.
- Improved Author component to conditionally render author images based on availability.
- Updated 2026 roadmap blog post with a new Open Graph image and position for enhanced visual appeal.

* feat: enhance CardComponent with icon support and layout improvements

- Added optional `icon` prop to CardComponent for better visual representation.
- Updated CardComponent layout to include icon alongside title and children.
- Improved styling for CardComponent and CardsBase for enhanced responsiveness and user experience.

* feat: update 2026 roadmap with detailed focus areas and community-driven items

- Added sections for Q1 and Q2 focus areas, outlining major initiatives like Dynamic Context and Admin Panel.
- Enhanced clarity on community-driven items and their prioritization based on GitHub reactions.
- Included hiring information to attract full-stack developers for ongoing project support.
- Improved overall structure and readability of the roadmap content.

* fix: improve icon styling in CardCompat component for better responsiveness

- Updated icon container styling to ensure consistent height and width for SVG icons.
- Enhanced layout of CardCompat to maintain visual integrity across different screen sizes.

* chore: update .gitignore to include next-env.d.ts for TypeScript support

* fix: correct import statement formatting in next-env.d.ts for consistency

* fix: refine wording in 2026 roadmap for clarity

- Updated the description of agentic workflows to emphasize a lean approach to context pulling.
- Enhanced overall readability of the section on Dynamic Context.

* feat: expand Admin Panel section in 2026 roadmap with detailed capabilities

- Added comprehensive descriptions of the Admin Panel's core functionalities, including GUI for configuration, configuration profiles, group and role management, and access controls.
- Clarified the development approach for the Admin Panel, emphasizing ongoing iteration and community involvement.
- Updated note on the Admin Panel's prioritization and requirements following the ClickHouse acquisition.

* feat: add TrackedLink component for enhanced analytics tracking

- Introduced a new TrackedLink component that integrates Vercel analytics to track user interactions with links.
- The component allows for customizable link properties while ensuring tracking of clicks with relevant metadata.
- Updated CardCompat to utilize the new TrackedLink for improved user engagement tracking.

* feat: enhance blog post layout and introduce TrackedAnchor component for link tracking

- Wrapped the InlineTOC component in a div for improved spacing in blog posts.
- Added a new TrackedAnchor component to facilitate link tracking with Vercel analytics, allowing for customizable anchor elements.
- Updated mdx-components to utilize TrackedAnchor for enhanced link interaction tracking.

* feat: update TrackedLink and TrackedAnchor components for external link handling

- Enhanced the TrackedLink component to differentiate between internal and external links, using Next.js Link for internal navigation.
- Introduced a utility function to determine if a link is external, improving tracking accuracy.
- Updated TrackedAnchor to utilize the same external link handling logic for consistency in link tracking.

* feat: add uncaught exception handling section to dotenv configuration documentation

- Introduced a new section on uncaught exception handling, explaining how to override the default behavior to keep the app running after exceptions.
- Added an option table detailing the `CONTINUE_ON_UNCAUGHT_EXCEPTION` configuration.
- Included a warning callout advising against using this feature in production environments.

* feat: add ESLint rule for unused variables in TypeScript

- Introduced a new ESLint rule to enforce the handling of unused variables, allowing for specific patterns to be ignored.
- This enhancement aims to improve code quality by ensuring that developers are alerted to potentially unnecessary variables while maintaining flexibility in naming conventions.

* fix: update copyright year in LICENSE file to 2026

* feat: update footer menu link and add 2026 roadmap blog post

- Changed the roadmap link in the FooterMenu component to point to the new blog post.
- Introduced a new blog post detailing the 2026 roadmap for LibreChat, outlining key features and focus areas for the upcoming year.
- Updated the import statement in next-env.d.ts for consistency with the new types directory.

* fix: update import path in next-env.d.ts and add comment block in agents.mdx

- Changed the import statement in next-env.d.ts to reference the new development types directory.
- Added a comment block in agents.mdx to indicate that the Programmatic Tool Calling feature is in private beta.

* fix: remove unused ESLint disable comment in context.tsx

* chore: update blog
2026-02-18 21:46:20 -05:00

465 lines
15 KiB
Plaintext

---
title: Bedrock Inference Profiles
icon: Bot
description: Configure and use AWS Bedrock custom inference profiles with LibreChat for cross-region load balancing, cost allocation, and compliance controls.
---
This guide explains how to configure and use AWS Bedrock custom inference profiles with LibreChat, allowing you to route model requests through custom application inference profiles for better control, cost allocation, and cross-region load balancing.
## Overview
AWS Bedrock inference profiles allow you to create custom routing configurations for foundation models. When you create a custom (application) inference profile, AWS generates a unique ARN that doesn't contain model name information:
```
arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123def456
```
LibreChat's inference profile mapping feature allows you to:
1. Map friendly model IDs to custom inference profile ARNs
2. Route requests through your custom profiles while maintaining model capability detection
3. Use environment variables for secure ARN management
## Why Use Custom Inference Profiles?
| Benefit | Description |
|---------|-------------|
| **Cross-Region Load Balancing** | Automatically distribute requests across multiple AWS regions |
| **Cost Allocation** | Tag and track costs per application or team |
| **Throughput Management** | Configure dedicated throughput for your applications |
| **Compliance** | Route requests through specific regions for data residency |
| **Monitoring** | Track usage per inference profile in CloudWatch |
## Prerequisites
Before you begin, ensure you have:
1. **AWS Account** with Bedrock access enabled
2. **AWS CLI** installed and configured
3. **IAM Permissions**:
- `bedrock:CreateInferenceProfile`
- `bedrock:ListInferenceProfiles`
- `bedrock:GetInferenceProfile`
- `bedrock:InvokeModel` / `bedrock:InvokeModelWithResponseStream`
4. **LibreChat** with Bedrock endpoint configured (see [AWS Bedrock Setup](/docs/configuration/pre_configured_ai/bedrock))
## Creating Custom Inference Profiles
> **Important**: Custom inference profiles can only be created via API (AWS CLI, SDK, etc.) and cannot be created from the AWS Console.
### Method 1: AWS CLI (Recommended)
#### Step 1: List Available System Inference Profiles
```bash
# List all inference profiles
aws bedrock list-inference-profiles --region us-east-1
# Filter for Claude models
aws bedrock list-inference-profiles --region us-east-1 \
--query "inferenceProfileSummaries[?contains(inferenceProfileId, 'claude')]"
```
#### Step 2: Create a Custom Inference Profile
```bash
# Get the system inference profile ARN to copy from
export SOURCE_PROFILE_ARN=$(aws bedrock list-inference-profiles --region us-east-1 \
--query "inferenceProfileSummaries[?inferenceProfileId=='us.anthropic.claude-3-7-sonnet-20250219-v1:0'].inferenceProfileArn" \
--output text)
# Create your custom inference profile
aws bedrock create-inference-profile \
--inference-profile-name "MyApp-Claude-3-7-Sonnet" \
--description "Custom inference profile for my application" \
--model-source copyFrom="$SOURCE_PROFILE_ARN" \
--region us-east-1
```
#### Step 3: Verify Creation
```bash
# List your custom profiles
aws bedrock list-inference-profiles --type-equals APPLICATION --region us-east-1
# Get details of a specific profile
aws bedrock get-inference-profile \
--inference-profile-identifier "arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123" \
--region us-east-1
```
### Method 2: Python Script
```python
import boto3
AWS_REGION = 'us-east-1'
def create_inference_profile(profile_name: str, source_model_id: str):
"""
Create a custom inference profile for LibreChat.
Args:
profile_name: Name for your custom profile
source_model_id: The system inference profile ID to copy from
(e.g., 'us.anthropic.claude-3-7-sonnet-20250219-v1:0')
"""
bedrock = boto3.client('bedrock', region_name=AWS_REGION)
profiles = bedrock.list_inference_profiles()
source_arn = None
for profile in profiles['inferenceProfileSummaries']:
if profile['inferenceProfileId'] == source_model_id:
source_arn = profile['inferenceProfileArn']
break
if not source_arn:
raise ValueError(f"Source profile {source_model_id} not found")
response = bedrock.create_inference_profile(
inferenceProfileName=profile_name,
description=f'Custom inference profile for {profile_name}',
modelSource={'copyFrom': source_arn},
tags=[
{'key': 'Application', 'value': 'LibreChat'},
{'key': 'Environment', 'value': 'Production'}
]
)
print(f"Created profile: {response['inferenceProfileArn']}")
return response['inferenceProfileArn']
if __name__ == "__main__":
create_inference_profile(
"LibreChat-Claude-3-7-Sonnet",
"us.anthropic.claude-3-7-sonnet-20250219-v1:0"
)
create_inference_profile(
"LibreChat-Claude-Sonnet-4-5",
"us.anthropic.claude-sonnet-4-5-20250929-v1:0"
)
```
## Configuring LibreChat
### librechat.yaml Configuration
Add the `bedrock` endpoint configuration to your `librechat.yaml`. For full field reference, see [AWS Bedrock Object Structure](/docs/configuration/librechat_yaml/object_structure/aws_bedrock).
```yaml filename="librechat.yaml"
endpoints:
bedrock:
# List the models you want available in the UI
models:
- "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
- "us.anthropic.claude-sonnet-4-5-20250929-v1:0"
- "global.anthropic.claude-opus-4-5-20251101-v1:0"
# Map model IDs to their custom inference profile ARNs
inferenceProfiles:
# Using environment variable (recommended for security)
"us.anthropic.claude-3-7-sonnet-20250219-v1:0": "${BEDROCK_CLAUDE_37_PROFILE}"
# Using direct ARN
"us.anthropic.claude-sonnet-4-5-20250929-v1:0": "arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123"
# Another env variable example
"global.anthropic.claude-opus-4-5-20251101-v1:0": "${BEDROCK_OPUS_45_PROFILE}"
# Optional: Configure available regions for cross-region inference
availableRegions:
- "us-east-1"
- "us-west-2"
```
### Environment Variables
Add your AWS credentials and inference profile ARNs to your `.env` file:
```bash filename=".env"
#===================================#
# AWS Bedrock Configuration #
#===================================#
# AWS Credentials
BEDROCK_AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
BEDROCK_AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
BEDROCK_AWS_DEFAULT_REGION=us-east-1
# Optional: Session token for temporary credentials
# BEDROCK_AWS_SESSION_TOKEN=your-session-token
# Inference Profile ARNs
BEDROCK_CLAUDE_37_PROFILE=arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123
BEDROCK_OPUS_45_PROFILE=arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/def456
```
## Setting Up Logging
To verify that your inference profiles are being used correctly, enable AWS Bedrock model invocation logging.
### 1. Create CloudWatch Log Group
```bash
aws logs create-log-group \
--log-group-name /aws/bedrock/model-invocations \
--region us-east-1
```
### 2. Create IAM Role for Bedrock Logging
Create the trust policy file (`bedrock-logging-trust.json`):
```json filename="bedrock-logging-trust.json"
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "bedrock.amazonaws.com"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"aws:SourceAccount": "YOUR_ACCOUNT_ID"
},
"ArnLike": {
"aws:SourceArn": "arn:aws:bedrock:us-east-1:YOUR_ACCOUNT_ID:*"
}
}
}
]
}
```
Create the role:
```bash
aws iam create-role \
--role-name BedrockLoggingRole \
--assume-role-policy-document file://bedrock-logging-trust.json
```
Attach CloudWatch Logs permissions:
```bash
aws iam put-role-policy \
--role-name BedrockLoggingRole \
--policy-name BedrockLoggingPolicy \
--policy-document '{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:us-east-1:YOUR_ACCOUNT_ID:log-group:/aws/bedrock/model-invocations:*"
}
]
}'
```
Create S3 bucket for large data (required):
```bash
aws s3 mb s3://bedrock-logs-YOUR_ACCOUNT_ID --region us-east-1
aws iam put-role-policy \
--role-name BedrockLoggingRole \
--policy-name BedrockS3Policy \
--policy-document '{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:PutObject"],
"Resource": "arn:aws:s3:::bedrock-logs-YOUR_ACCOUNT_ID/*"
}
]
}'
```
### 3. Enable Model Invocation Logging
```bash
aws bedrock put-model-invocation-logging-configuration \
--logging-config '{
"cloudWatchConfig": {
"logGroupName": "/aws/bedrock/model-invocations",
"roleArn": "arn:aws:iam::YOUR_ACCOUNT_ID:role/BedrockLoggingRole",
"largeDataDeliveryS3Config": {
"bucketName": "bedrock-logs-YOUR_ACCOUNT_ID",
"keyPrefix": "large-data"
}
},
"textDataDeliveryEnabled": true,
"imageDataDeliveryEnabled": true,
"embeddingDataDeliveryEnabled": true
}' \
--region us-east-1
```
Verify logging is enabled:
```bash
aws bedrock get-model-invocation-logging-configuration --region us-east-1
```
## Verifying Your Configuration
### View Logs via CLI
After making a request through LibreChat, check the logs:
```bash
# Tail logs in real-time
aws logs tail /aws/bedrock/model-invocations --follow --region us-east-1
# View recent logs
aws logs tail /aws/bedrock/model-invocations --since 5m --region us-east-1
```
### What to Look For
In the log output, look for the `modelId` field:
```json
{
"timestamp": "2026-01-16T16:56:15Z",
"accountId": "123456789012",
"region": "us-east-1",
"requestId": "a8b9d8c9-87b3-41ea-8a02-e8bfdba7782f",
"operation": "ConverseStream",
"modelId": "arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123",
"inferenceRegion": "us-west-2"
}
```
**Success indicators:**
- `modelId` shows your custom inference profile ARN (contains `application-inference-profile`)
- `inferenceRegion` may vary (shows cross-region routing is working)
**If mapping isn't working:**
- `modelId` will show the raw model ID instead of the ARN
### View Logs via AWS Console
1. Open **CloudWatch** in the AWS Console
2. Navigate to **Logs** > **Log groups**
3. Select `/aws/bedrock/model-invocations`
4. Click on the latest log stream
5. Search for your inference profile ID
## Monitoring Usage
### CloudWatch Metrics
View Bedrock metrics in CloudWatch:
```bash
aws cloudwatch list-metrics --namespace AWS/Bedrock --region us-east-1
```
### AWS Console
1. **Bedrock Console** > **Inference profiles** > **Application** tab
2. Click on your custom profile
3. View invocation metrics and usage statistics
## Troubleshooting
### Common Issues
| Issue | Cause | Solution |
|-------|-------|----------|
| Model not recognized | Missing model in `models` array | Add the model ID to `models` in librechat.yaml |
| ARN not being used | Model ID doesn't match | Ensure the model ID in `inferenceProfiles` exactly matches what's in `models` |
| Env variable not resolved | Typo or not set | Check `.env` file and ensure variable name matches `${VAR_NAME}` |
| Access Denied | Missing IAM permissions | Add `bedrock:InvokeModel*` permissions for the inference profile ARN |
| Profile not found | Wrong region | Ensure you're creating/using profiles in the same region |
### Debug Checklist
1. Model ID is in the `models` array
2. Model ID in `inferenceProfiles` exactly matches (case-sensitive)
3. Environment variable is set (if using `${VAR}` syntax)
4. AWS credentials have permission to invoke the inference profile
5. LibreChat has been restarted after config changes
### Verify Config Loading
Check that your config is being read correctly by examining the server logs when LibreChat starts.
## Complete Example
### librechat.yaml
```yaml filename="librechat.yaml"
version: 1.3.4
endpoints:
bedrock:
models:
- "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
- "us.anthropic.claude-sonnet-4-5-20250929-v1:0"
- "global.anthropic.claude-opus-4-5-20251101-v1:0"
- "us.amazon.nova-pro-v1:0"
inferenceProfiles:
"us.anthropic.claude-3-7-sonnet-20250219-v1:0": "${BEDROCK_CLAUDE_37_PROFILE}"
"us.anthropic.claude-sonnet-4-5-20250929-v1:0": "${BEDROCK_SONNET_45_PROFILE}"
"global.anthropic.claude-opus-4-5-20251101-v1:0": "${BEDROCK_OPUS_45_PROFILE}"
availableRegions:
- "us-east-1"
- "us-west-2"
```
### .env
```bash filename=".env"
# AWS Bedrock
BEDROCK_AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
BEDROCK_AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
BEDROCK_AWS_DEFAULT_REGION=us-east-1
# Inference Profiles
BEDROCK_CLAUDE_37_PROFILE=arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123
BEDROCK_SONNET_45_PROFILE=arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/def456
BEDROCK_OPUS_45_PROFILE=arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/ghi789
```
### Quick Setup Script
```bash filename="setup-bedrock-profiles.sh"
#!/bin/bash
REGION="us-east-1"
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
# Create inference profiles
for MODEL in "us.anthropic.claude-3-7-sonnet-20250219-v1:0" "us.anthropic.claude-sonnet-4-5-20250929-v1:0"; do
PROFILE_NAME="LibreChat-${MODEL//[.:]/-}"
SOURCE_ARN=$(aws bedrock list-inference-profiles --region $REGION \
--query "inferenceProfileSummaries[?inferenceProfileId=='$MODEL'].inferenceProfileArn" \
--output text)
if [ -n "$SOURCE_ARN" ]; then
echo "Creating profile for $MODEL..."
aws bedrock create-inference-profile \
--inference-profile-name "$PROFILE_NAME" \
--model-source copyFrom="$SOURCE_ARN" \
--region $REGION
fi
done
# List created profiles
echo ""
echo "Your custom inference profiles:"
aws bedrock list-inference-profiles --type-equals APPLICATION --region $REGION \
--query "inferenceProfileSummaries[].{Name:inferenceProfileName,ARN:inferenceProfileArn}" \
--output table
```
## Related Resources
- [AWS Bedrock Inference Profiles Documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles.html)
- [AWS Bedrock Object Structure](/docs/configuration/librechat_yaml/object_structure/aws_bedrock) - YAML config field reference
- [AWS Bedrock Setup](/docs/configuration/pre_configured_ai/bedrock) - Basic Bedrock configuration
- [AWS Bedrock Model Invocation Logging](https://docs.aws.amazon.com/bedrock/latest/userguide/model-invocation-logging.html)