Calling Foundation Models on Amazon Bedrock
This lesson explains how Amazon Bedrock, the fully managed, serverless way to build generative AI applications on AWS, gives access to foundation models from Amazon and leading AI companies through one API, with no infrastructure to manage.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the range of foundation models available on Bedrock.
- Distinguish the InvokeModel API from the Converse API.
- Explain how temperature, top p and maximum tokens affect a model's output.
- Describe how Bedrock protects data and logs model invocations.
Available models
Amazon Bedrock offers foundation models from Amazon and other providers through one service, so an application can use several models without separate contracts, infrastructure or APIs. Amazon's own Nova family covers text, multi-modal understanding and speech, and Titan provides embedding models. (Nova Canvas and Nova Reel, Amazon's image and video generation models, reached end of life on 30 September 2026.) Models from other providers include Anthropic's Claude, Meta's Llama, Mistral AI, Cohere, DeepSeek, Stability AI for images and Luma AI for video. Because the models differ in quality, speed and price, choosing a model is a trade-off for each use case. The following table summarises the providers.
| Provider | Models |
|---|---|
| Amazon | Nova family (text, multi-modal and speech) and Titan embeddings |
| Others | Anthropic (Claude), Meta (Llama), Mistral AI, Cohere, DeepSeek, Stability AI (images), Luma AI (video) and more |
You can switch models without changing infrastructure and compare them in the console playgrounds. Bedrock Marketplace adds specialised models.
Calling models
Applications call Bedrock models through two main APIs. InvokeModel sends a request in the model's own native format, which differs from one provider to another, so switching models means changing the request code. The Converse API uses one consistent format for every model, with a system prompt, a list of messages for multi-turn conversations, and support for images, documents and tool use, also called function calling, in which the model asks the application to run a function and uses the result. With Converse, changing models is usually just changing the model ID. The following table summarises the two APIs.
| API | What it does |
|---|---|
| InvokeModel | Sends a request in each model's native format |
| Converse API | One consistent format across all models, with system prompts, multi-turn messages, images, documents and tool use (function calling) |
Streaming versions of both return tokens as they are generated.
Choosing a Bedrock API
Inference parameters
A model generates text one token, roughly a word or part of a word, at a time, choosing each from a range of likely options, and inference parameters control that choice. Temperature sets how random the choice is: a low value, such as 0 to 0.3, makes the model pick the most likely tokens, giving focused and consistent answers, which suits factual tasks; a high value, such as 0.7 to 1, gives more varied and creative output. Top P limits the choice to the most likely tokens whose probabilities add up to P, and Top K limits it to the K most likely tokens.
Maximum tokens caps the length of the response, which also limits cost, since output is charged per token. Stop sequences end generation as soon as a chosen string appears. The following table summarises the parameters.
| Parameter | Effect |
|---|---|
| Temperature | Randomness: low (0–0.3) gives focused, consistent answers; high (0.7–1) gives varied, creative output |
| Top P | Limits choice to the most likely tokens whose probabilities add up to P |
| Top K | Limits choice to the K most likely tokens |
| Maximum tokens | Caps response length, and so cost |
| Stop sequences | End generation when a given string appears |
The following diagram shows how temperature reshapes the next-token probabilities.

Inference parameters
Data protection and logging
Amazon Bedrock protects the data sent to models and can record model invocations. The following list describes these protections and logging features.
- Prompts and responses are not used to train base models and not shared with model providers.
- Data is encrypted in transit and at rest, optionally with your own KMS keys, and processed in the Regions you choose.
- Cross-Region inference profiles route requests across Regions in a geography for more throughput.
- Model invocation logging records requests and responses to CloudWatch Logs or S3 for auditing.
Further features build on the models: Knowledge Bases, Agents, Guardrails, Prompt Management, Flows, model evaluation and customisation.
Protecting data in Bedrock
One request, two temperatures
A developer calls a model on Bedrock through the Converse API. The request has the same shape for every chat model, which is why switching models needs no code changes:
import boto3
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
def ask(prompt, temperature):
response = bedrock.converse(
modelId="us.amazon.nova-2-lite-v1:0",
system=[{"text": "You are a concise assistant for a bank."}],
messages=[{"role": "user", "content": [{"text": prompt}]}],
inferenceConfig={"temperature": temperature, "maxTokens": 200},
)
return response["output"]["message"]["content"][0]["text"]
ask("What documents do I need to open an account?", temperature=0.1) # factual: low temperature
ask("Suggest a friendly name for our savings app.", temperature=0.9) # creative: high temperatureFor the factual question the bank wants the same accurate answer every time, so it uses a low temperature. For brainstorming it wants variety, so it raises the temperature. Max tokens caps the length, and therefore the cost, of every answer. None of these prompts is used to train the model or shared with the model provider.
Does Amazon Bedrock use customers' prompts to train the base models?
Show answer
No. Prompts and responses are not used to train AWS or third-party base models, and they stay in the Region unless cross-Region inference is chosen.
Exam Tips
Remember for the exam
- Many foundation models through one API, with no infrastructure, points to Amazon Bedrock.
- One request format across models, including tool use, is the Converse API.
- For consistent, factual output use a low temperature; for creative output use a higher one.
- To limit response length and cost, set maximum tokens.
- Bedrock does not use your prompts to train base models and does not share them with model providers.
- To audit prompts and responses, enable model invocation logging.