The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
docs boto3 instructions
Ishaan Jafferbbf9d6a57b9c
diff --git a/docs/my-website/docs/bedrock_converse.md b/docs/my-website/docs/bedrock_converse.mdindex 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 showLineNumbersimport boto3import 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 proxybedrock_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.yamlmessages=[{"role": "user",diff --git a/docs/my-website/docs/bedrock_invoke.md b/docs/my-website/docs/bedrock_invoke.mdindex 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 showLineNumbersimport boto3import 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 proxybedrock_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.yamlcontentType='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.mdindex 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 showLineNumbersimport boto3import 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 proxybedrock_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 modelresponse = bedrock_runtime.invoke_model(modelId='my-claude-model', # Your model_name from config.yaml