#Response Format -> Json Schema not supported on "Supported models"

1 messages · Page 1 of 1 (latest)

kind lily
#

Hey All! I'm using the json_schema structured output with gpt4o-mini (and other supported models) and keep getting the below response:

 {"message":"Provider returned error","code":400,"metadata":{"raw":"{\n  \"error\": {\n    \"message
\": \"Unknown parameter: 'response_format.json_schema'.\",\n    \"type\": \"invalid_request_error\",\n    \"
param\": \"response_format.json_schema\",\n    \"code\": \"unknown_parameter\"\n  }\n}","provider_name":"Azu
re","isDownstreamPipeClean":true,"isErrorUpstreamFault":false}},"user_id":"user_2kq5WIvpdnpEH1e5Tu0NrlR6d3M"
}

I suspect that maybe it's related to openrouter routing the request to Azure and perhaps azure does not support it? My request in the exact same shape works fine with Gemini flash

Request:

    "response_format": {
      "type": "json_object",
      "json_schema": {
        "name": "schema",
        "strict": true,
        "schema": {
          "properties": {
            "cons": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "key_features": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "pros": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "summary": {
              "type": "string"
            },
            "target_users": {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          "required": [
            "key_features",
            "pros",
            "cons",
            "target_users",
            "rating",
            "summary"
          ],
          "type": "object"
        }
      }
    },
    "tools": [],
    "max_tokens": 1536,
    "temperature": 0.7
  }
}
kind lily
#

Furthermore, it seems that the API is returning a 200 status code even though the body shows a 400

pallid salmon
kind lily
pallid salmon
#

Proper error codes are returned if its an error with OpenRouter themselves

kind lily
#

ah okay...yeah i'll wait until someone from the openrouter team is here and see why they are doing that. it causes issues for clients

pallid salmon
gusty panther
#

Mid stream errors like that are sent to prevent stream hangups (and providers can send mid stream errors anyway)

#

Wow, looks like azure doesn’t support json schema… you can exclude azure in the api request as a short term fix, but we can look into this

kind lily