AgnesAI-Models icon indicating copy to clipboard operation
AgnesAI-Models copied to clipboard

[API]: Support standard OpenAI response_format for Images API compatibility with @ai-sdk/openai-compatible

Open abdielmaleakhi opened this issue 4 months ago • 1 comments

Model

agnes-image-2.0-flash and agnes-image-2.1-flash

Endpoint

POST /v1/images/generations

SDK or client

@ai-sdk/openai-compatible

Minimal sanitized request

When using @ai-sdk/openai-compatible, the SDK automatically includes:

{
  "response_format": "b64_json"
}

following the standard OpenAI Images API.

Error response

error: {
      message: '***.UnsupportedParamsError: Setting `response_format` is not supported by openai, agnes-t2i-general-model. To drop it from the call, set `litellm.drop_params = True`',
      type: 'None',
      param: '',
      code: '400'
    }

Expected behavior

Agnes AI should accept the standard OpenAI Images API parameter:

{ "response_format": "b64_json" }

or

{ "response_format": "url" }

without requiring the parameter to be placed inside:

{ "extra_body": { "response_format": "url" } }

This would allow Agnes AI to work as a drop-in OpenAI-compatible provider for libraries such as @ai-sdk/openai-compatible, which always send response_format: "b64_json" by default

Actual behavior

The Images API rejects the standard OpenAI response_format parameter with an UnsupportedParamsError.

Currently, the API only accepts the response format when it is provided through:

{ "extra_body": { "response_format": "url" } }

As a result, Agnes AI cannot be used directly with @ai-sdk/openai-compatible without implementing provider-specific workarounds or modifying the SDK behavior.

Is this reproducible?

Yes

abdielmaleakhi avatar Jul 10 '26 05:07 abdielmaleakhi

Thanks for the detailed report. We re-tested on the current build and this is no longer reproducible: POST /v1/images/generations now accepts top-level response_format and honors it — "url" returns a URL, "b64_json" returns actual base64 (verified on agnes-image-2.1-flash and agnes-image-2.5-flash), and invalid values are rejected locally with a clear 400 (response_format 的值 "png" 无效,仅支持 url 或 b64_json) instead of being forwarded to the inference layer. The UnsupportedParamsError you hit in July came from the inference layer receiving the raw parameter; that path is no longer used. With @ai-sdk/openai-compatible, no extra_body workaround should be needed anymore.

zhenduanxuan123 avatar Nov 10 '26 03:11 zhenduanxuan123