Skip to content

Bedrock Mantle Responses API is incompatible with official OpenAI .NET SDK

1

I'm using Bedrock Mantle's OpenAI-compatible Responses API endpoint with the official OpenAI .NET SDK (openai-dotnet). I've found two compatibility issues that prevent the SDK from working with Bedrock Mantle out of the box. The same code works correctly against Azure Foundry without any modifications. Also the chat completions API works without any issues

Endpoint: https://bedrock-mantle.eu-north-1.api.aws/v1
Model: openai.gpt-oss-120b
SDK: openai-dotnet (Responses API, GetResponsesClient())
Runtime: .NET 10


Issue 1: created_at returned in float / scientific notation

When a request succeeds, the response contains created_at as a float in scientific notation:

{
  "created_at": 1.772195752E9
}

The OpenAI Responses API returns this as an integer (e.g., 1772195752). The OpenAI .NET SDK uses JsonElement.GetInt64() to deserialize this field (source), and System.Text.Json throws a FormatException on any number containing a decimal point or scientific notation, even if the underlying value is a whole number.

Stack trace:

System.FormatException: One of the identified items was in an invalid format.
   at System.Text.Json.ThrowHelper.ThrowFormatException()
   at System.Text.Json.JsonElement.GetInt64()
   at OpenAI.Responses.ResponseResult.DeserializeResponseResult(...)

This means even a successful Bedrock Mantle response cannot be read by the official SDK.


Issue 2: content as array of content parts is rejected

The OpenAI .NET SDK serializes input messages with content as an array of content parts. This is the format produced by ResponseItem.CreateUserMessageItem() and ResponseItem.CreateSystemMessageItem():

{
  "type": "message",
  "role": "user",
  "content": [
    {
      "type": "input_text",
      "text": "Hello, can you help me with a task?"
    }
  ]
}

Bedrock Mantle rejects this with:

{
  "status": "failed",
  "error": {
    "code": "invalid_prompt",
    "message": "ErrorEvent { error: APIError { type: \"BadRequestError\", code: Some(400), message: \"invalid conversation JSON: invalid type: sequence, expected a string at line 1 column 4880\", param: None } }"
  }
}

Minimal reproduction

This request will fail:

{
  "model": "openai.gpt-oss-120b",
  "max_output_tokens": 1024,
  "tools": [],
  "input": [
    {
      "type": "message",
      "role": "system",
      "content": [
        {
          "type": "input_text",
          "text": "You are a helpful assistant."
        }
      ]
    },
    {
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "What is a singleton pattern?"
        }
      ]
    }
  ],
  "parallel_tool_calls": true
}

Environment

  • AWS Region: eu-north-1
  • Endpoint: https://bedrock-mantle.eu-north-1.api.aws/v1
  • Model: openai.gpt-oss-120b
  • SDK: openai-dotnet (2.8.0), using the Responses API client
  • Runtime: .NET 10, C# 14
  • Comparison: The identical code and request structure works against Azure Foundry with no modifications or workarounds
1 Answer
-1

Thank you for the detailed report. I can confirm that Amazon Bedrock supports OpenAI-compatible APIs through the bedrock-mantle endpoint, including the Responses API. However, the specific compatibility issues you've identified with the official OpenAI .NET SDK appear to be implementation differences between Bedrock Mantle's response format and what the OpenAI SDK expects.

Based on the information available, the bedrock-mantle endpoint is designed to support OpenAI-compatible APIs and is recommended for users looking to easily migrate from other models that use these APIs. It supports both client and server-side tool use with Lambda functions and comes pre-configured with ready-to-use tools.

The issues you're experiencing—specifically the created_at field being returned in scientific notation (float format) rather than as an integer, and the rejection of content as an array of content parts—suggest there may be differences in how Bedrock Mantle implements the OpenAI-compatible API specification compared to the official OpenAI API that the .NET SDK was designed for.

For the Responses API specifically, the expected usage pattern shown in the documentation uses the Python OpenAI SDK. While the service aims to be OpenAI-compatible, there may be nuances in the implementation that affect compatibility with different SDK versions or languages.

I'd recommend reporting these specific compatibility issues through AWS Support channels so the Bedrock team can investigate whether these are intended behaviors or bugs that need to be addressed to improve compatibility with the official OpenAI .NET SDK.
Sources
Generate responses using OpenAI APIs - Amazon Bedrock
Endpoints supported by Amazon Bedrock - Amazon Bedrock
Overview - Amazon Bedrock

answered 6 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.