diff --git a/docs/my-website/docs/bedrock_converse.md b/docs/my-website/docs/bedrock_converse.md index 4458b57a51d..cf66b1a50a6 100644 --- a/docs/my-website/docs/bedrock_converse.md +++ b/docs/my-website/docs/bedrock_converse.md @@ -113,20 +113,22 @@ The proxy automatically distributes requests across both regions. ```python showLineNumbers import boto3 import json +import os +# Set dummy AWS credentials (required by boto3, but not used by LiteLLM proxy) +os.environ['AWS_ACCESS_KEY_ID'] = 'dummy' +os.environ['AWS_SECRET_ACCESS_KEY'] = 'dummy' +os.environ['AWS_BEARER_TOKEN_BEDROCK'] = "sk-1234" # your litellm proxy api key + +# Point boto3 to the LiteLLM proxy bedrock_runtime = boto3.client( service_name='bedrock-runtime', region_name='us-west-2', endpoint_url='http://0.0.0.0:4000/bedrock' ) -def add_custom_headers(request, **kwargs): - request.headers.update({'litellm_user_api_key': 'Bearer sk-1234'}) - -bedrock_runtime.meta.events.register('before-send.*.*', add_custom_headers) - response = bedrock_runtime.converse( - modelId='my-bedrock-model', + modelId='my-bedrock-model', # Your model_name from config.yaml messages=[ { "role": "user", diff --git a/docs/my-website/docs/bedrock_invoke.md b/docs/my-website/docs/bedrock_invoke.md index 6d86778bc47..6f29f1d51c3 100644 --- a/docs/my-website/docs/bedrock_invoke.md +++ b/docs/my-website/docs/bedrock_invoke.md @@ -109,20 +109,22 @@ The proxy automatically distributes requests across both regions. ```python showLineNumbers import boto3 import json +import os +# Set dummy AWS credentials (required by boto3, but not used by LiteLLM proxy) +os.environ['AWS_ACCESS_KEY_ID'] = 'dummy' +os.environ['AWS_SECRET_ACCESS_KEY'] = 'dummy' +os.environ['AWS_BEARER_TOKEN_BEDROCK'] = "sk-1234" # your litellm proxy api key + +# Point boto3 to the LiteLLM proxy bedrock_runtime = boto3.client( service_name='bedrock-runtime', region_name='us-west-2', endpoint_url='http://0.0.0.0:4000/bedrock' ) -def add_custom_headers(request, **kwargs): - request.headers.update({'litellm_user_api_key': 'Bearer sk-1234'}) - -bedrock_runtime.meta.events.register('before-send.*.*', add_custom_headers) - response = bedrock_runtime.invoke_model( - modelId='my-bedrock-model', + modelId='my-bedrock-model', # Your model_name from config.yaml contentType='application/json', accept='application/json', body=json.dumps({ diff --git a/docs/my-website/docs/pass_through/bedrock.md b/docs/my-website/docs/pass_through/bedrock.md index 8edb42f672a..631c9a1d4e9 100644 --- a/docs/my-website/docs/pass_through/bedrock.md +++ b/docs/my-website/docs/pass_through/bedrock.md @@ -255,21 +255,20 @@ You can also call the load-balanced endpoint using the boto3 SDK: ```python showLineNumbers import boto3 import json +import os + +# Set dummy AWS credentials (required by boto3, but not used by LiteLLM proxy) +os.environ['AWS_ACCESS_KEY_ID'] = 'dummy' +os.environ['AWS_SECRET_ACCESS_KEY'] = 'dummy' +os.environ['AWS_BEARER_TOKEN_BEDROCK'] = "sk-1234" # your litellm proxy api key # Point boto3 to the LiteLLM proxy bedrock_runtime = boto3.client( service_name='bedrock-runtime', - region_name='us-west-2', # Can be any region + region_name='us-west-2', endpoint_url='http://0.0.0.0:4000/bedrock' ) -# Custom header for authentication -def add_custom_headers(request, **kwargs): - request.headers.update({'litellm_user_api_key': 'Bearer sk-1234'}) - -# Register the event to inject headers before sending request -bedrock_runtime.meta.events.register('before-send.*.*', add_custom_headers) - # Call the load-balanced model response = bedrock_runtime.invoke_model( modelId='my-claude-model', # Your model_name from config.yaml