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 provides 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
    
     # Cache config
     CACHE_DB_PATH=/path/to/cache.db
     CACHE_BUCKET_NAME=claude-proxy-cache
     CACHE_DEFAULT_EXPIRY_HOURS=1
    
     # Zoho Auth Config
     ZOHO_ALLOW_DOMAINS=domain.com
     ZOHO_CLIENT_ID=your_zoho_client_id
     ZOHO_CLIENT_SECRET=your_zoho_client_secret
     ZOHO_REDIRECT_URI=https://your-domain/oauth/callback
    

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 Variables

Cache Configuration

Zoho Authentication

The proxy supports Zoho authentication for enhanced security. To enable Zoho authentication:

  1. Configure your Zoho application settings in the Zoho Developer Console
  2. Set the following environment variables:
    • ZOHO_ALLOW_DOMAINS: Comma-separated list of allowed email domains (e.g., mixmedia.com)
    • ZOHO_CLIENT_ID: Your Zoho application client ID
    • ZOHO_CLIENT_SECRET: Your Zoho application client secret
    • ZOHO_REDIRECT_URI: The OAuth redirect URI for your application

Contributing

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

License

This project is licensed under the Apache 2.0 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!


AWS Bedrock Claude Proxy

Go Report Card License: Apache 2.0 Docker Pulls GitHub issues

欢迎使用 AWS Bedrock Claude Proxy项目!本项目旨在提供一个无缝的代理服务,将 AWS Bedrock API 调用转换为官方 Anthropic API 使用的格式,使支持官方 API 的客户端更容易与 AWS Bedrock 集成。

简介

AWS Bedrock Claude Proxy被设计为 AWS Bedrock 和为与官方 Anthropic API 交互而构建的客户端之间的中介。通过使用此代理,开发人员可以利用 AWS Bedrock 的强大基础设施,同时保持与现有 Anthropic 应用程序的兼容性。

特性

入门指南

前提条件

在开始之前,请确保您满足以下要求:

安装

  1. 克隆仓库:

     git clone https://github.com/MMHK/bedrock-claude-proxy.git
     cd bedrock-claude-proxy
    
  2. 安装依赖:

     go mod tidy
    

配置

  1. 在根目录创建一个 .env 文件并添加您的 AWS 凭证:

     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
    
     # 快取配置
     CACHE_DB_PATH=/path/to/cache.db
     CACHE_BUCKET_NAME=claude-proxy-cache
     CACHE_DEFAULT_EXPIRY_HOURS=1
    
     # Zoho 認證配置
     ZOHO_ALLOW_DOMAINS=domain.com
     ZOHO_CLIENT_ID=your_zoho_client_id
     ZOHO_CLIENT_SECRET=your_zoho_client_secret
     ZOHO_REDIRECT_URI=https://your-domain/oauth/callback
    

使用方法

  1. 构建项目:

     go build -o bedrock-claude-proxy
    
  2. 启动代理服务器:

     ./bedrock-claude-proxy
    
  3. 向代理发送 API 请求:

    将您的 Anthropic API 客户端指向代理服务器。例如,如果代理运行在 http://localhost:3000,请将您的客户端配置为使用此基本 URL。

使用 Docker 运行

  1. 构建 Docker 镜像:

     docker build -t bedrock-claude-proxy .
    
  2. 运行 Docker 容器:

     docker run -d -p 3000:3000 --env-file .env bedrock-claude-proxy
    
  3. 向代理发送 API 请求:

    将您的 Anthropic API 客户端指向代理服务器。例如,如果代理运行在 http://localhost:3000,请将您的客户端配置为使用此基本 URL。

使用 Docker Compose 运行

  1. 构建并运行容器:

     docker-compose up -d
    
  2. 向代理发送 API 请求:

    将您的 Anthropic API 客户端指向代理服务器。例如,如果代理运行在 http://localhost:3000,请将您的客户端配置为使用此基本 URL。

环境变量

快取配置

Zoho 認證

代理支援 Zoho 認證以提升安全性。要啟用 Zoho 認證,請:

  1. 在 Zoho 開發者控制台中配置您的應用程式設定
  2. 設定以下環境變數:
    • ZOHO_ALLOW_DOMAINS:允許的電子郵件網域列表(以逗號分隔,如:domain.com)
    • ZOHO_CLIENT_ID:您的 Zoho 應用程式客戶端 ID
    • ZOHO_CLIENT_SECRET:您的 Zoho 應用程式客戶端密鑰
    • ZOHO_REDIRECT_URI:應用程式的 OAuth 重導向 URI

许可证

本项目采用 Apache 2.0 许可证 - 有关详细信息,请参阅 LICENSE 文件。


感谢您使用 AWS Bedrock Claude 代理。我们希望它能使您的集成过程更加顺畅和高效!