- InvokeModel — a low-level, model-specific API that gives full control over the request body.
- Converse — a higher-level, standardized, message-based API designed for chat and multi-turn interactions.
InvokeModel
InvokeModel is a low-level API that accepts a model-specific JSON payload. Use it when you need fine-grained control (for example, image-generation options, custom token settings, or other model-specific fields). Because the payload is tailored to the model, it is not guaranteed to be portable across different models or vendors. Example (InvokeModel):- Supply
modelId(the model’s programmatic identifier). - The
bodyis a JSON string (commonly produced byjson.dumps()from a Python dict). - Payload structure and supported fields are model-specific.
Converse
Converse is a high-level API built around a unifiedmessages structure. Each message contains a role (for example, "user", "assistant", or "system") and content items (for example, {"type": "text", "text": "..."}). This abstraction makes payloads portable across models and vendors, simplifying multi-turn and chat-style workflows.
Example (Converse):
- Use
messageswith roles ("user","system","assistant"). - Content items typically include a
type(such as"text") and the payload text. - Converse is ideal for conversational flows, multi-turn sessions, or instruction-style prompts.
- The unified format improves portability between models and cloud vendors.
When to use which
- Use InvokeModel when you need model-specific parameters or nonstandard inputs.
- Use Converse for chat, multi-turn interactions, or when you want a portable, standardized message format.

Full example: InvokeModel with boto3 (Python)
The following concise example demonstrates creating a Bedrock Runtime client, building a model-specific body, callinginvoke_model(), and decoding the response. Note that the SDK returns a streaming body that must be read and decoded before parsing JSON.
Always decode the
response["body"] streaming object before json.loads() — otherwise you will attempt to parse raw bytes and encounter errors.- Imports
jsonandboto3. - Constructs a Bedrock Runtime client for
us-east-1. - Builds a model-specific
bodycontainingpromptandmax_tokens. - Calls
invoke_model()withmodelIdand the serializedbody. - Reads and decodes the streaming response body and deserializes the JSON result.
Best practices and tips
- Prefer Converse for conversational agents and when you want portability across models or cloud vendors.
- Use InvokeModel when needing special model features (image inputs, advanced sampling parameters, token controls, or vendor/model-specific flags).
- Always read and decode streaming responses before parsing JSON.
- Verify the required/requested fields for the target model in its documentation—field names and structures vary per model.
Model-specific fields in InvokeModel are not standardized; sending the wrong structure can cause errors or unexpected outputs. Consult the model’s documentation for the exact request format.
Summary
- InvokeModel: low-level, model-specific JSON payloads; use for full control and nonstandard inputs.
- Converse: high-level, standardized
messagesformat; use for conversational flows and cross-model portability.
Links and references
- Amazon Bedrock overview: https://docs.aws.amazon.com/bedrock/latest/ug/what-is-amazon-bedrock.html
- boto3 documentation: https://boto3.amazonaws.com/v1/documentation/api/latest/index.html
- AWS SDKs and tools: https://aws.amazon.com/tools/