Skip to content

Kimi 2.5 model in Amazon Bedrock: ValidationException with Converse API but works with InvokeModel API for images

1

I'm experiencing an inconsistency with the Kimi 2.5 model in Amazon Bedrock when trying to use images. The model works perfectly with the invoke_model API but fails with the converse API.

Error with Converse API:

ValidationException: This model doesn't support the image field for user messages. Remove image and try again.

Working Code (invoke_model):

client = session.client("bedrock-runtime")

# Load and encode your image
with open("test.jpg", "rb") as image_file:
    image_bytes = image_file.read()
    image_base64 = base64.b64encode(image_bytes).decode("utf-8")

# Try with InvokeModel API
response = client.invoke_model(
    modelId="moonshotai.kimi-k2.5",
    body=json.dumps(
        {
            "messages": [
                {
                    "role": "user",
                    "content": [
                        {"type": "text", "text": "Describe this image:"},
                        {
                            "type": "image_url",
                            "image_url": {
                                "url": "data:image/jpeg;base64," + image_base64
                            },
                        },
                    ],
                }
            ]
        }
    ),
    contentType="application/json",
    accept="application/json",
)
print(json.dumps(json.loads(response.get("body").read()), indent=4))

Failing Code (converse):

client = session.client("bedrock-runtime")

# Load and encode your image
with open("test.jpg", "rb") as image_file:
    image_bytes = image_file.read()
    image_base64 = base64.b64encode(image_bytes).decode("utf-8")

# Try with Converse API
response = client.converse(
    modelId="moonshotai.kimi-k2.5",
    messages=[
        {
            "role": "user",
            "content": [
                {"image": {"format": "jpeg", "source": {"bytes": image_base64}}},
                {"text": "Describe this image."},
            ],
        }
    ],
)
print(response.get("output").get("message").get("content")[0].get("text"))

Environment:

  • Tested in multiple regions (us-east-1, sa-east-1)
  • Model access is properly configured
  • Same behavior with PNG and JPEG formats

Expected Behavior: Since the Kimi 2.5 model supports images as an input modality and works with invoke_model, it should also work with the converse API, which is designed to provide a unified interface across all Bedrock models.

Questions:

  • Is this a known limitation of the Kimi 2.5 model's Converse API implementation?
  • Are there any workarounds to use images with Kimi 2.5 through the Converse API?
  • Is there a timeline for when this compatibility issue might be resolved?

The Converse API is supposed to provide consistency across models, so this inconsistency is problematic for applications that rely on the unified interface.

asked 8 months ago476 views

2 Answers
0

Here is a list of the models that support the Converse API: https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html

Kimi is not in the list at this time.

AWS
EXPERT

answered 8 months ago

EXPERT

reviewed 3 months ago

  • Any plans on supporting it soon? Seems like an easy change.

-1

Based on the behavior you're experiencing, this appears to be a known limitation with certain models in Amazon Bedrock. The Converse API is not supported for all models, particularly some imported models and specific model implementations.

When you use the InvokeModel API with the Kimi 2.5 model, you're likely using a format that's compatible with the model's native API schema (similar to OpenAIChatCompletion format), which supports both text and image inputs through the messages array with content blocks containing image_url types.

However, the Converse API has specific requirements for how it handles different content types across models. The error message you're receiving - "This model doesn't support the image field for user messages" - indicates that while the Kimi 2.5 model does support vision capabilities through its native API format, it hasn't been fully integrated with the Converse API's standardized image handling mechanism.

Current Workaround: Continue using the InvokeModel API as you've demonstrated in your working code. This approach allows you to leverage the model's full vision capabilities by encoding images as base64 strings within the image_url structure.

Regarding the Converse API: The Converse API is designed to provide a unified interface, but not all models support all features through this interface. The primary difference between APIs is how binary data (images, video, audio) is encoded and structured - the Converse API uses specific binary array formats while the InvokeModel API can use Base64-encoded strings in various schema formats.

For applications requiring a consistent interface across multiple models, you may need to implement conditional logic that uses InvokeModel for models like Kimi 2.5 that don't fully support the Converse API's image handling, while using Converse for models that do support it.
Sources
Request and response schema - Amazon Nova
Invoke your imported model - Amazon Bedrock

answered 8 months ago

AWS
EXPERT

reviewed 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.