Skip to content

AWS Bedrock

AWS Bedrock supports multiple model families (Claude, Nova, Mistral, Llama, Cohere, Titan) with significant structural differences from OpenAI’s format. DeepIntShield performs extensive conversion including:

  • Model family detection - Automatic routing based on model ID to handle family-specific parameters
  • Parameter renaming - e.g., max_completion_tokensmaxTokens, stopstopSequences
  • Reasoning transformation - reasoning parameters mapped to model-specific thinking/reasoning structures (Anthropic, Nova)
  • Tool restructuring - Function definitions converted to Bedrock’s ToolConfig format
  • Message conversion - System message extraction, tool message grouping, image format adaptation (base64 only)
  • AWS authentication - Automatic SigV4 request signing with credential chain support
  • Structured output - response_format converted to specialized tool definitions
  • Service tier & guardrails - Support for Bedrock-specific performance and safety configurations
FamilyChatResponsesTextEmbeddingsImage GenerationImage EditImage Variation
Claude (Anthropic)
Nova (Anthropic)
Mistral
Llama
Cohere
Titan
OperationNon-StreamingStreamingEndpoint
Chat Completionsconverse
Responses APIconverse
Text Completionsinvoke
Embeddings-invoke
Files-S3 (via SDK)
Batch-batch
List Models-listFoundationModels
Image Generationinvoke
Image Editinvoke
Image Variationinvoke
Count Tokens-count-tokens
Speech (TTS)-
Transcriptions (STT)-

ParameterTransformationNotes
max_completion_tokensinferenceConfig.maxTokensRequired field in Bedrock
temperature, top_pDirect pass-through to inferenceConfig
stopinferenceConfig.stopSequencesArray of strings
response_format→ Structured output tool (see Structured Output)Creates bf_so_* tool
toolsSchema restructured (see Tool Conversion)
tool_choiceType mapped (see Tool Conversion)
reasoningModel-specific thinking config (see Reasoning / Thinking)
usermetadata.userID (if provided)Bedrock-specific metadata
service_tierserviceModelTier (if provided)Performance tier selection
top_kVia extra_params (model-specific)Bedrock-specific sampling

The following parameters are silently ignored: frequency_penalty, presence_penalty, logit_bias, logprobs, top_logprobs, seed, parallel_tool_calls

Use extra_params (SDK) or pass directly in request body (Gateway) for Bedrock-specific fields:

Terminal window
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0",
"messages": [{"role": "user", "content": "Hello"}],
"guardrailConfig": {
"guardrailIdentifier": "guardrail-id",
"guardrailVersion": "1",
"trace": "enabled"
},
"performanceConfig": {
"latency": "optimized"
}
}'

Available Extra Parameters:

  • guardrailConfig - Bedrock guardrail configuration with guardrailIdentifier, guardrailVersion, trace
  • performanceConfig - Performance optimization with latency (“optimized” or “standard”)
  • additionalModelRequestFieldPaths - Pass-through for model-specific fields not in standard schema
  • promptVariables - Variables for prompt templates (if using prompt caching)
  • requestMetadata - Custom metadata for request tracking

Prompt caching is supported via cache control directives:

Terminal window
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "This context will be cached",
"cache_control": {"type": "ephemeral"}
}
]
}
],
"system": [
{
"type": "text",
"text": "You are a helpful assistant",
"cache_control": {"type": "ephemeral"}
}
]
}'

Documentation: See DeepIntShield Reasoning Reference

Reasoning/thinking support varies by model family:

Parameter Mapping:

  • reasoning.effortthinkingConfig.type = "enabled" (always enabled when reasoning present)
  • reasoning.max_tokensthinkingConfig.budgetTokens (token budget for thinking)

Critical Constraints:

  • Minimum budget: 1024 tokens required; requests below this fail with error
  • Dynamic budget: -1 is converted to 1024 automatically
// Request
{"reasoning": {"effort": "high", "max_tokens": 2048}}
// Bedrock conversion
{"thinkingConfig": {"type": "enabled", "budgetTokens": 2048}}

Parameter Mapping:

  • reasoning.effortreasoningConfig.thinkingLevel (“low” → low, “high” → high)
  • reasoning.max_tokens → Max reasoning tokens (affects inference configuration)
// Request
{"reasoning": {"effort": "high", "max_tokens": 10000}}
// Bedrock conversion
{"reasoningConfig": {"type": "enabled", "thinkingLevel": "high"}}
  • System message extraction: System messages are removed from messages array and placed in separate system field
  • Tool message grouping: Consecutive tool messages are merged into single user message with tool result content blocks
  • Image format: Only base64/data URI supported; remote image URLs are not supported by Bedrock Converse API
  • Document support: DeepIntShield’s Bedrock conversion path currently supports PDF, CSV, DOC, DOCX, XLS, XLSX, HTML, TXT, MD formats

The Chat Completions request format is OpenAI-compatible for standard blocks (type: "text", type: "image_url", type: "file"). DeepIntShield converts these blocks to Bedrock Converse blocks internally. Bedrock-specific extensions (for example, standalone cachePoint) are also accepted when using the Bedrock provider.

Block TypeRequest Shape (DeepIntShield/OpenAI)Bedrock HandlingSupport
Text{"type":"text","text":"..."}Converted to Bedrock text block
Image{"type":"image_url","image_url":{"url":"data:image/png;base64,..."}}Converted to Bedrock image.source.bytes✅ (base64/data URI only)
File{"type":"file","file":{...}}Converted to Bedrock document block
Input audio{"type":"input_audio",...}Returns audio input not supported in Bedrock Converse API
Standalone cache point{"cachePoint":{"type":"default"}} (no outer type field)Converted to Bedrock cachePoint marker✅ (Bedrock-specific extension)
  • Request shape (client → DeepIntShield): type: "image_url" with image_url.url set to a data URI/base64 image
  • Internal Bedrock shape (DeepIntShield → Bedrock): Converted to image: { format, source: { bytes } }
  • URL images: ❌ Not supported - Will fail if attempted
  • Documents: Converted to document content blocks with MIME types
Terminal window
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "What is in this image?"},
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}
}
]
}
]
}'

File Block Example (file → Bedrock document)

Section titled “File Block Example (file → Bedrock document)”
Terminal window
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Summarize this document."},
{
"type": "file",
"file": {
"file_data": "JVBERi0xLjQKJcfs...",
"filename": "report.pdf",
"file_type": "application/pdf"
}
}
]
}
]
}'

Note: file_data is raw base64-encoded content (no data: URI prefix, unlike image_url).

Formats currently supported by DeepIntShield’s Bedrock document conversion path: pdf, txt, md, html, csv, doc, docx, xls, xlsx.

Standalone Cache Point Example (Bedrock-specific)

Section titled “Standalone Cache Point Example (Bedrock-specific)”
{
"role": "system",
"content": [
{"type": "text", "text": "Long context to cache"},
{"cachePoint": {"type": "default"}}
]
}

This standalone cachePoint block is a DeepIntShield/Bedrock extension (not OpenAI-standard) and should be used only with the Bedrock provider.

  • input_audio blocks are not supported by Bedrock Converse and return an error.
  • For chat content conversion, use file.file_data for document payloads. file_url and file_id are not the documented Bedrock chat-content path here.

Cache directives supported on:

  • System content blocks (entire system message)
  • User message content blocks (specific parts)
  • Tool definitions within tool configuration

Tool definitions are restructured:

  • function.namename (preserved)
  • function.parametersinputSchema (Schema format)
  • function.strict → Dropped (not supported by Bedrock)
OpenAIBedrock
"auto"auto (default)
"none"Omitted (not explicitly supported)
"required"any
Specific tool{type: "tool", name: "X"}

Tool calls are converted between formats:

  • DeepIntShield → Bedrock: Tool call arguments converted from JSON object to input field
  • Bedrock → DeepIntShield: Tool use results with toolUseId, converted back to DeepIntShield format
  • Tool results: Merged consecutive tool messages into single user message

Structured output uses a special tool-based approach:

// Request with structured output
{
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "response",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "number"}
}
}
}
}
}
// Bedrock conversion (internal)
{
"tools": [{
"name": "bf_so_response",
"description": "Structured output tool",
"inputSchema": {
"type": "object",
"properties": {...}
}
}],
"toolChoice": {"type": "tool", "name": "bf_so_response"}
}
// Response extraction
// Tool use input is extracted and returned as contentStr
  • stopReasonfinish_reason: endTurn/stopSequencestop, maxTokenslength, toolUsetool_calls
  • usage.inputTokens + usage.cacheReadInputTokens + usage.cacheWriteInputTokensprompt_tokens (all cache counts rolled into the total)
  • Cache token breakdown surfaced in prompt_tokens_details:
    • usage.cacheReadInputTokensprompt_tokens_details.cached_read_tokens
    • usage.cacheWriteInputTokensprompt_tokens_details.cached_write_tokens
  • usage.outputTokenscompletion_tokens
  • reasoning/thinking blocks → reasoning_details with index, type, text, and signature
  • Tool call input (object) → arguments (JSON string)

When structured output is detected:

  • Tool call with name bf_so_* is treated as structured output
  • input object is extracted and returned as contentStr
  • Removed from toolCalls array

Event sequence from Bedrock Converse Stream API:

  1. Initial message role: contentBlockIndex and role information
  2. Content block starts: toolUse blocks with toolUseId, name
  3. Content block deltas:
    • Text delta: Incremental text content
    • Tool use delta: Accumulated tool call arguments (JSON)
    • Reasoning delta: Reasoning text and optional signature
  4. Message completion: stopReason and final token counts
  5. Usage metrics: Token counts, cached tokens, performance metrics

Streaming event conversion:

  • Each Bedrock streaming event → Multiple DeepIntShield chunks as needed
  • Tool arguments accumulated across deltas and emitted on block end
  • Reasoning content emitted with signature if present

Not supported - AWS Bedrock’s text completion API does not support streaming.

Streaming responses use OpenAI-compatible lifecycle events:

  • response.created
  • response.in_progress
  • content_part.start
  • content_part.delta
  • content_part.done
  • function_call_arguments.delta
  • function_call_arguments.done
  • output_item.done

Special handling:

  • Tool arguments accumulated across deltas
  • Content block indices mapped to output indices
  • Synthetic events emitted for text/reasoning content

The Responses API uses the same underlying converse endpoint but converts between OpenAI’s Responses format and Bedrock’s Messages format.

ParameterTransformation
max_output_tokensRenamed to maxTokens (via inferenceConfig)
temperature, top_pDirect pass-through
instructionsBecomes system message
toolsSchema restructured (see Chat Completions)
tool_choiceType mapped (see Chat Completions)
reasoningMapped to thinking/reasoning config (see Reasoning / Thinking)
textConverted to output_format (Bedrock-specific)
includeVia extra_params (Bedrock-specific)
stopVia extra_params, renamed to stopSequences
truncationAuto-set to "auto" for computer tools

Use extra_params (SDK) or pass directly in request body (Gateway):

Terminal window
curl -X POST http://localhost:8080/v1/responses \
-H "Content-Type: application/json" \
-d '{
"model": "bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0",
"input": "Hello, how are you?",
"stop": ["###"]
}'
  • Input: String wrapped as user message or array converted to messages
  • Instructions: Becomes system message (same extraction as Chat Completions)
  • Cache control: Supported on instructions (system) and input messages
  • stopReasonstatus: endTurn/stopSequencecompleted, maxTokensincomplete
  • usage.inputTokens is aggregated into input_tokens (same semantics as Chat: Bedrock’s inputTokens + cacheReadInputTokens + cacheWriteInputTokens rolled up into input_tokens); usage.outputTokensoutput_tokens (preserved as-is)
  • Cache tokens: cacheReadInputTokensinput_tokens_details.cached_read_tokens | cacheWriteInputTokensinput_tokens_details.cached_write_tokens
  • Output items: textmessage | toolUsefunction_call | thinkingreasoning

Event sequence: response.createdresponse.in_progresscontent_part.startcontent_part.deltacontent_part.doneoutput_item.done


Request conversion:

  • Claude models: Uses Anthropic’s /v1/complete format with prompt wrapping

    • prompt auto-wrapped with \n\nHuman: {prompt}\n\nAssistant:
    • max_tokensmax_tokens_to_sample
    • temperature, top_p direct pass-through
    • top_k, stop via extra_params
  • Mistral models: Uses standard format

    • max_tokensmax_tokens
    • temperature, top_p direct pass-through
    • stopstop

Response conversion:

  • Claude: completionchoices[0].text
  • Mistral: outputs[].textchoices[] (supports multiple)
  • stopReasonfinish_reason

Supported embedding models: Titan, Cohere

ParameterTransformationNotes
inputDirect pass-throughText or array of texts
dimensions⚠️ Not supportedTitan has fixed dimensions per model
encoding_formatVia extra_params”base64” or “float”

Titan-specific:

  • No dimension customization
  • Fixed output size per model version

Cohere-specific:

  • Reuses Cohere format conversion
  • Similar parameter mapping to standard Cohere
  • Titan: embedding → single embedding vector
  • Cohere: Reuses Cohere response format with embeddings array
  • usage.inputTokensusage.prompt_tokens

Supported image generation models: Titan Image Generator v1, Titan Image Generator v2, Nova Canvas v1

Parameter(DeepIntShield)Transformation (Bedrock)
prompttextToImageParams.text
nimageGenerationConfig.numberOfImages
negativePrompttextToImageParams.negativeText
seedimageGenerationConfig.seed
qualityimageGenerationConfig.quality (see Quality Mapping)
styletextToImageParams.style
sizeimageGenerationConfig.width & imageGenerationConfig.height

The quality parameter is automatically mapped to Bedrock’s expected format:

Input ValueBedrock ValueNotes
"low""standard"Mapped automatically
"medium""standard"Mapped automatically
"high""premium"Mapped automatically
"default""standard"Passed through (case-insensitive)
"premium""premium"Passed through (case-insensitive)
Parameter(Bedrock)Transformation (DeepIntShield)
imagesdata.b64_json
Terminal window
curl -X POST http://localhost:8080/v1/images/generations \
-H "Content-Type: application/json" \
-d '{
"model": "bedrock/amazon.nova-canvas-v1:0",
"prompt": "A futuristic cityscape with a flying car",
"size": "1024x1024",
"seed": 123,
"negative_prompt": "bikes",
"n": 2
}'

Supported image edit models: Titan Image Generator v1, Titan Image Generator v2, Nova Canvas v1

Bedrock supports three image edit task types: INPAINTING, OUTPAINTING, and BACKGROUND_REMOVAL. The type field is required and must be one of these values.

Request Parameters

ParameterTypeRequiredNotes
modelstringModel identifier (must be Titan or Nova Canvas model)
typestringEdit type: "inpainting", "outpainting", or "background_removal"
promptstringText description of the edit (required for inpainting/outpainting)
image[]binaryImage file(s) to edit (only first image used)
maskbinaryMask image file (for inpainting/outpainting)
nintNumber of images to generate (1-10, for inpainting/outpainting only)
sizestringImage size: "WxH" format (e.g., "1024x1024", for inpainting/outpainting only)
qualitystringImage quality (for inpainting/outpainting only). See Quality Mapping for supported values.
cfgScalefloatCFG scale (via ExtraParams["cfgScale"], for inpainting/outpainting only)
negative_textstringNegative prompt (via ExtraParams["negative_text"], for inpainting/outpainting only)
mask_promptstringMask prompt (via ExtraParams["mask_prompt"], for inpainting/outpainting only)
return_maskboolReturn mask in response (via ExtraParams["return_mask"], for inpainting/outpainting only)
outpainting_modestringOutpainting mode (via ExtraParams["outpainting_mode"], outpainting only): "DEFAULT" or "PRECISE"

Request Conversion

  • Task Type Mapping: Params.Type is mapped to taskType:
    • "inpainting""INPAINTING"
    • "outpainting""OUTPAINTING"
    • "background_removal""BACKGROUND_REMOVAL"
    • Any other value returns an error: "unsupported type for Bedrock"
  • Image Conversion: First image in Input.Images is converted to base64: image.Image → base64 string
  • Task-Specific Parameters:
    • INPAINTING: Uses inPaintingParams:
      • promptinPaintingParams.text
      • image (base64) → inPaintingParams.image
      • mask (if present) → inPaintingParams.maskImage (base64)
      • negative_text (via ExtraParams) → inPaintingParams.negativeText
      • mask_prompt (via ExtraParams) → inPaintingParams.maskPrompt
      • return_mask (via ExtraParams) → inPaintingParams.returnMask
    • OUTPAINTING: Uses outPaintingParams:
      • promptoutPaintingParams.text
      • image (base64) → outPaintingParams.image
      • mask (if present) → outPaintingParams.maskImage (base64)
      • negative_text (via ExtraParams) → outPaintingParams.negativeText
      • mask_prompt (via ExtraParams) → outPaintingParams.maskPrompt
      • return_mask (via ExtraParams) → outPaintingParams.returnMask
      • outpainting_mode (via ExtraParams, validated to "DEFAULT" or "PRECISE") → outPaintingParams.outPaintingMode
    • BACKGROUND_REMOVAL: Uses backgroundRemovalParams:
      • image (base64) → backgroundRemovalParams.image
      • No other parameters supported
  • Image Generation Config (for INPAINTING and OUTPAINTING only):
    • nimageGenerationConfig.numberOfImages
    • sizeimageGenerationConfig.width and imageGenerationConfig.height (parsed from "WxH" format)
    • qualityimageGenerationConfig.quality (see Quality Mapping)
    • cfgScale (via ExtraParams["cfgScale"]) → imageGenerationConfig.cfgScale

Response Conversion

  • Uses the same response structure as image generation: BedrockImageGenerationResponseDeepIntShieldImageGenerationResponse
  • Response includes:
    • images[]: Array of base64-encoded images
    • maskImage: Base64-encoded mask image (if return_mask was true)
    • error: Error message (if present)

Endpoint: Same as image generation: invoke endpoint

Streaming: Image edit streaming is not supported by Bedrock.


Supported image variation models: Titan Image Generator v1, Titan Image Generator v2, Nova Canvas v1

Request Parameters

ParameterTypeRequiredNotes
modelstringModel identifier (must be Titan or Nova Canvas model)
imagebinaryImage file to create variations from (supports multiple images via image[])
nintNumber of images to generate (1-10)
sizestringImage size: "WxH" format (e.g., "1024x1024")
qualitystringImage quality. See Quality Mapping for supported values.
cfgScalefloatCFG scale (via ExtraParams["cfgScale"])
promptstringPrompt/text for variation (via ExtraParams["prompt"])
negativeTextstringNegative prompt (via ExtraParams["negativeText"])
similarityStrengthfloatSimilarity strength (via ExtraParams["similarityStrength"]): Range 0.2 to 1.0

Request Conversion

  • Task Type: taskType is set to "IMAGE_VARIATION"
  • Image Conversion: All images are converted to base64 strings:
    • Primary image: Input.Image.Image → base64 string → imageVariationParams.images[0]
    • Additional images: ExtraParams["images"] (stored as [][]byte by HTTP handler) → base64 strings → appended to imageVariationParams.images[]
  • Image Variation Parameters:
    • prompt (via ExtraParams["prompt"]) → imageVariationParams.text
    • negativeText (via ExtraParams["negativeText"]) → imageVariationParams.negativeText
    • similarityStrength (via ExtraParams["similarityStrength"]) → imageVariationParams.similarityStrength (validated to range [0.2, 1.0])
  • Image Generation Config:
    • nimageGenerationConfig.numberOfImages
    • sizeimageGenerationConfig.width and imageGenerationConfig.height (parsed from "WxH" format)
    • quality (via ExtraParams["quality"]) → imageGenerationConfig.quality (see Quality Mapping)
    • cfgScale (via ExtraParams["cfgScale"]) → imageGenerationConfig.cfgScale

Response Conversion

  • Uses the same response structure as image generation: BedrockImageGenerationResponseDeepIntShieldImageGenerationResponse
  • Response includes:
    • images[]: Array of base64-encoded image variations
    • error: Error message (if present)

Endpoint: Same as image generation: invoke endpoint

Streaming: Image variation streaming is not supported by Bedrock.


Request formats: requests array (CustomID + Params) or input_file_id

Pagination: Cursor-based with afterId, beforeId, limit

Endpoints:

  • POST /batch - Create batch
  • GET /batch - List batches
  • GET /batch/{batch_id} - Retrieve batch
  • POST /batch/{batch_id}/cancel - Cancel batch

Response: JSONL format with {recordId, modelOutput: {...}} or {recordId, error: {...}}

Status mapping:

Bedrock StatusDeepIntShield Mapping
Submitted, ValidatingValidating
InProgressInProgress
CompletedCompleted
Failed, PartiallyCompletedFailed
StoppingCancelling
StoppedCancelled
ExpiredExpired

Note: RFC3339Nano timestamps converted to Unix timestamps, multi-key retry supported


Upload: Multipart/form-data with file (required) and filename (optional)

Field mapping:

  • id (file ID)
  • filename
  • size_bytes (from S3 object size)
  • created_at (Unix timestamp from S3 LastModified)
  • mime_type (derived from content or explicitly set)

Endpoints:

  • POST /v1/files - Upload
  • GET /v1/files - List (cursor pagination)
  • GET /v1/files/{file_id} - Retrieve metadata
  • DELETE /v1/files/{file_id} - Delete
  • GET /v1/files/{file_id}/content - Download content

Note: File purpose always "batch", status always "processed"


Request: GET /v1/models (no body)

Field mapping:

  • id (model name with deployment prefix if applicable)
  • display_namename
  • created_at (Unix timestamp)

Pagination: Token-based with NextPageToken, FirstID, LastID

Filtering:

  • Region-based model filtering
  • Deployment mapping from configuration
  • Model allowlist support (allowed_models config)

Multi-key support: Results aggregated from all keys, filtered by allowedModels if configured


DeepIntShield signs every Bedrock request with AWS Signature Version 4 (SigV4). Credentials are resolved in the following priority order, and STS AssumeRole can be layered on top of any of them.

Provide access_key and secret_key directly in bedrock_key_config. Optionally include a session_token for pre-obtained temporary credentials.

{
"bedrock_key_config": {
"access_key": "your-aws-access-key",
"secret_key": "your-aws-secret-key",
"session_token": "optional-session-token",
"region": "us-east-1"
}
}

2. Default Credential Chain (IAM Role / Instance Profile)

Section titled “2. Default Credential Chain (IAM Role / Instance Profile)”

Leave access_key and secret_key empty (or omit them). DeepIntShield calls AWS LoadDefaultConfig which automatically resolves credentials from the environment in this order:

  • Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN)
  • EKS IRSA (AWS_WEB_IDENTITY_TOKEN_FILE + AWS_ROLE_ARN)
  • ECS task role
  • EC2 instance profile (IMDS)
  • ~/.aws/credentials default profile
{
"bedrock_key_config": {
"region": "us-east-1"
}
}

Set role_arn to assume an IAM role before signing requests. AssumeRole requires a valid source identity — it works when credentials are available either via explicit access_key/secret_key in key config, or via the default credential chain (environment variables, EC2 instance profile, ECS task role, EKS IRSA, etc.). If no credentials are available from either source, AssumeRole will fail.

{
"bedrock_key_config": {
"role_arn": "arn:aws:iam::123456789012:role/BedrockRole",
"external_id": "optional-external-id",
"session_name": "my-session",
"region": "us-east-1"
}
}
FieldRequiredDefaultNotes
role_arnYes (for STS)-IAM role ARN to assume
external_idNo-Required when the role’s trust policy demands it
session_nameNodeepintshield-sessionIdentifies the session in CloudTrail logs

How to Use ARNs and Application Inference Profiles

Section titled “How to Use ARNs and Application Inference Profiles”

When using AWS Bedrock inference profiles or application inference profiles, you must split the configuration correctly to avoid UnknownOperationException:

FieldPurpose
arnThe ARN prefix (everything before the final /resource-id). Required for URL formation when using inference profiles.
deploymentsMap logical model names to the model ID or inference profile resource ID only — not the full ARN.

Application inference profiles — use the resource ID (short alphanumeric suffix) in deployments:

{
"bedrock_key_config": {
"access_key": "your-aws-access-key",
"secret_key": "your-aws-secret-key",
"session_token": "optional-session-token",
"region": "eu-west-1",
"arn": "arn:aws:bedrock:eu-west-1:123456789012:application-inference-profile",
"deployments": {
"claude-opus-4-6": "ghi56rst",
"claude-sonnet-4-5": "jkl78mno"
}
}
}

Cross-region inference profiles — use the model identifier (e.g., us.anthropic.claude-3-5-sonnet-v1:0) in deployments:

{
"bedrock_key_config": {
"access_key": "your-aws-access-key",
"secret_key": "your-aws-secret-key",
"session_token": "optional-session-token",
"region": "us-east-1",
"arn": "arn:aws:bedrock:us-east-1:123456789012:inference-profile",
"deployments": {
"claude-sonnet": "us.anthropic.claude-3-5-sonnet-v1:0"
}
}
}

For detailed instructions on setting up AWS Bedrock authentication including credentials, IAM roles, regions, and deployment mapping, see the quickstart guides:

See Provider-Specific Authentication - AWS Bedrock in the Gateway Quickstart for configuration steps using Web UI, API, or config.json.

  • Runtime API: bedrock-runtime.{region}.amazonaws.com/model/{path}
  • Control Plane: bedrock.{region}.amazonaws.com (list models)
  • Batch API: Via bedrock-runtime

HTTP Status Mapping:

StatusDeepIntShield Error TypeNotes
400invalid_request_errorBad request parameters
401authentication_errorInvalid/expired credentials
403permission_denied_errorAccess denied to model/resource
404not_found_errorModel or resource not found
429rate_limit_errorRate limit exceeded
500api_errorServer error
529overloaded_errorService overloaded

Error Response Structure:

type DeepIntShieldError struct {
IsDeepIntShieldError bool
StatusCode *int
Error: {
Type: string // Error classification
Message: string // Human-readable message
Error: error // Underlying error
}
}

Special Cases:

  • Context cancellation → RequestCancelled
  • Request timeout → ErrProviderRequestTimedOut
  • Streaming errors → Sent via channel with stream end indicator
  • Response unmarshalling → ErrProviderResponseUnmarshal

Image Format Restriction

Severity: High Behavior: Only base64/data URI images supported; remote URLs not supported Impact: Requests with URL-based images fail Code: chat.go:image handling

Minimum Reasoning Budget (Claude)

Severity: High Behavior: reasoning.max_tokens must be >= 1024 Impact: Requests with lower values fail with error Code: chat.go:reasoning validation

System Message Extraction

Severity: High Behavior: System messages removed from array, placed in separate system field Impact: Message array structure differs from input Code: chat.go:message conversion

Tool Message Grouping

Severity: High Behavior: Consecutive tool messages merged into single user message Impact: Message count and structure changes Code: chat.go:tool message handling

Model Family-Specific Parameters

Severity: Medium Behavior: Reasoning/thinking config varies significantly by model family Impact: Parameter mapping differs for Claude vs Nova vs other families Code: chat.go, utils.go:model detection

Text Completion Streaming Not Supported

Severity: Medium Behavior: Text completion streaming returns error Impact: Streaming not available for legacy completions API Code: text.go:streaming

Structured Output via Tool

Severity: Low Behavior: response_format converted to special bf_so_* tool Impact: Tool call count and structure changes internally Code: chat.go:structured output handling

Deployment Region Prefix Handling

Severity: Low Behavior: Model IDs with region prefixes matched against deployment config Impact: Model availability depends on deployment configuration Code: models.go:deployment matching