Skip to content

EndpointMantle defaults to /openai/v1, but AWS documents mantle's base URL as /v1 #812

Description

@anandpathak

bedrock.NewClient with EndpointMantle builds a base URL of
https://bedrock-mantle.{region}.api.aws/openai/v1/. AWS documents mantle's base URL as
/v1 — see the "Programmatic Access" table on the
Kimi K2.5 model card,
whose Chat Completions sample sets
OPENAI_BASE_URL="https://bedrock-mantle.<region>.api.aws/v1".

Sending a non-OpenAI model to the default fails with an error that names the model, which
points you at model access, IAM and region rather than at the path:

client, err := bedrock.NewClient(ctx, bedrock.Config{
	Endpoint:  bedrock.EndpointMantle,
	AWSRegion: "ap-southeast-3",
})
if err != nil {
	panic(err)
}

_, err = client.Chat.Completions.New(ctx, openai.ChatCompletionNewParams{
	Messages: []openai.ChatCompletionMessageParamUnion{openai.UserMessage("ping")},
	Model:    "moonshotai.kimi-k2.5",
})
fmt.Println(err)
POST "https://bedrock-mantle.ap-southeast-3.api.aws/openai/v1/chat/completions":
400 Bad Request {"code":"validation_error",
                 "message":"model `moonshotai.kimi-k2.5` isn't supported on this route",
                 "param":null,"type":"invalid_request_error"}

Setting BaseURL to the documented /v1 on an otherwise identical config fixes it. Same
client, endpoint, region, credentials and model — only the path differs:

Path Result
/openai/v1/chat/completions 400 validation_error, "isn't supported on this route"
/v1/chat/completions routes correctly, proceeds to auth
/openai/v1/models 404
/v1/models 401 — route exists, auth evaluated

The 404-vs-401 split on /models suggests /openai/v1 is a narrower route rather than the
general one.

/openai/v1 is correct for bedrock-runtime, so it looks like the suffix carried over
to mantle in bedrock/auth.go:

return fmt.Sprintf("https://bedrock-mantle.%s.api.aws/openai/v1/", region)

Related: openai/codex#21352 is the same
report against the Codex CLI's Bedrock Mantle provider, closed without a recorded
rationale. BerriAI/litellm#29463 asks
for GPT-5.x on mantle via /openai/v1/responses, which suggests /openai/v1 is a live
route for the OpenAI models.

That last point leaves me unsure which fix you'd want. If both routes exist — /openai/v1
for the openai.* family and /v1 for the wider Bedrock catalog — then the default is
right for some callers and wrong for others, and flipping it would break the first group.

  • In that case the fix is probably documentation: say in bedrock/README.md which models each mantle route serves, and make the Config.BaseURL hint ("Use BaseURL if a deployment requires /v1") say when that is
  • If /openai/v1 was never intended as the mantle default, it's a one-line change in defaultEndpointURL.

Let me know which way would be preferred? I will be happy to send PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions