Skip to main content

Overview

The SageMaker provider (sagemaker) sends requests to models you host on SageMaker real-time endpoints. Chat requests go to the endpoint’s OpenAI-compatible route (/openai/v1/chat/completions), so vLLM, SGLang, LMI and llama.cpp containers work behind Bifrost without a custom adapter. Bifrost signs every request itself. It mints the SageMaker bearer token from your AWS credentials and caches it, or it sends a pre-minted token you supply. For containers that do not speak the OpenAI format (TEI, LMI’s native format, custom images), use the SageMaker passthrough route instead. It forwards raw InvokeEndpoint calls.

Supported Operations


Model IDs

A SageMaker model id names the endpoint, not the model inside it:
  • Endpoint and inference-component names follow SageMaker’s naming rules: up to 63 letters, digits and hyphens, starting and ending with a letter or digit. Bifrost rejects any other id with a configuration error before calling AWS.
  • Region precedence: the model id prefix wins, then the region on a model alias, then the key’s region. There is no default region, because endpoints are regional.
  • The model field in the body sent to the container is always empty. SageMaker routes by URL, and vLLM rejects an endpoint name in model but accepts an empty one.
Use models on the key to restrict which endpoints a key can reach, and aliases to give an endpoint a friendlier name.

Authentication

Every SageMaker key needs a region. Credentials come from one of three places: Both credential methods can assume an IAM role first: add role_arn, and optionally external_id and session_name. With AWS credentials, Bifrost mints a sagemaker-api-key-... bearer token locally (no AWS call), the same way sagemaker-core’s generate_token does:
  • Tokens are cached per credential set and region, so a warm request is a single cache lookup.
  • A token lasts one hour, or less when temporary credentials expire sooner.
  • If SageMaker rejects a cached token as expired (403), Bifrost drops it and mints a new one on the next request.
A bearer token in the key value is sent as-is and never cached. Such tokens expire within 12 hours, so you must rotate them yourself.
A bearer-token key works only for chat and Responses. Listing models skips it, and passthrough refuses it with a 400, because both need AWS credentials to sign the request.

IAM permissions

The principal Bifrost runs as (or assumes) needs:

Setup & Configuration

  1. Go to Model Providers, select AWS SageMaker, and click + to add a key.
  2. Under Allowed Models, list the endpoints this key may reach, or keep All Models.
  3. Under Authentication Method, pick IAM Role (Inherited), Explicit Credentials, or Bearer Token.
  4. For explicit credentials, enter the Access Key and Secret Key, and the Session Token if the credentials are temporary. For a bearer token, paste the sagemaker-api-key-... value or an env. reference.
  5. Enter the Region of your endpoints (required).
  6. Optionally fill in Assume Role ARN, External ID and Session Name, and a Runtime host under VPC Endpoints.
  7. Click Save. SageMaker API Key Configuration

VPC, FIPS and dual-stack endpoints

By default Bifrost calls runtime.sagemaker.{region}.amazonaws.com (.amazonaws.com.cn for cn-* regions). To use an interface VPC endpoint, a FIPS host or a dual-stack host, set endpoints.runtime:
region is still required with an override, because it sets the token’s credential scope.

Usage

Streaming, tools and other chat parameters are passed to the container unchanged, so what works depends on the engine and how it was launched (for example, vLLM needs a tool-call parser for tool calling). The Responses API works the same way:

Listing models

SageMaker has no models endpoint on /openai/v1. Instead, a list-models request calls ListEndpoints in each key’s region and returns the InService endpoints, filtered by the key’s models, blacklisted_models and aliases. Entries in the key’s models allowlist are always returned, even when discovery cannot see them, so inference components you list explicitly show up too. Discovery is skipped for a key with no region or with a bearer token, and it stops after 5,000 endpoints per key.

Errors

SageMaker wraps container failures in a ModelError envelope with a CloudWatch link. Bifrost unwraps it and returns the container’s own message and error type, for vLLM, SGLang and LMI error formats. LMI reports client errors as 424 or 500; when the wrapped error carries a 4xx code, Bifrost returns that status instead. Unrecognized envelopes keep SageMaker’s original message.

Next Steps