Anthropic Claude models - Amazon Bedrock

Anthropic Claude models

This section provides inference parameters and code examples for using Anthropic Claude models.

You can use Amazon Bedrock to send Anthropic Claude Text Completions API or Anthropic Claude Messages API inference requests.

You use the messages API to create conversational applications, such as a virtual assistant or a coaching application. Use the text completion API for single-turn text generation applications. For example, generating text for a blog post or summarizing text that a user supplies.

You make inference requests to an Anthropic Claude model with InvokeModel or InvokeModelWithResponseStream (streaming). You need the model ID for the model that you want to use. To get the model ID for Anthropic Claude models, see Amazon Bedrock base model IDs (on-demand throughput) and Amazon Bedrock base model IDs for purchasing Provisioned Throughput.

Note

To use system prompts in inference calls, you must use one of the following models:

  • Anthropic Claude 3.5 Sonnet

  • Anthropic Claude version 2.1

  • Anthropic Claude 3 model, such as Anthropic Claude 3 Opus

For information about creating system prompts, see https://docs.anthropic.com/claude/docs/how-to-use-system-prompts in the Anthropic Claude documentation.

To avoid timeouts with Anthropic Claude version 2.1, we recommend limiting the input token count in the prompt field to 180K. We expect to address this timeout issue soon.

In the inference call, fill the body field with a JSON object that conforms the type call you want to make, Anthropic Claude Text Completions API or Anthropic Claude Messages API.

For information about creating prompts for Anthropic Claude models, see Introduction to prompt design in the Anthropic Claude documentation.