Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1360,10 +1360,7 @@ func main() {
The region is resolved from `AWSRegion`, `AWS_REGION`, `AWS_DEFAULT_REGION`,
or the standard AWS config chain. The base URL is resolved from `BaseURL`,
`AWS_BEDROCK_BASE_URL`, or
`https://bedrock-mantle.{region}.api.aws/openai/v1`.
The `/openai/v1` prefix is intentional; Bedrock's generic `/v1` route is a
different API surface and is not interchangeable with the OpenAI-compatible
route.
`https://bedrock-mantle.{region}.api.aws/v1`.

To select a named profile:

Expand Down
4 changes: 2 additions & 2 deletions bedrock/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Amazon Bedrock

Use the `bedrock` package to configure the normal OpenAI client for Amazon Bedrock's OpenAI-compatible API. The default Mantle endpoint and its existing authentication behavior remain unchanged.
Use the `bedrock` package to configure the normal OpenAI client for Amazon Bedrock's OpenAI-compatible API.

| Endpoint | Default API root | SigV4 service |
| --- | --- | --- |
| `bedrock.EndpointMantle` (default) | `https://bedrock-mantle.<region>.api.aws/openai/v1` | `bedrock-mantle` |
| `bedrock.EndpointMantle` (default) | `https://bedrock-mantle.<region>.api.aws/v1` | `bedrock-mantle` |
| `bedrock.EndpointRuntime` | `https://bedrock-runtime.<region>.amazonaws.com/openai/v1` | `bedrock` |

Runtime hostnames use the correct suffix for the selected AWS partition. Canonical Runtime, FIPS, and dual-stack `BaseURL` overrides automatically select the endpoint family when `Endpoint` is omitted. Canonical AWS hosts must use HTTPS and match the configured region and endpoint. Custom or proxy hosts default to the Mantle signer; set `EndpointRuntime` explicitly when a custom host requires Runtime signing.
Expand Down
2 changes: 1 addition & 1 deletion bedrock/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func defaultEndpointURL(endpoint Endpoint, region string) string {
standardSuffix, _ := runtimeDNSSuffixes(region)
return fmt.Sprintf("https://bedrock-runtime.%s.%s/openai/v1/", region, standardSuffix)
}
return fmt.Sprintf("https://bedrock-mantle.%s.api.aws/openai/v1/", region)
return fmt.Sprintf("https://bedrock-mantle.%s.api.aws/v1/", region)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the remaining Mantle URL documentation

After changing the default to /v1, README.md:1363-1366 and bedrock/README.md:3-8 still document /openai/v1 as the Mantle default, and bedrock/example_test.go:129-134 explicitly sets that old URL. A user copying the bearer example therefore overrides the corrected default and continues sending requests to the route this commit is intended to fix; update these references and the example alongside the default.

Useful? React with 👍 / 👎.

}

func runtimeDNSSuffixes(region string) (standard string, dualStack string) {
Expand Down
2 changes: 1 addition & 1 deletion bedrock/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ region = eu-central-1
if err := client.Get(context.Background(), "/models", nil, &response); err != nil {
t.Fatal(err)
}
if got, want := request.URL.String(), "https://bedrock-mantle.eu-central-1.api.aws/openai/v1/models"; got != want {
if got, want := request.URL.String(), "https://bedrock-mantle.eu-central-1.api.aws/v1/models"; got != want {
t.Fatalf("request URL = %q, want %q", got, want)
}
authorization := request.Header.Get("Authorization")
Expand Down
2 changes: 1 addition & 1 deletion bedrock/bedrock.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ type Config struct {
AWSCredentialsProvider aws.CredentialsProvider

// BaseURL overrides AWS_BEDROCK_BASE_URL and the selected regional endpoint.
// Mantle defaults to https://bedrock-mantle.{region}.api.aws/openai/v1;
// Mantle defaults to https://bedrock-mantle.{region}.api.aws/v1;
// Runtime defaults to https://bedrock-runtime.{region}.amazonaws.com/openai/v1
// in the standard AWS partition. Use BaseURL if a deployment requires /v1.
BaseURL string
Expand Down
2 changes: 1 addition & 1 deletion bedrock/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func ExampleNewClient_bearer() {
client, err := bedrock.NewClient(context.Background(), bedrock.Config{
AWSRegion: "us-west-2",
APIKey: "bedrock-bearer-token",
BaseURL: "https://bedrock-mantle.us-west-2.api.aws/openai/v1",
BaseURL: "https://bedrock-mantle.us-west-2.api.aws/v1",
})
if err != nil {
panic(err)
Expand Down
2 changes: 1 addition & 1 deletion bedrock/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestBedrockEndpointResolution(t *testing.T) {
endpoint Endpoint
baseURL string
}{
{"Mantle default", Config{APIKey: "token", AWSRegion: "us-east-1"}, EndpointMantle, "https://bedrock-mantle.us-east-1.api.aws/openai/v1/"},
{"Mantle default", Config{APIKey: "token", AWSRegion: "us-east-1"}, EndpointMantle, "https://bedrock-mantle.us-east-1.api.aws/v1/"},
{"custom SigV4 Mantle default", Config{AWSRegion: "us-east-1", AWSAccessKeyID: "access", AWSSecretAccessKey: "secret", BaseURL: "https://proxy.example/openai/v1"}, EndpointMantle, "https://proxy.example/openai/v1/"},
{"custom SigV4 Runtime", Config{Endpoint: EndpointRuntime, AWSRegion: "us-east-1", AWSAccessKeyID: "access", AWSSecretAccessKey: "secret", BaseURL: "https://proxy.example/openai/v1"}, EndpointRuntime, "https://proxy.example/openai/v1/"},
{"Runtime standard", Config{Endpoint: EndpointRuntime, APIKey: "token", AWSRegion: "us-east-1"}, EndpointRuntime, "https://bedrock-runtime.us-east-1.amazonaws.com/openai/v1/"},
Expand Down