bedrock-claude-proxy

AWS Bedrock Claude Proxy

Go Report Card License: Apache 2.0 Docker Pulls GitHub issues

Welcome to the AWS Bedrock Claude Proxy project! This project aims to provide a seamless proxy service that translates AWS Bedrock API calls into the format used by the official Anthropic API, making it easier for clients that support the official API to integrate with AWS Bedrock.

Introduction

AWS Bedrock Claude Proxy is designed to act as an intermediary between AWS Bedrock and clients that are built to interact with the official Anthropic API. By using this proxy, developers can leverage the robust infrastructure of AWS Bedrock while maintaining compatibility with existing Anthropic-based applications.

Features

Getting Started

Prerequisites

Before you begin, ensure you have met the following requirements:

Installation

  1. Clone the repository:

     git clone https://github.com/MMHK/bedrock-claude-proxy.git
     cd bedrock-claude-proxy
    
  2. Install dependencies:

     go mod tidy
    

Configuration

  1. Create a .env file in the root directory and add your AWS credentials:

    AWS_BEDROCK_ACCESS_KEY=your_access_key
    AWS_BEDROCK_SECRET_KEY=your_secret_key
    AWS_BEDROCK_REGION=your_region
    WEB_ROOT=/path/to/web/root
    HTTP_LISTEN=0.0.0.0:3000
    API_KEY=your_api_key
    AWS_BEDROCK_MODEL_MAPPINGS="claude-instant-1.2=anthropic.claude-instant-v1,claude-2.0=anthropic.claude-v2,claude-2.1=anthropic.claude-v2:1,claude-3-sonnet-20240229=anthropic.claude-3-sonnet-20240229-v1:0,claude-3-opus-20240229=anthropic.claude-3-opus-20240229-v1:0,claude-3-haiku-20240307=anthropic.claude-3-haiku-20240307-v1:0"
    AWS_BEDROCK_ANTHROPIC_VERSION_MAPPINGS=2023-06-01=bedrock-2023-05-31
    AWS_BEDROCK_ANTHROPIC_DEFAULT_MODEL=anthropic.claude-v2
    AWS_BEDROCK_ANTHROPIC_DEFAULT_VERSION=bedrock-2023-05-31
    AWS_BEDROCK_ENABLE_OUTPUT_REASON=false
    AWS_BEDROCK_REASON_BUDGET_TOKENS=2048
    AWS_BEDROCK_ENABLE_COMPUTER_USE=false
    AWS_BEDROCK_DEBUG=false
    LOG_LEVEL=INFO
    

Usage

  1. Build the project:

     go build -o bedrock-claude-proxy
    
  2. Start the proxy server:

     ./bedrock-claude-proxy
    
  3. Make API requests to the proxy:

    Point your Anthropic API client to the proxy server. For example, if the proxy is running on http://localhost:3000, configure your client to use this base URL.

Running with Docker

  1. Build the Docker image:

     docker build -t bedrock-claude-proxy .
    
  2. Run the Docker container:

     docker run -d -p 3000:3000 --env-file .env bedrock-claude-proxy
    
  3. Make API requests to the proxy:

    Point your Anthropic API client to the proxy server. For example, if the proxy is running on http://localhost:3000, configure your client to use this base URL.

Running with Docker Compose

  1. Build and run the containers:

     docker-compose up -d
    
  2. Make API requests to the proxy:

    Point your Anthropic API client to the proxy server. For example, if the proxy is running on http://localhost:3000, configure your client to use this base URL.

Environment

Example .env file:

AWS_BEDROCK_ACCESS_KEY=your_access_key
AWS_BEDROCK_SECRET_KEY=your_secret_key
AWS_BEDROCK_REGION=your_region
WEB_ROOT=/path/to/web/root
HTTP_LISTEN=0.0.0.0:3000
API_KEY=your_api_key
AWS_BEDROCK_MODEL_MAPPINGS="claude-instant-1.2=anthropic.claude-instant-v1,claude-2.0=anthropic.claude-v2,claude-2.1=anthropic.claude-v2:1,claude-3-sonnet-20240229=anthropic.claude-3-sonnet-20240229-v1:0,claude-3-opus-20240229=anthropic.claude-3-opus-20240229-v1:0,claude-3-haiku-20240307=anthropic.claude-3-haiku-20240307-v1:0"
AWS_BEDROCK_ANTHROPIC_VERSION_MAPPINGS=2023-06-01=bedrock-2023-05-31
AWS_BEDROCK_ANTHROPIC_DEFAULT_MODEL=anthropic.claude-v2
AWS_BEDROCK_ANTHROPIC_DEFAULT_VERSION=bedrock-2023-05-31
AWS_BEDROCK_ENABLE_OUTPUT_REASON=false
AWS_BEDROCK_REASON_BUDGET_TOKENS=2048
AWS_BEDROCK_ENABLE_COMPUTER_USE=false
AWS_BEDROCK_DEBUG=false
LOG_LEVEL=INFO

Contributing

We welcome contributions! Please read our Contributing Guide to learn how you can help.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Thank you for using AWS Bedrock Claude Proxy. We hope it makes your integration process smoother and more efficient!