Quickstart
Get started with Amazon Bedrock in minutes. The following steps walk you through running your first inference request using the Anthropic-native Messages API, the OpenAI-compatible APIs: Responses API and Chat Completions API, and the Invoke and Converse API. For a complete list of APIs, see Build. After you complete these steps, you can send inference requests to any supported foundation model.
To run your first inference request
-
Sign up for an AWS account
. If you already have an AWS account, skip this step.
-
Generate a short-term API key to authenticate your requests to Amazon Bedrock by opening the Amazon Bedrock service in the AWS Management Console
. For the complete procedure, see the API keys section.
For production applications, use IAM roles or temporary credentials.
-
Install the relevant SDK for the APIs you plan to use. Python must already be installed.
-
Set the following environment variables to use the API key for authentication.
-
Choose a model and run your first inference request.
-
Choose a model. Amazon Bedrock supports 100+ foundation models.
-
Use the following Python code to run your first inference request.
-
Save the file as
bedrock-first-request.py. -
Run the code with the following command:
python3 bedrock-first-request.pyYou should see the output of your inference request.
-
To learn more about using other APIs and endpoints, see Build.
Next steps
Now that you have run your first request, explore the following resources to build more with Amazon Bedrock:
Automate tasks in your application using AI agents – Create agents that can orchestrate multi-step tasks.
Retrieve data and generate AI responses with Amazon Bedrock Knowledge Bases – Connect foundation models to your data sources.
Customize your model to improve its performance for your use case – Fine-tune models for your use case.
Evaluate the performance of Amazon Bedrock resources – Evaluate model performance for your workloads.