---
title: "Discussion on \"How to Use Amazon Bedrock APIs for Anthropic Claude 3.5 Sonnet in Python\" | Hashnode"
description: "Discussion on \"How to Use Amazon Bedrock APIs for Anthropic Claude 3.5 Sonnet in Python\". A guide on using Amazon Bedrock APIs for Anthropic Claude 3.5 Sonnet in Python, including setup, differences, and error handling"
url: "https://hashnode.com/posts/how-to-use-aws-bedrock-apis-for-anthropic-claude-35-sonnet-in-python/66c2dd6874dc402478eb57f8"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to Use Amazon Bedrock APIs for Anthropic Claude 3.5 Sonnet in Python](https://gregsramblings.hashnode.dev/how-to-use-aws-bedrock-apis-for-anthropic-claude-35-sonnet-in-python?utm_source=hashnode&utm_medium=feed)

A guide on using Amazon Bedrock APIs for Anthropic Claude 3.5 Sonnet in Python, including setup, differences, and error handling

Aug 19, 2024 · 6 min read · gregsramblings.hashnode.dev  
Updated Aug 20, 2024  
Read the article

-   [#claudeai](https://hashnode.com/tag/claudeai)
-   [#amazon-bedrock](https://hashnode.com/tag/amazon-bedrock)
-   [#aws-bedrock](https://hashnode.com/tag/aws-bedrock)
-   [#python](https://hashnode.com/tag/python)
-   [#claude-35](https://hashnode.com/tag/claude-35)

## Written by

[Greg Wilson](https://hashnode.com/@gregsramblings)

@gregsramblings · San Francisco, CA

  
[View profile](https://hashnode.com/@gregsramblings)

My day job is leading the AWS Documentation and SDK/CLI teams but all views expressed here are personal and do not represent those of AWS. I blog about my interest -- these include coding, AI, networking, photography, aviation, EVs, and other ramblings.

## Responses

Markdown supported · ⌘↵ to post

[klement Gunndu](https://hashnode.com/@klementgunnduai)

[Feb 27](https://hashnode.com/posts/how-to-use-aws-bedrock-apis-for-anthropic-claude-35-sonnet-in-python/66c2dd6874dc402478eb57f8/comment/69a0f4ef4bb8a8e57a21c578)

The side-by-side SDK comparison is exactly what the migration docs are missing — the official Bedrock docs show the Boto3 invocation but gloss over the response schema differences, which is where most of the migration friction actually lives. One thing I ran into: the streaming response object from Bedrock uses an EventStream iterator rather than the chunk generator in the Anthropic SDK, and the token count fields are in a different location in the final message\_stop event. Did you find the response parsing needed significant changes beyond the client instantiation?

[Faensd](https://hashnode.com/@Farenhs)

[Aug 30, 2024](https://hashnode.com/posts/how-to-use-aws-bedrock-apis-for-anthropic-claude-35-sonnet-in-python/66c2dd6874dc402478eb57f8/comment/66d198437227fa37a8a3612f)

Betfred Casino has quickly become one of my top picks for online gaming. The selection of games is fantastic, with a mix of classic and modern options that keep things interesting. I particularly like how smooth the gameplay is—no annoying lags or crashes to deal with. The bonuses are a nice touch, offering extra value that keeps me coming back for more. If you’re looking for a reliable and enjoyable online casino, [Betfred Casino](https://betfred-casino.net/) is definitely worth checking out.

[Carlos Gucci](https://hashnode.com/@juliaroberts981)

[Aug 29, 2024](https://hashnode.com/posts/how-to-use-aws-bedrock-apis-for-anthropic-claude-35-sonnet-in-python/66c2dd6874dc402478eb57f8/comment/66d0ffcab747571584c5af09)

[Betfred Casino](https://betfred-casino.net/) has quickly become one of my top picks for online gaming. The selection of games is fantastic, with a mix of classic and modern options that keep things interesting. I particularly like how smooth the gameplay is—no annoying lags or crashes to deal with. The bonuses are a nice touch, offering extra value that keeps me coming back for more. If you’re looking for a reliable and enjoyable online casino, Betfred Casino is definitely worth checking out.

[Leo](https://hashnode.com/@thinkun)

[Aug 19, 2024](https://hashnode.com/posts/how-to-use-aws-bedrock-apis-for-anthropic-claude-35-sonnet-in-python/66c2dd6874dc402478eb57f8/comment/66c3cea236b57b6f3b5203d6)

Most of this isn't needed because you can use Anthropic on Bedrock through Anthropic's official Python package, avoiding all the annoying differences in the APIs, and avoiding having to manually handle all the boto3 stuff :)

The only thing you have to do is literally to replace "Anthropic" class client name with "AnthropicBedrock" and have the AWS ID/secret key/region in your env or provide them on initialization for that client. There are docs in GitHub README of the official Anthropic package.

[Greg Wilson](https://hashnode.com/@gregsramblings)

[Aug 20, 2024](https://hashnode.com/posts/how-to-use-aws-bedrock-apis-for-anthropic-claude-35-sonnet-in-python/66c2dd6874dc402478eb57f8/comment/66c3cea236b57b6f3b5203d6#reply-66c3e3e6be3e9e87058f0c23)

I missed that! I just updated the blog post. For my use case, going direct to bedrock APIs still makes sense because I’m also interacting with S3, but for most use cases that don’t need other AWS services. This is a great option. Thank you!
