Amazon Bedrock provider

Related Documentation
Minimum Version
AI Gateway - 2.0
Tags
#ai
Previous Versions of this page

You can proxy requests to Amazon Bedrock AI models through AI Gateway by creating AI Model Provider and AI Model entities. This reference documents all supported AI capabilities, configuration requirements, and provider-specific details needed for proper integration.

AI Gateway supports both Bedrock Runtime and Bedrock Mantle. The following sections cover both variants together and note where their capabilities differ.

Upstream paths

AI Gateway automatically routes requests to the appropriate Amazon Bedrock API endpoints. The following table shows the upstream paths used for each capability.

Capability

Variant

Path template

Description

Upstream path or API

Generate Bedrock Runtime /chat/completions or /completions Text generation for chat completions Uses the Converse and ConverseStream APIs. When a client sends an Anthropic-format request to an Anthropic Claude model, AI Gateway sends it to InvokeModel or InvokeModelWithResponseStream instead, because the request is already in Claude’s native format.
Generate Bedrock Mantle /chat/completions or /completions Text generation for chat completions /v1/chat/completions and /anthropic/v1/messages (OpenAI and Anthropic formats, without translation)
Agentic Bedrock Mantle only /assistants or /responses Agent and assistant-based interactions /v1/responses
Embeddings Bedrock Runtime only /embeddings Vector embeddings from text input Uses the InvokeModel and InvokeWithResponseStream API
Image Bedrock Runtime only /images/generations or /images/edits Image generation and editing Uses the InvokeModel API
Video Bedrock Runtime only /videos Video generation Uses the StartAsyncInvoke API
Batches Bedrock Runtime only /batches Batch processing of requests Uses the ModelInvocationJob API
Files Bedrock Runtime /files File management and storage /openai/files
Files Bedrock Mantle /files File management and storage /v1/files

Supported capabilities

The following tables show the AI capabilities supported by the Amazon Bedrock provider when configuring AI Models.

By default, AI Gateway uses the path templates shown in the tables below (e.g., /chat/completions, /embeddings, etc.). To customize these paths, configure the config.paths field in your AI Model entity. Custom paths take the form {configured_path}/{template_path} — for example, if you set a custom path of /v2, requests to /embeddings would be routed to /v2/embeddings.

Text generation

Support for Amazon Bedrock text generation capabilities:

Capability

Variant

Streaming

Model example

Path template

Min version

generate Bedrock Runtime Supported Use the model name for the specific LLM provider /chat/completions or /completions 2.0
generate Bedrock Mantle Supported Use a model ID that Amazon Bedrock serves through the Mantle endpoint /chat/completions or /completions 2.3

Embeddings

Support for Amazon Bedrock embeddings generation:

Capability

Variant

Model example

Path template

Min version

embeddings Bedrock Runtime only Use the model name for the specific LLM provider /embeddings 2.0

Agentic

Support for Amazon Bedrock agent and assistant capabilities:

Capability

Variant

Model example

Path template

Min version

agentic Bedrock Mantle only Use a model ID that Amazon Bedrock serves through the Mantle endpoint /assistants or /responses 2.3

Image

Support for Amazon Bedrock image generation and editing capabilities:

Capability

Variant

Model example

Path template

Min version

image Bedrock Runtime only Use the model name for the specific LLM provider /images/generations or /images/edits 2.0

For requests with large payloads, consider increasing config.max_request_body_size on your AI Model entity to three times the raw binary size.

Supported image sizes and formats vary by model. Refer to your provider’s documentation for allowed dimensions and requirements.

Video

Support for Amazon Bedrock video generation capabilities:

Capability

Variant

Model example

Path template

Min version

video Bedrock Runtime only Use the model name for the specific LLM provider /videos 2.0

For requests with large payloads (video generation), consider increasing config.max_request_body_size on your AI Model entity to three times the raw binary size.

Batches

Support for Amazon Bedrock batch processing capabilities:

Capability

Variant

Model example

Path template

Min version

batches1 Bedrock Runtime only n/a /batches 2.0

1 Bedrock Runtime: Batches processing for Bedrock is supported in the native format from SDK only

Batch jobs run on an AI Model with type: "api". Regular models handle synchronous capabilities like generate and embeddings, so a model that serves batches can’t serve those capabilities.

Files

Support for Amazon Bedrock file management capabilities:

Capability

Variant

Model example

Path template

Min version

files2 Bedrock Runtime & Bedrock Mantle n/a /files 2.0

2 Bedrock Runtime: Amazon Bedrock does not have a dedicated files API. Batch input and output files are stored in Amazon S3 and referenced by S3 URI.

Files are managed through an AI Model with type: "api", the same type that serves batches. Create one dedicated AI Model for batches and files, and keep generate and embeddings on a separate regular model, because each model is either a regular model or an API model, not both.

Amazon Bedrock base URL

By default, AI Gateway routes Amazon Bedrock requests to Bedrock Runtime at https://bedrock-runtime.{region}.amazonaws.com.

To route requests to Bedrock Mantle, set endpoint_type: mantle in the target config of your AI Model. AI Gateway then sends them to https://bedrock-mantle.{region}.api.aws.

You don’t need to set the URL yourself. You only need to set upstream_url in your AI Model configuration if you’re using a self-hosted or Amazon Bedrock-compatible endpoint instead.

Supported native LLM formats for Amazon Bedrock

By default, AI Gateway uses OpenAI-compatible request formats. Configure a native format in your AI Model to use Amazon Bedrock-specific APIs and features.

The following native Amazon Bedrock formats are supported:

LLM format

Variant

Supported APIs

bedrock Bedrock Runtime
  • /model/{model_name}/converse
  • /model/{model_name}/converse-stream
  • /model/{model_name}/invoke
  • /model/{model_name}/invoke-with-response-stream
  • /model/{model_name}/retrieveAndGenerate
  • /model/{model_name}/retrieveAndGenerateStream
  • /model/{model_name}/rerank
  • /model/{model_name}/async-invoke
  • /model-invocations

Provider-specific limitations for native formats

Bedrock Runtime:

  • None.

Bedrock Mantle:

  • Mantle has no Converse or InvokeModel API, so Konnect rejects a target with endpoint_type: mantle if its AI Model declares a format with type: bedrock. Use the openai or anthropic format instead.

  • Mantle supports only chat, Responses, and files requests. Embeddings and other capabilities are not supported. Use the runtime endpoint for them.

Statistics logging limitations for native formats

Bedrock Runtime:

  • Statistics logging is not available for image generation or editing APIs for Amazon Bedrock

Bedrock Mantle:

  • None.

Configure Amazon Bedrock

To use Amazon Bedrock with AI Gateway, configure a new AI Model Provider. You can then access supported AI Models from Amazon Bedrock.

Here’s a minimal configuration for chat completions:

Authentication with AWS

You can also use Amazon Bedrock with AWS credentials by setting auth to aws and specifying:

  • access_key_id (optional): AWS access key ID for static IAM user credentials. If omitted, the default AWS credentials provider chain is used (EC2 instance profiles, environment variables, etc.).
  • secret_access_key (optional): AWS secret access key paired with access_key_id. Required if access_key_id is set.
  • assume_role_arn (optional): IAM role ARN to assume for temporary credentials. Useful for cross-account access.
  • role_session_name (optional): Session name for the assumed role. Required if assume_role_arn is set.
  • sts_endpoint_url (optional): Custom STS endpoint for role assumption. Defaults to https://sts.amazonaws.com.
  • batch_role_arn (optional): Separate role ARN for Bedrock batch API calls.

Authentication with an Amazon Bedrock API key

To authenticate with an Amazon Bedrock API key instead of AWS credentials, set config.auth.type to basic with an Authorization header whose value is Bearer BEDROCK_API_KEY. Replace BEDROCK_API_KEY with your Amazon Bedrock API key.

Both authentication methods work with the runtime and mantle endpoints.

Choose a Bedrock endpoint

AI Gateway can send requests to either of the two Amazon Bedrock inference endpoints, Runtime (the default) or Mantle, depending on the endpoint_type in the target config of an AI Model. Use mantle when your clients already send OpenAI or Anthropic API requests and you want Bedrock Mantle to handle them natively, for example, to run the OpenAI Codex CLI against models on Bedrock. Keep runtime for Bedrock-native clients, for the Bedrock-specific APIs such as Rerank, async invoke, and batch, and for any model that doesn’t support Mantle.

Mantle only supports chat, Responses, and files requests, in the openai or anthropic format. For embeddings, the bedrock format, and Bedrock-specific APIs such as Rerank, async invoke, and batch, use runtime.

The format and capability of the AI Model determine which Mantle API receives the request:

Format Capability Request type
openai generate Chat Completions
openai agentic Responses
openai files Files
anthropic generate Messages

The files capability is available only on an AI Model with type: api. The other capabilities are set on an AI Model with type: model.

For Anthropic requests, AI Gateway sets the anthropic-version header to 2023-06-01 unless the client sends one. If you set upstream_url on a Mantle target, AI Gateway keeps that URL’s path.

The following AI Model sends OpenAI Chat Completions requests to Bedrock Mantle:

For a complete walkthrough, see Route OpenAI traffic to Amazon Bedrock Mantle.

Connect through a VPC endpoint

Before you configure vpc_endpoint, make sure that:

  • You created an interface VPC endpoint for the Bedrock Runtime service (com.amazonaws.{region}.bedrock-runtime) in the VPC where your data plane nodes run. See Use interface VPC endpoints (AWS PrivateLink) in the AWS documentation.
  • Your data plane nodes can resolve the endpoint’s DNS name and reach it on port 443.
  • Your IAM user or role has bedrock:Converse and bedrock:ConverseStream permissions, and the VPC endpoint policy allows them.

To connect to Amazon Bedrock through a VPC endpoint over AWS PrivateLink, set vpc_endpoint in the target config to the hostname of your interface VPC endpoint. AI Gateway then sends requests to that host. Set the value to a hostname only, for example vpce-0123456789abcdef0-abcdefgh.bedrock-runtime.us-east-1.vpce.amazonaws.com. Do not include a scheme. The rest of the request behaves as it does with the public endpoint:

  • AI Gateway still builds the Bedrock path for each operation, including streaming (invoke-with-response-stream) and async invoke.
  • SigV4 signs requests for the Bedrock service and the configured region, not for the VPC endpoint hostname. Set region to the region of the VPC endpoint.
  • If the VPC endpoint is unreachable, the request fails. AI Gateway doesn’t fall back to the public endpoint.
  • vpc_endpoint also applies to a Bedrock embeddings model, such as the one set in config.balancer.embeddings.config for semantic load balancing.

vpc_endpoint overrides only the host. If you also set upstream_url on the same target, upstream_url takes precedence and AI Gateway ignores vpc_endpoint. Use upstream_url only when you need to override the full URL, because it also replaces the path that AI Gateway builds for each Bedrock operation.

Looking for on-prem configuration? Convert the kongctl configuration to a decK yaml file and use deck file ai2kong. See Configure Kong AI Gateway on-prem for more information.

FAQs

For cross-region inference with Amazon Bedrock, prefix the model ID with a geographic identifier in your AI Model configuration:

{geography-prefix}.{provider}.{model-name}...

For example: us.anthropic.claude-sonnet-4-5-20250929-v1:0

Prefix

Geography

us. United States
eu. European Union
apac. Asia-Pacific
global. All commercial regions

For a full list of supported cross-region inference profiles, see Supported Regions and models for inference profiles in the AWS documentation.

Use the extra_body feature when sending requests to an AI Model that proxies Amazon Bedrock video generation in OpenAI format:

    curl http://localhost:8000 \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
        "model": "amazon.nova-reel-v1:0",
        "prompt": "A large red square that is rotating",
        "extra_body": {
        "fps": 24
        }
    }'

Add a guardrailConfig object to your request body when calling an AI Model that proxies Amazon Bedrock:

      {
          "messages": [
              {
                  "role": "system",
                  "content": "You are a scientist."
              },
              {
                  "role": "user",
                  "content": "What is the Boltzmann equation?"
              }
          ],
          "guardrailConfig": {
              "guardrailIdentifier": "$GUARDRAIL-IDENTIFIER",
              "guardrailVersion": "1",
              "trace": "enabled"
          }
      }

For more details, see Guardrails and content safety and the AWS Bedrock guardrails documentation.

Configure an AI Model with a Bedrock AI Model Provider and set up AWS authentication using IAM credentials or assumed roles.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!