Skip to main content

Module bedrock

Module bedrock 

Source
Expand description

The Bedrock route’s own rules (docs/specs/SPEC_BEDROCK_MODEL_ROUTE_2026_12_01.md): the region and the cross-region profile the person chose, the model name Bedrock is asked for, the token count the gateway answers itself, and the one sentence each way Bedrock refuses a request. Pure, so each is tested without a network.

Claude models answer on Bedrock’s own Messages path, so the harness’s request goes on as it is: only the model name (a profile id: global. or us. before the base name) and the key’s header change.

Structs§

Refusal
What Bedrock refused, as the one sentence the harness shows, with the status and the error type it is shown under.

Enums§

Profile
Which models Bedrock may route a request to: any commercial region, or the US ones.
Wire
How the gateway speaks to Bedrock for a model: the Claude models on Bedrock’s Messages path, as the harness does; every other model through Chat Completions, with the adapter in between (super::chat_adapter).

Constants§

BETAS_OFF_VAR
Claude Code’s switch for the beta features Bedrock may not know. Set for the agent on this route, so a request does not carry a beta flag the upstream refuses.
DEFAULT_REGION
The region when the setting is not set.
PROFILE_SETTING
The setting that names the cross-region inference profile: global or us.
REGION_SETTING
The setting that names the region the requests go to.
ROUTE_ID
The id of the route in the catalog.

Functions§

chat_rules
What a model asks of its Chat Completions request. DeepSeek V3 answers at most 8,192 tokens and has no reasoning to set; a model not named here is asked for as Amazon Ergo is.
chat_url
Where a Chat Completions request goes: Bedrock’s OpenAI-style path on the same host as the Messages one.
count_tokens_answer
The answer to count_tokens, made here: Bedrock’s Messages path has no count call, and a harness that sizes its prompt with one must not be answered with an error. An estimate from the text; an image counts for a fixed amount.
models_answer
The answer to v1/models: the route’s own models, in the shape a Messages harness reads. Bedrock has no such list on the Messages path, and a harness that asks must not be answered with an error.
price_factor
What model costs under profile, as a multiple of its listed price.
profile
The profile the settings choose; global for anything else.
profile_model
The id Bedrock is asked for: the catalog’s base name under the profile.
refusal
The sentence for a request Bedrock did not serve, from its status and what it said (body is its text, error_type the x-amzn-ErrorType it sent). None for what is not named here: the answer goes to the harness as Bedrock gave it. Nothing the person sent or the key is repeated.
region
The region the settings choose, or DEFAULT_REGION when it is not set or is not a region’s name.
takes_profile
Whether a model is asked for under the person’s profile. DeepSeek’s models are served in their own region only: AWS lists no global or geographic profile for them, so the base name goes up as it is and the profile changes no price.
wire_of
The wire a model needs: a Claude model’s base name starts anthropic..
with_profile_model
The request body with its model made the profile id of the base name it holds. A body that is not JSON, or names no model, goes on as it is.