Skip to main content

Overview

Bifrost supports AWS Bedrock’s Files and Batch APIs with cross-provider routing. This means you can use boto3 to manage files and batch jobs across multiple providers including Bedrock, OpenAI, and Gemini. For Bedrock SDK:
  • Files are managed through an S3-compatible API
  • Batches are managed through the Bedrock service API
  • Provider routing is done via the x-model-provider header
Anthropic Limitation: Anthropic does not support file upload via the S3-compatible API. For Anthropic batch operations, use the Anthropic SDK with inline requests instead.

Client Setup

Default Bedrock Client

Cross-Provider Client Setup

To route requests to different providers, add the x-model-provider header using boto3 events:

Helper Function for Provider-Specific Clients


Files API (S3-Compatible)

Files are managed through Bifrost’s S3-compatible endpoint.

Upload a File

List Files

For OpenAI and Gemini, use any bucket name as an identifier-files are stored in the provider’s native storage and listed by file ID.

Retrieve File Metadata

Delete a File

Download File Content

File content download is only supported for Bedrock. For OpenAI and Gemini, use their native SDKs to download file content.

Batch API

The Bedrock Batch API uses create_model_invocation_job and related methods.

Create a Batch Job

Anthropic Note: Anthropic prefers inline batch requests rather than file-based batching. When targeting Anthropic from the Bedrock SDK, consider using the Anthropic SDK directly for better compatibility.

List Batch Jobs

Retrieve Batch Job Status

Stop a Batch Job


End-to-End Batch Workflow

Bedrock Provider

OpenAI Provider

No S3 configuration required. Files are stored in OpenAI’s native storage. The bucket/key values are routing identifiers used by Bifrost.

Gemini Provider

No S3 configuration required. Files are stored in Google Cloud Storage. The bucket/key values are routing identifiers used by Bifrost.

JSONL Format Reference

Bedrock Format

OpenAI Format

Gemini Format


Provider-Specific Notes

Bedrock Provider: Requires S3 bucket configuration. The IAM role for batch operations is configured server-side in Bifrost. You can use Anthropic models deployed on Bedrock for batch and files APIs.OpenAI & Gemini Providers: No AWS infrastructure needed. Files are stored in the provider’s native storage. The S3 bucket/key values in the examples are routing identifiers used by Bifrost.Anthropic Provider: Does not support S3-based file uploads. Use the Anthropic SDK with inline batch requests instead.

Next Steps