Skip to content

Commit 3d18d86

Browse files
committed
πŸ€– feat: improve Bedrock provider UX
- Add AWS icon for Bedrock models in chat (reusing existing aws.svg) - Parse Bedrock model names (e.g., global.anthropic.claude-sonnet-4-5-20250929-v1:0 β†’ Sonnet 4.5) - Handle both old (claude-3-5-sonnet) and new (claude-sonnet-4-5) naming formats - Show Bedrock-specific configuration help in Settings instead of API Key/Base URL fields - Add /provider bedrock suggestions with region, bedrockApiKey, accessKeyId, secretAccessKey - Support bedrockApiKey in providers.jsonc (maps to AWS_BEARER_TOKEN_BEDROCK) _Generated with mux_
1 parent f11f68c commit 3d18d86

File tree

10 files changed

+433
-137
lines changed

10 files changed

+433
-137
lines changed

β€Ždocs/models.mdβ€Ž

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,85 @@ By default, mux connects to Ollama at `http://localhost:11434/api`. To use a rem
173173
}
174174
```
175175

176+
#### Amazon Bedrock (Cloud)
177+
178+
Access Anthropic Claude and other models through AWS Bedrock:
179+
180+
- `bedrock:us.anthropic.claude-sonnet-4-20250514-v1:0`
181+
- `bedrock:us.amazon.nova-pro-v1:0`
182+
183+
Model IDs follow the Bedrock format: `[region.]vendor.model-name-version`. mux automatically parses these for display (e.g., `us.anthropic.claude-sonnet-4-20250514-v1:0` displays as "Sonnet 4").
184+
185+
**Authentication Options:**
186+
187+
Bedrock supports multiple authentication methods, tried in order:
188+
189+
1. **Bearer Token** (simplest) β€” A single API key for Bedrock access
190+
2. **Explicit Credentials** β€” Access Key ID + Secret Access Key in config
191+
3. **AWS Credential Chain** β€” Automatic credential resolution (recommended for AWS environments)
192+
193+
**Option 1: Bearer Token**
194+
195+
The simplest approach if you have a Bedrock API key:
196+
197+
```jsonc
198+
{
199+
"bedrock": {
200+
"region": "us-east-1",
201+
"bearerToken": "your-bedrock-api-key",
202+
},
203+
}
204+
```
205+
206+
Or set via environment variable:
207+
208+
```bash
209+
export AWS_REGION=us-east-1
210+
export AWS_BEARER_TOKEN_BEDROCK=your-bedrock-api-key
211+
```
212+
213+
**Option 2: Explicit AWS Credentials**
214+
215+
Use IAM access keys directly:
216+
217+
```jsonc
218+
{
219+
"bedrock": {
220+
"region": "us-east-1",
221+
"accessKeyId": "AKIA...",
222+
"secretAccessKey": "...",
223+
},
224+
}
225+
```
226+
227+
**Option 3: AWS Credential Chain (Recommended for AWS)**
228+
229+
If no explicit credentials are provided, mux uses the AWS SDK's `fromNodeProviderChain()` which automatically resolves credentials from (in order):
230+
231+
1. **Environment variables** β€” `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`
232+
2. **Shared credentials file** β€” `~/.aws/credentials` (supports profiles via `AWS_PROFILE`)
233+
3. **SSO credentials** β€” AWS IAM Identity Center (configure with `aws sso login`)
234+
4. **EC2 instance profile** β€” Automatic on EC2 instances with IAM roles
235+
5. **ECS task role** β€” Automatic in ECS containers
236+
6. **EKS Pod Identity / IRSA** β€” Automatic in Kubernetes with IAM Roles for Service Accounts
237+
238+
For region, mux checks `AWS_REGION` and `AWS_DEFAULT_REGION` environment variables, so standard AWS CLI configurations work automatically.
239+
240+
This means if you're already authenticated with AWS CLI (`aws sso login` or configured credentials), mux will automatically use those credentials:
241+
242+
```jsonc
243+
{
244+
"bedrock": {
245+
"region": "us-east-1",
246+
// No credentials needed β€” uses AWS credential chain
247+
},
248+
}
249+
```
250+
251+
**Required IAM Permissions:**
252+
253+
Your AWS credentials need the `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream` permissions for the models you want to use.
254+
176255
### Provider Configuration
177256

178257
All providers are configured in `~/.mux/providers.jsonc`. Example configurations:
@@ -199,6 +278,10 @@ All providers are configured in `~/.mux/providers.jsonc`. Example configurations
199278
"openrouter": {
200279
"apiKey": "sk-or-v1-...",
201280
},
281+
// Bedrock (uses AWS credential chain if no explicit credentials)
282+
"bedrock": {
283+
"region": "us-east-1",
284+
},
202285
// Optional for Ollama (only needed for custom URL)
203286
"ollama": {
204287
"baseUrl": "http://your-server:11434/api",
Lines changed: 1 addition & 0 deletions
Loading

β€Žsrc/browser/components/Messages/ModelDisplay.tsxβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react";
22
import AnthropicIcon from "@/browser/assets/icons/anthropic.svg?react";
33
import OpenAIIcon from "@/browser/assets/icons/openai.svg?react";
4+
import AWSIcon from "@/browser/assets/icons/aws.svg?react";
45
import { TooltipWrapper, Tooltip } from "@/browser/components/Tooltip";
56
import { formatModelDisplayName } from "@/common/utils/ai/modelDisplay";
67

@@ -29,6 +30,8 @@ export const ModelDisplay: React.FC<ModelDisplayProps> = ({ modelString, showToo
2930
return <AnthropicIcon />;
3031
case "openai":
3132
return <OpenAIIcon />;
33+
case "bedrock":
34+
return <AWSIcon />;
3235
default:
3336
return null;
3437
}

0 commit comments

Comments
Β (0)