Skip to content

Models and Routing

Which models the gateway offers, where they come from, and what it does with a model name a client sends. Part of the Configuration Guide.

Settings Summary

Application Behavior

Variable Default Description
TIMEZONE UTC IANA timezone identifier for request timestamps
STRICT_INPUT_VALIDATION false Reject API requests with unknown/extra fields
CHAT_COMPLETIONS_REASONING_FIELD reasoning_content Field carrying reasoning text on /v1/chat/completions: reasoning_content, reasoning, or none
MODEL_ALIASES {} JSON object mapping custom model name aliases to Bedrock model IDs, optionally with per-alias configuration
DEFAULT_TTS_MODEL amazon.polly-standard Default TTS model: amazon.polly-standard, -neural, -long-form, or -generative
DEFAULT_TTS_LANGUAGE None Default language for TTS (e.g., en-US); when set, skips Amazon Comprehend auto-detection
TOKENS_ESTIMATION false Deprecated and ignored (token estimation removed)
TOKENS_ESTIMATION_DEFAULT_ENCODING None Deprecated and ignored (token estimation removed)
DEFAULT_MODEL_PARAMS {} JSON object with per-model default inference parameters (temperature, max_tokens, etc.)
DEFAULT_MODEL_SERVICE_TIERS {} JSON object with per-model default service tiers (default, flex, priority, reserved)
AWS_BEDROCK_ALLOW_SERVICE_TIER_OVERRIDE true Allow users to select the service tier per request, overriding the configured one (cost control)
MODEL_CACHE_SECONDS 900 Age in seconds at which the model list is refreshed in the background (default: 15 minutes)
MODEL_CACHE_MAX_STALE_SECONDS 86400 Age in seconds past which a request waits for the model list refresh (default: 24 hours)
MODEL_CACHE_SHARED false Share one model list between the deployment's servers through AWS_DYNAMODB_TABLE
AI_RESPONSE_TIMEOUT 600 Maximum seconds without data from a model before the request times out (default: 10 min)
SHUTDOWN_DRAIN_TIMEOUT 10 Maximum seconds the server waits for background work to finish after being asked to stop
DROP_UNSUPPORTED_SYSTEM_PROMPT true Drop system prompts for unsupported models; when false, return error instead
ANTHROPIC_BETA_FILTER true Enable filtering of unsupported anthropic_beta flags for Claude models
ANTHROPIC_BETA_ALLOWLIST None Additional anthropic_beta flags to allow beyond built-in Bedrock defaults
EXTRA_MODEL_PARAMS_DENYLIST None Additional "extra model parameters" names to strip, beyond the built-in LiteLLM control-parameter denylist
EXTRA_MODEL_PARAMS_DROP_ALL false Disable the "extra model parameters" passthrough entirely
IMAGE_GENERATION_MODEL None Default Bedrock image model ID used when the image_generation Responses API tool is invoked
REALTIME_CLIENT_SECRET_KEY None Secret the Realtime API's ephemeral client secrets are signed with; derived from the API key when unset
REALTIME_ALLOW_SESSION_OVERRIDE true Allow a client holding an ephemeral client secret to override the session configuration it carries
REALTIME_WEBRTC_ENABLED false Serve WebRTC calls on POST /v1/realtime/calls, terminating the media path in-process
REALTIME_WEBRTC_STUN_SERVER None STUN server the gateway uses to discover and advertise its public address to WebRTC callers
REALTIME_WEBRTC_TURN_SERVER None Operator-run TURN relay advertised to WebRTC callers on UDP-blocking networks
REALTIME_WEBRTC_TURN_USERNAME None Long-term credential username of the TURN relay
REALTIME_WEBRTC_TURN_PASSWORD None Long-term credential password of the TURN relay
REALTIME_WEBRTC_ALLOW_PRIVATE_CANDIDATES false Accept the ICE candidates a caller offers on addresses that are not globally routable

Model Sources and Access

Which model catalogues the gateway draws from, and which model identifiers a request is allowed to name.

AWS_BEDROCK_MANTLE_PREFERRED_MODELS

Purpose : Model IDs (or ID prefixes) served by Amazon Bedrock Mantle even when also available on the classic bedrock-runtime endpoint

Type : Comma-separated string of model IDs or ID prefixes

Default : openai.gpt-5.6 (the OpenAI GPT-5.6 family; every other dual-homed model is served by bedrock-runtime)

Behavior : Useful to leverage Mantle's independent throughput quotas, native response storage or built-in server tools for selected models. Mantle quotas (per-model, per-region tokens-per-minute) are independent from bedrock-runtime quotas.

: The GPT-5.6 family is preferred by default because Amazon Bedrock serves its web_search and code_interpreter tools on Mantle alone — on the classic endpoint they can only be refused.

: An explicit value replaces the default rather than adding to it: repeat openai.gpt-5.6 to keep the family on Mantle while preferring other models too.

export AWS_BEDROCK_MANTLE_PREFERRED_MODELS='openai.gpt-5.6,anthropic.claude-haiku-4-5'

Not the same as a wildcard model name

This setting matches models by ID prefix and takes no glob syntax; it selects a set of models for the operator's own routing, where a wildcard model name selects one model for a single request.

The default is a price change for the GPT-5.6 family

Both endpoints charge the same In-Region rate, but Mantle has no cross-region inference profiles, so a model preferred here stops riding the Global profile that bedrock-runtime uses by default (AWS_BEDROCK_CROSS_REGION_INFERENCE_GLOBAL). For GPT-5.6 that is exactly 10% more per token — $4.40 / $22.00 per million input / output tokens for Sol, $2.20 / $13.20 for Terra and $0.22 / $1.32 for Luna, against $4.00 / $20.00, $2.00 / $12.00 and $0.20 / $1.20 on the Global profile. Cached tokens and the long-context rates move by the same 10%; a deployment already pinned In-Region pays what it paid.

Usage for these models is also recorded, and billed by AWS, under Bedrock Mantle rather than Bedrock — attributed by project instead of by IAM principal — and input token counting answers 400 for them. Batch inference, prompt caching and existing stored-response IDs are unaffected.

Incompatible with Bedrock Guardrails

Guardrails do not apply to Mantle-served requests, so a model routed here would be served unfiltered with nothing at request time able to report it. Configuring both — this setting alongside AWS_BEDROCK_GUARDRAIL_IDENTIFIER or an alias guardrail that targets a routed model — stops the server at startup, naming the routed models. A per-request guardrail header cannot be checked at startup, so a request carrying one for a routed model is refused with 400 instead — see the warning there.

To run guardrails, set this to an empty value:

export AWS_BEDROCK_MANTLE_PREFERRED_MODELS=

Every dual-homed model, GPT-5.6 included, then returns to bedrock-runtime — at its Global-profile price, under your guardrail, and with web_search and code_interpreter refused with a 400. AWS_BEDROCK_MANTLE_SERVICE_HEADER cannot bring them back for a single request: it is refused at startup alongside a guardrail for the same reason, so a guardrailed deployment serves those tools on no route. Setting AWS_BEDROCK_MANTLE_ENABLED to false has the same effect on routing and additionally removes the Mantle-only models from the catalogue.

Incompatible with a Required End User Identity

A Mantle request is signed with the server's own credentials, so a model routed here never runs under the per-end-user role, and the policy conditions written on that role are never evaluated. Configuring this setting alongside AWS_BEDROCK_USER_ROLE_REQUIRE_IDENTITY therefore stops the server at startup, naming the routed models; set this to an empty value to keep both. A request identifying no end user is still answered 400 on Mantle, so the Mantle-only models stay served — under the server's own role.

AWS_BEDROCK_EXTERNAL_WEB_ACCESS

Purpose : Let the built-in web search tool reach the public web

Type : Boolean

Default : false

Behavior : Controls whether the built-in web search tool may reach the external web. Searches are answered from the Amazon Bedrock web index and cache either way, and answers are current and carry source citations. AWS documents that retrieval is served entirely from that index and cache today, so no request data leaves the AWS boundary even when this is enabled, and that a future release may allow live external retrieval — at which point request data may leave it. Enabling it is therefore a decision taken in advance about behaviour that can change. It also requires the bedrock-websearch:ExternalWebAccess IAM permission on the credentials this server uses; each action is authorized only when a model actually attempts it, and a denied call does not fail the request.

export AWS_BEDROCK_EXTERNAL_WEB_ACCESS=true

AWS_BEDROCK_ALLOW_EXTERNAL_WEB_ACCESS_OVERRIDE

Purpose : Allow a request to override AWS_BEDROCK_EXTERNAL_WEB_ACCESS with the external_web_access extra model parameter

Type : Boolean

Default : false

Behavior : When true, a request that sends external_web_access as an extra model parameter decides for that request, on the models whose web search takes a web access choice per request — the OpenAI GPT-5.x family. When false, a request that sets it to anything other than the configured value is rejected with 400 rather than being silently overridden; a request that omits it always gets the configured value. A request asking for a value a model cannot be given is rejected with 400 as well, rather than accepted and quietly ignored. On the models that do take it, a request naming no web search tool is accepted: nothing is searched, so the value has no search to apply to.

export AWS_BEDROCK_ALLOW_EXTERNAL_WEB_ACCESS_OVERRIDE=true

AWS_BEDROCK_LEGACY

Purpose : Allow usage of legacy/deprecated Bedrock models

Type : Boolean

Default : false

export AWS_BEDROCK_LEGACY=true

AWS_BEDROCK_DEPRECATED_MODEL_FALLBACK

Purpose : Transparently reroute requests using a deprecated model ID to its recommended replacement

Type : Boolean

Default : true

Behavior : When true, any request that specifies a deprecated model ID (as listed in the server's deprecation registry) is silently retried with the recommended replacement model. The replacement is fully re-evaluated — alias resolution, modality checks, and region routing all apply to the new model ID. When false, deprecated model IDs return a 404 error with a message indicating the replacement, forcing clients to migrate explicitly.

# Transparent fallback (default) — clients using old model IDs keep working
export AWS_BEDROCK_DEPRECATED_MODEL_FALLBACK=true

# Strict mode — deprecated model IDs return 404, clients must update their code
export AWS_BEDROCK_DEPRECATED_MODEL_FALLBACK=false

AWS_BEDROCK_DEPRECATED_MODELS

Purpose : Extend or override the built-in deprecated model registry with custom mappings

Type : JSON object — dict[str, str]

Default : {}

Behavior : Merged with the built-in registry at startup. User-provided entries take precedence over built-in ones — this means it can be used both to add new deprecated model mappings and to override the fallback target of an already-defined deprecated model. Effective only when AWS_BEDROCK_DEPRECATED_MODEL_FALLBACK is true.

Reference : Amazon Bedrock model lifecycle

# Add a custom deprecated model and override an existing built-in mapping
export AWS_BEDROCK_DEPRECATED_MODELS='{"my-old-model-v1": "my-new-model-v2", "amazon.titan-text-lite-v1": "amazon.nova-lite-v1:0"}'

AWS_BEDROCK_MARKETPLACE_AUTO_SUBSCRIBE

Purpose : Control automatic subscription to new models in AWS Marketplace

Type : Boolean

Default : true

Behavior : When true, the server automatically subscribes to new models discovered in the AWS Marketplace, making them immediately available through the API. When false, only models with existing marketplace subscriptions are visible and accessible

IAM Permissions Required : aws-marketplace:Subscribe, aws-marketplace:ViewSubscriptions — see Marketplace Auto-Subscribe IAM

# Allow automatic subscription (default)
export AWS_BEDROCK_MARKETPLACE_AUTO_SUBSCRIBE=true

# Restrict to pre-subscribed models only
export AWS_BEDROCK_MARKETPLACE_AUTO_SUBSCRIBE=false

What is Marketplace Auto-Subscribe?

Amazon Bedrock requires marketplace subscription before certain models can be used. This setting controls whether stdapi.ai automatically handles the subscription process:

  • true (default): Models are automatically subscribed when discovered, so a newly published model is usable on its first request
  • false: Only models that have already been subscribed through the AWS Marketplace are visible, providing explicit control over model access

When to Disable

Set to false when:

  • You need explicit control over which models are accessible
  • You want to prevent automatic marketplace subscriptions that may incur costs
  • Your organization requires manual approval for new AI model usage
  • Compliance policies require pre-authorization of AI models

AWS Documentation

For more information about Bedrock model access and marketplace registration, see the Amazon Bedrock Model Access documentation.

AWS_BEDROCK_MARKETPLACE_ENDPOINTS_ENABLED

Purpose : Publish the Amazon Bedrock Marketplace model endpoints deployed in this account and serve them as ordinary chat models

Type : Boolean

Default : false

Behavior : When true, the server discovers the Marketplace model endpoints deployed in this account and publishes them in the model list. This is serve-only: the server never creates, updates or deletes an endpoint — it only invokes ones the operator already deployed. An endpoint Amazon Bedrock has not yet registered, or that SageMaker has not brought into service, is not published; it appears at the next model-cache refresh once it is

IAM Permissions Required : bedrock:ListMarketplaceModelEndpoints, bedrock:GetMarketplaceModelEndpoint, sagemaker:InvokeEndpoint, sagemaker:InvokeEndpointWithResponseStream — see Bedrock Marketplace Model Endpoints IAM

# Disabled (default) - Marketplace model endpoints are never published
# No environment variable needed

# Publish Marketplace model endpoints deployed in this account
export AWS_BEDROCK_MARKETPLACE_ENDPOINTS_ENABLED=true

Off by Default: Paid, Hourly-Billed Infrastructure

A Marketplace model endpoint runs on dedicated instances billed by the instance-hour for as long as it exists, whether or not it is called, and reaching it needs extra IAM permissions beyond the core Bedrock policy. See Bedrock Marketplace Model Endpoints cost for how this billing works.

Served by the Generic Chat Implementation

A model endpoint is served by the generic chat implementation, so model-family-specific behavior is not applied to it. Token counting (/v1/responses/input_tokens and /anthropic/v1/messages/count_tokens) is not available for these models — Amazon Bedrock's token counter accepts a foundation model only. Neither route is listed for them in search_models, and calling one anyway answers 400.

Only What Amazon Bedrock Can Map Works

Amazon Bedrock only serves a Marketplace listing through its own chat API when it can map that listing's container to it. A listing it cannot map is still published, but fails at request time with a clean error — this is a documented limitation, and the server does not translate payloads on the listing's behalf.

AWS_BEDROCK_MARKETPLACE_ENDPOINT_REGIONS

Purpose : Restrict which regions are searched for Amazon Bedrock Marketplace model endpoints

Format : Comma-separated string of AWS region codes

Default : Every AWS_BEDROCK_REGIONS entry

Behavior : Every region listed here must also appear in AWS_BEDROCK_REGIONS, or the server refuses to start: a model endpoint is invoked in its own region and has no cross-region form, so a region the server does not otherwise serve could never answer

# Search only these regions for Marketplace model endpoints
export AWS_BEDROCK_MARKETPLACE_ENDPOINT_REGIONS=eu-west-1,us-east-1

An Endpoint Outside the Served Set Is Simply Never Published

An endpoint deployed in a region the server does not serve is never published — it does not appear in the model list, and a request naming it answers 404. That is correct behavior, not a bug: invoking an endpoint always happens in its own region, so a region the server never searches can never be reached.

AWS_BEDROCK_ALLOW_MARKETPLACE_ENDPOINT_ARN

Purpose : Allow users to pass the ARN of an Amazon Bedrock Marketplace model endpoint directly as a model ID in API requests

Type : Boolean

Default : false

Behavior : When enabled, users can use a Marketplace model endpoint ARN instead of a model ID in the model parameter, including an endpoint that is not published in the model list. When disabled, only the published model IDs are accepted

# Disabled (default) - users can only use published model IDs
# No environment variable needed

# Enable Marketplace model endpoint ARN support
export AWS_BEDROCK_ALLOW_MARKETPLACE_ENDPOINT_ARN=true

Cost-Bearing Setting

A caller who can name any endpoint ARN can direct traffic at instances the account is already paying for, including endpoints the operator never intended to expose. Enable this only when every client is trusted with the account's full set of deployed endpoints.

Example ARN

arn:aws:sagemaker:us-east-1:123456789012:endpoint/my-endpoint

AWS_SAGEMAKER_ENDPOINTS

Purpose : Publish Amazon SageMaker AI endpoints you run as chat models

Format : JSON object, mapping the model ID clients name to that endpoint's declaration

Default : Empty — no SageMaker AI endpoint is served

Behavior : Each entry publishes one endpoint in the model list and serves it on the chat completions, responses and messages APIs. The server only invokes the endpoints you name: it never creates, updates, scales or deletes one. Fields per entry:

| Field | Required | Meaning |
|---|---|---|
| `endpoint` | yes | Endpoint name — the name, never the ARN |
| `region` | yes | AWS Region the endpoint lives in |
| `inference_component` | for component-hosted endpoints | Inference component name; required for a scale-to-zero endpoint, which is always component-hosted |
| `name` | no | Display name in the model list (defaults to the model ID) |
| `provider` | no | Provider in the model list (defaults to `Amazon SageMaker AI`) |
| `input_modalities` | no | Input modalities to advertise, `["TEXT"]` by default; add `IMAGE` only when the model and its container accept image content parts |

IAM Permissions Required : sagemaker:CallWithBearerToken, sagemaker:InvokeEndpoint — see SageMaker AI Endpoints IAM

# Publish one endpoint as the model ID "my-qwen3"
export AWS_SAGEMAKER_ENDPOINTS='{
  "my-qwen3": {
    "endpoint": "my-endpoint",
    "region": "us-east-1",
    "inference_component": "my-inference-component",
    "name": "Qwen3 1.7B",
    "provider": "Qwen"
  }
}'

Paid, Hourly-Billed Infrastructure

A SageMaker AI endpoint is billed by the instance-hour for as long as it has instances running, whether or not it is called. Usage is reported with token counts and no cost, because AWS publishes no per-token rate for this path. See SageMaker AI endpoint cost.

The Container Must Serve the OpenAI Chat Completions API

Only a container that serves /openai/v1/chat/completions can answer here, which the SageMaker AI vLLM and SGLang containers do. What the container is configured for is what the model can do: tool calling needs a tool-call parser, reasoning content needs a reasoning parser. Token counting (/v1/responses/input_tokens and /anthropic/v1/messages/count_tokens) is not available for these models and answers 400; neither route is listed for them in search_models.

A Declared Model ID the Catalogue Already Publishes Is Ignored

An entry whose model ID matches a model already in the catalogue — a Bedrock foundation model, a Marketplace or Mantle model alike — is skipped, and the reason is reported in the startup log. Replacing a serverless model — available in every Region you serve, free at rest — with one endpoint in one Region would otherwise be a silent downgrade. Give the endpoint a model ID of its own.

Guardrails Do Not Apply to an Endpoint

An inference container serves the OpenAI Chat Completions API and has no guardrailConfig to carry, so an Amazon Bedrock Guardrail cannot filter what one of these models answers. Rather than serve such a request unfiltered, the gateway refuses it with a 400: a request reaching one of these models while a guardrail is configured — deployment-wide, per request, or from a model alias — is answered with an error, never with an unguarded 200. An alias carrying a guardrail and naming one of these models is decidable ahead of time and stops the server at startup; a deployment-wide guardrail warns instead, naming how many models it cannot reach, since these endpoints have no classic Bedrock home to fall back to.

An Endpoint Invocation Runs Under the Server's Own Role

The endpoint is called with a bearer token presigned from the server's credentials, so per-user cost attribution cannot apply here: an invocation never runs under the per-end-user role, and the aws:PrincipalTag conditions written on that role are never evaluated. AWS_BEDROCK_USER_ROLE_REQUIRE_IDENTITY still holds — a request reaching one of these models while identifying no end user is answered 400, not served unattributed. What the invocation costs is an instance-hour on an endpoint you own, and it is billed to your account either way.

AWS_SAGEMAKER_WARMUP_TIMEOUT

Purpose : How long a request may wait for a SageMaker AI endpoint that has scaled to zero to provision capacity again

Type : Integer (seconds)

Default : 600

Behavior : An endpoint scaled to zero has no capacity to answer with, and the request that finds it cold is what makes AWS provision an instance again. Rather than surfacing that as an error, the server holds the connection and retries until the endpoint answers or this budget runs out; concurrent callers to the same endpoint share one wait. When the budget runs out the caller gets a 503 telling them to retry, and the real cause is logged for you. Set to 0 to disable the wait and answer that same 503 immediately — a retriable status, because a cold endpoint is a transient condition. It cannot exceed AI_RESPONSE_TIMEOUT, or the server refuses to start

# Wait up to 10 minutes for a cold endpoint (default)
# No environment variable needed

# Fail immediately instead of waiting
export AWS_SAGEMAKER_WARMUP_TIMEOUT=0

The Wait Happens Before Anything Is Sent Back

Because the retry finishes before the model's first byte, a streaming request pays a longer time to first byte and nothing else: no partial stream, and a real HTTP status if the endpoint never comes up. Make sure any load balancer or proxy in front of the deployment tolerates that much silence — the stdapi.ai Terraform module defaults its idle timeout to an hour.

AWS_SAGEMAKER_ENDPOINT_URL

Purpose : Override the Amazon SageMaker AI runtime endpoint URL

Format : HTTPS URL template, with {region} substituted per Region

Default : Resolved automatically, per AWS partition

Behavior : Only needed to reach the runtime through a VPC endpoint or an inspection proxy. Must use https://, and the {region} placeholder must be well formed, or the server refuses to start

# Reach SageMaker AI through an interface VPC endpoint
export AWS_SAGEMAKER_ENDPOINT_URL='https://vpce-0123-abcd.runtime.sagemaker.{region}.vpce.amazonaws.com'

Model Cache

stdapi.ai automatically discovers and caches available Bedrock models from configured regions. Once the cache expires, the request that notices is answered from the cached list straight away and the refresh runs in the background — see Model List Refresh for what that means for freshness.

MODEL_CACHE_SECONDS

Purpose : Age at which the cached Bedrock model list is refreshed

Type : Integer (seconds, must be greater than 0)

Default : 900 (15 minutes)

Behavior : Once the cached list reaches this age, the next request needing it (a model lookup, /v1/models, /search_models) is answered from the cached list and a refresh starts in the background: the server queries Amazon Bedrock to discover newly available models, pick up model access changes, and update inference profile configurations. This cache also applies to application inference profile and prompt router information when users pass ARNs directly (if enabled via AWS_BEDROCK_ALLOW_APPLICATION_INFERENCE_PROFILE_ARN or AWS_BEDROCK_ALLOW_PROMPT_ROUTER_ARN)

# Default: 15 minutes
export MODEL_CACHE_SECONDS=900

# More frequent updates (5 minutes)
export MODEL_CACHE_SECONDS=300

# Less frequent updates (1 hour)
export MODEL_CACHE_SECONDS=3600

Refresh Behavior

  • The refresh runs only when a request needs the list and the list has expired — there is no polling timer.
  • However many requests notice the expiry at once, one refresh runs; the others are answered immediately from the list already in memory.
  • The AWS calls (ListFoundationModels, GetFoundationModelAvailability, ListInferenceProfiles) run in parallel across regions, so a refresh takes about as long as the slowest region rather than scaling with their number.
  • A request only waits for a refresh in two cases: the server has no model list at all (its first request after a start that could not build one), and the list has passed MODEL_CACHE_MAX_STALE_SECONDS.

Tuning Recommendations

Interval Use Case Trade-offs
300 (5 min) Development, testing new models Faster model discovery, more AWS discovery calls
900 (15 min) Production (default, balanced) Balanced freshness and API call volume
3600 (1 hour) Stable production, cost optimization Fewest AWS calls, slower model discovery

Lower cache lifetimes increase the frequency of the per-region discovery calls; very frequent refreshes in high-traffic deployments may approach API rate limits. Higher ones widen the window in which the list still advertises a model AWS has withdrawn.

MODEL_CACHE_MAX_STALE_SECONDS

Purpose : Maximum age the cached model list may reach while its refresh keeps failing

Type : Integer (seconds, 0 or more)

Default : 86400 (24 hours)

Behavior : Below this age, an expired list is served while its refresh runs behind it. At or beyond it, the next request waits for a successful refresh instead — so a deployment whose refreshes fail silently (revoked bedrock:ListFoundationModels, a prolonged regional outage) cannot serve an arbitrarily old list, and a model that has been withdrawn stops being advertised. Each failed refresh is recorded in the server log, at error level once the list is more than two MODEL_CACHE_SECONDS old

# Default: 24 hours
export MODEL_CACHE_MAX_STALE_SECONDS=86400

# Tighter bound for a deployment where model availability changes matter
export MODEL_CACHE_MAX_STALE_SECONDS=3600

# Never serve an expired list: every expiry is refreshed synchronously
export MODEL_CACHE_MAX_STALE_SECONDS=0

0 restores the wait on every expiry

With 0, the first request after every expiry waits for the full discovery pass, which is the freshest and the slowest setting. Prefer a small non-zero value unless a request must never be answered from an expired list.

MODEL_CACHE_SHARED

Purpose : Share one model list between the servers of a deployment

Type : Boolean

Default : false

Behavior : When enabled, the model list is published to the Amazon DynamoDB table named by AWS_DYNAMODB_TABLE, which is required. One server refreshes the list and publishes it; the others read it instead of querying Amazon Bedrock themselves, so a fleet performs one discovery pass per MODEL_CACHE_SECONDS instead of one per server, and a server that starts serves requests without a discovery pass of its own. Any table error is recorded in the server log and the server falls back to querying Amazon Bedrock itself

export AWS_DYNAMODB_TABLE=stdapi-ai
export MODEL_CACHE_SHARED=true

When it helps, and when it does not

  • It pays off from a handful of servers upward, or wherever tasks start and stop often (autoscaling, rolling deployments): the discovery pass is what a starting server otherwise has to complete before it is useful.
  • Servers only share a list when they run the same version, in the same AWS account, with the same AWS_BEDROCK_* and AWS_SAGEMAKER_* configuration — every setting under those prefixes, not only the ones discovery reads, because being too broad costs a refresh while being too narrow serves one deployment's catalogue to another. Anything else reads as an empty cache, which is why a rolling deployment briefly has every server discovering on its own again.
  • The table is only read and written when the list has expired, so the request rate does not change with traffic. See the cost of an enabled shared list.
  • Setting it without AWS_DYNAMODB_TABLE fails startup with a message naming both.

Default Model Parameters

Configure default inference parameters applied automatically to specific models.

What You Can Do

  • Set consistent temperature/creativity levels per model
  • Enable provider-specific features (e.g., Anthropic beta features)
  • Configure default token limits for cost control
  • Apply model-specific stop sequences

Parameter Precedence

Request parameters always take precedence over defaults.

DEFAULT_MODEL_PARAMS

Purpose : Per-model default parameters

Format : JSON object with model IDs as keys

Supported Parameters:

Parameter Type Range Description
temperature Float ≥ 0 Sampling temperature
top_p Float ≥ 0 Nucleus sampling
max_tokens Integer ≥ 1 Maximum response tokens
stop_sequences String/Array - Stop generation tokens
Provider-specific Various - e.g., anthropic_beta

Only the outer JSON shape (an object of per-model objects) is validated at startup. The parameter values above are validated lazily, the first time a model with configured defaults is used: a wrong type, or a value below the lower bounds shown in the table, fails that request with HTTP 400. The numeric ceilings (for example the usual top_p maximum of 1.0) are enforced by Amazon Bedrock and the target model.

Not the same as a wildcard model name

The keys of this setting match models by ID prefix and take no glob syntax; they select a set of models for the operator's own defaults, where a wildcard model name selects one model for a single request.

Configuration Examples

Basic Parameters:

export DEFAULT_MODEL_PARAMS='{
  "amazon.nova-micro-v1:0": {
    "temperature": 0.3,
    "max_tokens": 800
  }
}'

Provider-Specific Features:

export DEFAULT_MODEL_PARAMS='{
  "anthropic.claude-sonnet-5": {
    "anthropic_beta": ["Interleaved-thinking-2025-05-14"]
  }
}'

Multiple Models:

export DEFAULT_MODEL_PARAMS='{
  "amazon.nova-micro-v1:0": {
    "temperature": 0.3,
    "max_tokens": 500
  },
  "amazon.nova-lite-v1:0": {
    "temperature": 0.7,
    "max_tokens": 2000
  },
  "anthropic.claude-sonnet-5": {
    "temperature": 0.5,
    "top_p": 0.9,
    "anthropic_beta": ["Interleaved-thinking-2025-05-14"]
  }
}'

Advanced Configuration:

export DEFAULT_MODEL_PARAMS='{
  "amazon.nova-pro-v1:0": {
    "temperature": 0.7,
    "top_p": 0.95,
    "max_tokens": 4096,
    "stop_sequences": ["Human:", "Assistant:"]
  }
}'

Parameter Merging

graph LR
    A[Default Parameters] --> B[Merged Config]
    C[Request Parameters] --> B
    B --> D[Final Configuration]
  1. Default parameters are applied first (from DEFAULT_MODEL_PARAMS)
  2. Request parameters override defaults if both are specified
  3. Provider-specific fields are forwarded to Bedrock as additional model request fields
  4. Unsupported fields reach Bedrock as-is, and a field the model rejects surfaces as a ValidationException returned to the client as HTTP 400. Three cases are handled before that: anthropic_beta flags are filtered individually against an allowlist (see ANTHROPIC_BETA_FILTER); a system prompt sent to a model that does not support one is dropped when DROP_UNSUPPORTED_SYSTEM_PROMPT is enabled (the default); and Amazon Nova 2 drops max_tokens when reasoning effort is high, logging a warning

Default Model Service Tiers

Configure default service tiers applied automatically to specific Bedrock models.

What You Can Do

  • Set cost-efficient tiers for batch and agentic workloads by default
  • Configure priority tiers for latency-sensitive models
  • Optimize compute costs without modifying client requests

Available Service Tiers

Tier Description
default Standard compute tier (default)
flex Flexible compute tier for cost optimization
priority Priority compute tier for lower latency
reserved Reserved capacity for dedicated resources (requires AWS contract)

When to Use Each Tier

  • Default: Everyday AI tasks like content generation and text analysis
  • Flex: Cost-sensitive workloads like model evaluations, summarization, and agentic workflows
  • Priority: Mission-critical applications requiring lowest latency
  • Reserved: Predictable workloads needing 99.5% uptime guarantee (requires AWS contact)

Model Support

Not all models support all service tiers. Check the official AWS documentation for each model's supported tiers.

Examples:

  • amazon.nova-pro-v1:0 supports: default, flex, priority (not reserved)
  • amazon.nova-premier-v1:0 (legacy) supports: default, flex, priority, reserved

Tier Precedence

Explicit request parameters take precedence over the tier configured for the model, unless AWS_BEDROCK_ALLOW_SERVICE_TIER_OVERRIDE is disabled.

DEFAULT_MODEL_SERVICE_TIERS

Purpose : Per-model default service tier

Format : JSON object with model IDs as keys and tier string as value

Default : {}

Supported Values:

Value Description
default Standard compute (Bedrock default)
flex Cost-optimized flexible compute
priority Lower-latency priority compute
reserved Dedicated reserved capacity (requires AWS contract)

Not the same as a wildcard model name

The keys of this setting match models by ID prefix and take no glob syntax; they select a set of models for the operator's own defaults, where a wildcard model name selects one model for a single request.

AWS_BEDROCK_ALLOW_SERVICE_TIER_OVERRIDE

Purpose : Control whether clients can select the service tier at request level

Default : true (clients may select a tier)

Cost Consideration : Service tiers are billed at different rates. Set to false on a shared deployment to pin every model to the tier you configured, so a client cannot move its traffic to a more expensive tier. A model with no configured tier still honors the request in either case.

Scope : Applies to models served through the Bedrock Converse and InvokeModel APIs. A Bedrock Mantle-served model carries no configured tier, so its requests always run on the tier they name.

export AWS_BEDROCK_ALLOW_SERVICE_TIER_OVERRIDE=false

Configuration Examples

Single Model:

export DEFAULT_MODEL_SERVICE_TIERS='{
  "amazon.nova-pro-v1:0": "flex"
}'

Multiple Models:

export DEFAULT_MODEL_SERVICE_TIERS='{
  "amazon.nova-pro-v1:0": "flex",
  "amazon.nova-premier-v1:0": "priority"
}'

Service Tier Merging

For models served through the Bedrock Converse and InvokeModel APIs:

  1. Explicit request parameter takes highest priority
  2. HTTP header (X-Amzn-Bedrock-Service-Tier, see Per-Request Service Tier Configuration) overrides defaults
  3. Tier configured on the requested alias (see Model Aliases) applies if the request sets none
  4. Default from DEFAULT_MODEL_SERVICE_TIERS applies if neither does
  5. No service tier passed to Bedrock if unset

Steps 1 and 2 are skipped when AWS_BEDROCK_ALLOW_SERVICE_TIER_OVERRIDE is false and a tier is configured.

On a Bedrock Mantle-served model, only step 1 applies: the request's own service_tier is forwarded as sent, and neither the header, nor an alias' tier, nor DEFAULT_MODEL_SERVICE_TIERS takes part.


Model Aliases

Configure custom aliases to map user-friendly model names to actual model IDs. This enables OpenAI API compatibility and simplifies model references.

What You Can Do

  • Create custom aliases for frequently used models
  • Enable OpenAI-compatible model names by default
  • Simplify model ID references in API requests
  • Migrate between model versions by repointing an alias, without touching client code

Default Aliases

stdapi.ai includes default aliases for OpenAI compatibility:

  • tts-1amazon.polly-standard
  • tts-1-hdamazon.polly-neural
  • whisper-1amazon.transcribe

stdapi.ai also supports dynamic model name aliases matching official provider APIs (OpenAI, Anthropic). You can use model names from provider documentation (e.g., claude-sonnet-5, gpt-oss-20b) which are automatically resolved to their corresponding Amazon Bedrock model identifiers.

MODEL_ALIASES

Purpose : Map alias names to actual model IDs or ARNs

Format : JSON object with alias names as keys, and as values either a model ID or ARN, or an object carrying that model plus the configuration to apply to it

Default : {} (empty, uses built-in defaults only)

Advanced Routing with ARNs

Model aliases can also reference ARNs for Application Inference Profiles or Prompt Routers, enabling advanced routing strategies through friendly alias names. See Using Inference Profile and Prompt Router ARNs for more details.

Aliases That Carry Configuration

An alias may map to an object instead of a model name. Every request naming that alias then gets the configuration attached to it, so one deployment can publish the same model under several names with different tiers, safeguards or defaults.

Every field below is designed around an Amazon Bedrock model call. An alias pointing at a model served by another AWS service — Amazon Polly, Amazon Transcribe, Amazon Comprehend — still resolves the name, and two fields keep working there: extra_params applies wherever the route accepts model parameters, and guardrail_id is enforced on the routes that check content through Amazon Bedrock Guardrails (speech input, transcripts) — a billed guardrail evaluation. service_tier and metadata configure the Bedrock call itself and are ignored on those services.

Field Purpose
model Required. Model ID or ARN the alias resolves to
service_tier Service tier for requests naming the alias, on a model served through the Bedrock Converse or InvokeModel APIs — see Default Model Service Tiers
guardrail_id ID of an Amazon Bedrock Guardrail to apply, requires guardrail_version; guardrail_identifier is accepted as the same field
guardrail_version Version of that guardrail
guardrail_trace Guardrail trace level: disabled, enabled or enabled_full
metadata Key-value metadata attached to the model call, for audit reporting — it reaches Amazon Bedrock model invocation logs, which you enable and deliver yourself, and nothing else: it is not a cost allocation tag, see AWS Cost Attribution
extra_params Model parameters, in the format of DEFAULT_MODEL_PARAMS
export MODEL_ALIASES='{
  "support-assistant": {
    "model": "amazon.nova-lite-v1:0",
    "service_tier": "flex",
    "guardrail_id": "abc123def456",
    "guardrail_version": "1",
    "metadata": {"team": "support"},
    "extra_params": {"temperature": 0.2}
  }
}'

Precedence

Each field resolves in one order: the request, then the alias, then the server-wide setting for that field. A field the alias leaves unset falls through to the server-wide value, and a client that sends nothing gets the alias' configuration.

The two settings that decide whether a request may override an administrator's value apply to the alias layer as well:

Startup Validation

An alias object is validated when the server starts: an unknown field, a missing model, a guardrail ID without its version, or an out-of-range extra_params value stops startup with an error naming the alias. A typo never becomes a silently ignored setting.

An alias whose guardrail_id targets a model served through Bedrock Mantle also stops startup: Amazon Bedrock Guardrails do not apply to those models, and serving them unfiltered while a guardrail is configured would be a silent gap. Point the alias at another model, or — when the model is also available on the classic endpoint — remove it from AWS_BEDROCK_MANTLE_PREFERRED_MODELS so it is served where guardrails apply.

Scope on Bedrock Mantle models

On a Bedrock Mantle-served model, guardrail_id is rejected at startup as above, and service_tier, metadata and extra_params — like the server-wide DEFAULT_MODEL_SERVICE_TIERS and DEFAULT_MODEL_PARAMS — do not apply. Such a request runs on the tier it names itself, and on that model's default tier when it names none.

Configuration Examples

Basic Alias:

export MODEL_ALIASES='{
  "my-tts": "amazon.polly-neural",
  "my-stt": "amazon.transcribe"
}'

Override Default Aliases:

# Override the default tts-1 mapping
export MODEL_ALIASES='{
  "tts-1": "amazon.polly-generative"
}'

Multiple Custom Aliases:

export MODEL_ALIASES='{
  "fast-model": "amazon.nova-micro-v1:0",
  "balanced-model": "amazon.nova-lite-v1:0",
  "quality-model": "amazon.nova-pro-v1:0",
  "claude": "anthropic.claude-sonnet-5"
}'

Map OpenAI Models to Bedrock:

# Make OpenAI model names work with Amazon Bedrock models
export MODEL_ALIASES='{
  "gpt-5": "anthropic.claude-sonnet-5",
  "gpt-4o": "anthropic.claude-sonnet-5",
  "gpt-4o-mini": "anthropic.claude-haiku-4-5-20251001-v1:0",
  "dall-e-3": "amazon.nova-canvas-v1:0",
  "dall-e-2": "stability.stable-image-ultra-v1:1"
}'

Override Deprecated Models:

# Redirect deprecated model IDs to their newer replacements
export MODEL_ALIASES='{
  "amazon.titan-image-generator-v1": "amazon.nova-canvas-v1:0",
  "amazon.titan-text-express-v1": "amazon.nova-lite-v1:0",
  "anthropic.claude-3-5-sonnet-20240620-v1:0": "anthropic.claude-sonnet-5",
  "stability.stable-image-ultra-v1:0": "stability.stable-image-ultra-v1:1"
}'

Advanced Routing with ARNs:

# Map friendly names to Application Inference Profiles or Prompt Routers
export MODEL_ALIASES='{
  "my-router": "arn:aws:bedrock:us-east-1:123456789012:default-prompt-router/cost-optimizer",
  "my-profile": "arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123xyz"
}'

Using Aliases in API Requests

Once configured, aliases can be used anywhere a model ID is expected:

# Using the default tts-1 alias
curl https://api.example.com/v1/audio/speech \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-1",
    "input": "Hello world",
    "voice": "alloy"
  }'

# Using a custom alias
curl https://api.example.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "fast-model",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Alias Resolution

graph LR
    A[Model Name] --> B{Exact Model ID?}
    B -->|Yes| F[Resolved Model]
    B -->|No| C{Exact Alias?}
    C -->|Yes| F
    C -->|No| D{Deprecated Model?}
    D -->|Yes| F
    D -->|No| E{Wildcard Pattern?}
    E -->|Yes| F
    E -->|No| G[404 Not Found]
  1. An exact model ID wins outright, a model served through Bedrock Mantle included.
  2. An exact alias resolves next — a built-in default or one set in MODEL_ALIASES. An alias configured with a name that happens to look like a wildcard pattern — claude-*, say — is still a plain alias, and it wins here, before pattern resolution is ever tried; worth knowing, because it is easy to configure by accident.
  3. A deprecation replacement applies to a name AWS_BEDROCK_DEPRECATED_MODEL_FALLBACK covers.
  4. A wildcard pattern resolves last, only once none of the above named a model.

The resolved model is validated and used for the request; a name matching none of the above answers 404. The response names the concrete model that served the request, never the alias or the pattern it was sent as — except POST /v1/moderations, which echoes the model value the caller sent, by design.

Model Wildcard Patterns

Anywhere a request names a model, it may name a glob pattern instead of an exact name, and the server serves the most recently released match — the same release date GET /search_models publishes as start_of_life_time and GET /v1/models publishes as created for each model.

  • Glob syntax only* and ?, case-sensitive; no regular expressions, no character classes ([...] is refused with 400, not treated as a class or as a literal). claude-sonnet-*, claude-opus-* and amazon.nova-* all work.
  • At least three characters before the first * or ?. A broader pattern is refused with 400, and a bare * is never accepted.
  • At most 255 characters. A longer pattern is refused with 400.
  • Matched against both model IDs and aliases.
  • Scoped to the endpoint called — the same pattern can resolve to a different model on chat than on embeddings.
  • Resolved once, when the request is accepted. A batch job created with a pattern is pinned to the model that pattern meant that day, and reports that concrete model for its whole life.
  • Never a legacy model, a model AWS_BEDROCK_DEPRECATED_MODEL_FALLBACK covers, or a model whose first use would open a paid Marketplace subscription. Name one of those explicitly and it still resolves exactly as it does today; a pattern only ever skips over it.
  • A model whose release date the server cannot order is never selected by a pattern, and its presence never makes an otherwise-unique match ambiguous — a property of that model, not of any particular catalogue. On POST /v1/audio/speech every model is one of these — Polly carries no release date — so a pattern there is accepted but never matches anything, and always answers 404.

Ambiguity is refused, never guessed

When two or more matches were released on the same date, the request fails with 400 naming them, and asks you to name one explicitly or narrow the pattern. openai.gpt-5.6-* (Sol, Terra and Luna, released together) and stability.* on the image routes are real examples: sibling models released together are often priced differently, so picking one would spend your money on a model you never named.

Use GET /search_models?model=<pattern> to see everything a pattern matches, newest first, before relying on it in a request — the recommended way to check what a pattern will do.

Two routes take a concrete model only, never a pattern: POST /v1/moderations resolves the model before the request is examined, and POST /v1/realtime/client_secrets fixes the model into the ephemeral token before a connection exists — the realtime WebSocket endpoint's own model parameter does accept a pattern.


System Prompt Handling

Control how system prompts are handled for models that don't support them.

DROP_UNSUPPORTED_SYSTEM_PROMPT

Purpose : Control system prompt behavior for models that don't support system prompts

Type : Boolean

Default : true

# Default: silently drop system prompts for unsupported models
export DROP_UNSUPPORTED_SYSTEM_PROMPT=true

# Strict mode: return error when system prompt is used with unsupported model
export DROP_UNSUPPORTED_SYSTEM_PROMPT=false

Models Without System Prompt Support

Some Bedrock models don't support system prompts, including:

  • mistral.mistral-7b-instruct-v0:2
  • mistral.mixtral-8x7b-instruct-v0:1
  • Other older or specialized models

Use Cases

Enable (true, default) for:

  • Backward compatibility - Existing applications continue working
  • Model flexibility - Switch between models without code changes
  • Graceful degradation - System prompts are ignored instead of failing
  • Global system prompts - Applications that set a system prompt for every model keep working against models that do not accept one

Disable (false) for:

  • Strict validation - Catch configuration errors early
  • Debugging - Identify when system prompts aren't being used
  • Security requirements - Ensure system prompts are always applied

Anthropic Beta Flag Filtering

Anthropic-compatible clients like Claude Code send anthropic-beta headers with experimental beta flags. Many of these flags (such as files-api-2025-04-14, prompt-caching-2024-07-31) are not supported by Amazon Bedrock and cause ValidationException errors (HTTP 400).

stdapi.ai automatically filters out unsupported flags while preserving supported ones, so clients work without any special configuration. Previously, the workaround was to set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 on the client side, but this also disabled Bedrock-supported flags like Interleaved-thinking-2025-05-14 and token-efficient-tools-2025-02-19, degrading capabilities. This workaround is no longer needed.

Filtering is controlled by two settings: ANTHROPIC_BETA_FILTER to enable or disable it, and ANTHROPIC_BETA_ALLOWLIST to extend the built-in set of allowed flags.

ANTHROPIC_BETA_FILTER

Purpose : Enable or disable filtering of unsupported anthropic_beta flags for Anthropic Claude models

Type : Boolean

Default : true

Behavior : When enabled, anthropic_beta flags not in the allowlist are silently removed from requests before they reach Bedrock. A warning is logged when flags are filtered. When disabled, all flags are passed through to Bedrock as-is

# Enabled (default) - filter unsupported flags automatically
# No environment variable needed

# Disable filtering entirely (pass all flags through to Bedrock)
export ANTHROPIC_BETA_FILTER=false

When to Disable

Set to false only when:

  • Testing - You want to verify Bedrock behavior with specific flags directly
  • Custom setups - You manage flag compatibility at the client level

ANTHROPIC_BETA_ALLOWLIST

Purpose : Add extra anthropic_beta flags to the built-in set of Bedrock-supported flags

Format : Comma-separated string of additional beta flag names

Default : Empty (only the built-in Bedrock defaults are used)

Behavior : The flags specified here are merged with the built-in set of Bedrock-supported flags. You only need to specify extra flags beyond the defaults (e.g., newly added Bedrock flags). Only effective when ANTHROPIC_BETA_FILTER is true

# Use built-in defaults only (recommended) - no environment variable needed

# Add newly supported Bedrock flags without waiting for a stdapi.ai update
export ANTHROPIC_BETA_ALLOWLIST='new-feature-2026-03-01,another-flag-2026-04-01'

Built-in Allowed Flags:

Flag Feature
computer-use-2024-10-22 Computer use (Claude 3.5)
computer-use-2025-01-24 Computer use (Claude 3.7)
computer-use-2025-11-24 Computer use (Claude 4.5/4.6)
token-efficient-tools-2025-02-19 Token efficient tools
Interleaved-thinking-2025-05-14 Interleaved thinking
output-128k-2025-02-19 128K output
dev-full-thinking-2025-05-14 Raw thinking dev mode
context-1m-2025-08-07 1M context
context-management-2025-06-27 Context management (memory)
effort-2025-11-24 Effort control
tool-search-tool-2025-10-19 Tool search
tool-examples-2025-10-29 Tool use examples

Use Cases

Filtering enabled (default) for:

  • Claude Code via Bedrock - Clients work without CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
  • Production stability - Prevent unsupported flags from causing request failures
  • Drop-in compatibility - Clients configured for direct Anthropic API work through stdapi.ai without changes

EXTRA_MODEL_PARAMS_DENYLIST

Purpose : Add extra parameter names to strip from the "extra model parameters" passthrough (any undeclared top-level JSON field on a chat or non-chat route, forwarded to Bedrock as a provider-specific inference field)

Format : Comma-separated string of additional parameter names

Default : Empty (only the built-in denylist is used)

Behavior : The names specified here are merged with the built-in denylist of LiteLLM client-control parameters (such as drop_params, api_key, custom_llm_provider) that some OpenAI-SDK-based clients leak into extra_body and that are never legitimate Bedrock model parameters — for example RAGFlow hardcodes extra_body={"drop_params": True} on every embeddings call, which previously reached Bedrock as an unrecognized inference field and failed with ValidationException. Every other extra parameter keeps being forwarded as before. Only effective when EXTRA_MODEL_PARAMS_DROP_ALL is false

# Use the built-in denylist only (recommended) - no environment variable needed

# Also strip a project-specific control field some client leaks into requests
export EXTRA_MODEL_PARAMS_DENYLIST='x_internal_debug_flag,x_proxy_trace_id'

Not the same as a wildcard model name

This denylist matches parameter names, and separately, the settings above it match models by ID prefix — neither takes glob syntax. A wildcard model name is a different mechanism again: it selects one model for a single request, not a set of parameters or models for the operator's own configuration.

EXTRA_MODEL_PARAMS_DROP_ALL

Purpose : Disable the "extra model parameters" passthrough entirely

Type : Boolean

Default : false

Behavior : When enabled, no undeclared request field is ever forwarded to Bedrock as a provider-specific inference parameter, on every route that supports the passthrough (chat completions/responses/messages, and embeddings/images/audio/rerank/etc.). This overrides EXTRA_MODEL_PARAMS_DENYLIST: with drop-all enabled, denylist filtering no longer matters because nothing is forwarded. Per-model defaults configured through DEFAULT_MODEL_PARAMS are unaffected — only request-supplied extras are dropped

# Keep the passthrough (default) - no environment variable needed

# Lock the deployment down to only declared API fields
export EXTRA_MODEL_PARAMS_DROP_ALL=true

When to Enable

Set to true only when you need to guarantee that no undeclared client field ever reaches Bedrock, for example a strict multi-tenant deployment where provider-specific knobs must go through an explicit allowlisted mechanism instead of the passthrough.


Image Generation

IMAGE_GENERATION_MODEL

Purpose : Default Bedrock image model ID used when the image_generation integrated tool is invoked via the Responses API. The tool intercepts requests from any text model, generates the image against this Bedrock image model, and returns an image_generation_call output item.

Type : String (Bedrock image model ID)

Default : None — the tool returns HTTP 400 if no model is configured and the request does not specify one

Behavior : The tool definition in the request may include a model field to override this default per call. Priority: request model field > this env var. Any available Bedrock image generation model can be used — for example amazon.nova-canvas-v1:0, amazon.titan-image-generator-v2:0, or the Stability AI Stable Image / Stable Diffusion family. Legacy models (such as amazon.titan-image-generator-v1 and stability.stable-diffusion-xl-v1) are hidden unless AWS_BEDROCK_LEGACY is enabled. Use the Search Models API to list the image models available in your deployment.

export IMAGE_GENERATION_MODEL='amazon.nova-canvas-v1:0'

With this set, any text model can generate images via the Responses API:

curl -X POST "$BASE/v1/responses" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "amazon.nova-micro-v1:0",
    "input": "Generate a sunset over the ocean.",
    "tools": [{"type": "image_generation"}],
    "tool_choice": "required"
  }'