sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

[FEATURE] Let image blocks set OpenAI's image detail level (low/high/auto)

Open serenearyal opened this issue 2 months ago • 2 comments

SDK Language

Python

Problem Statement

OpenAI image inputs take a detail setting (low, high, auto) that trades cost and latency against how closely the model looks. Strands gives no way to set it:

  • OpenAIResponsesModel sends {"type": "input_image", "image_url": ...} with no detail (strands-py/src/strands/models/openai_responses.py).
  • OpenAIModel hard-codes "detail": "auto" (strands-py/src/strands/models/openai.py).
  • ImageContent has only format and source.

Checked on main at fec0427664.

Proposed Solution

An optional detail on the image block, passed through by both OpenAI providers and ignored by providers that do not support it:

{"image": {"format": "jpeg", "source": {"bytes": data}, "detail": "low"}}

Default stays as today (auto), so nothing changes for existing users. Happy to send the PR if this shape works.

Use Case

We run a car-diagnostics agent on Strands with OpenAIResponsesModel. Users attach photos: a dashboard warning light needs only low, a repair quote or a VIN label needs high. Today every photo is billed at whatever auto picks.

Alternatives Solutions

A model-level config option (one detail for all images). Simpler, but it cannot mix a cheap photo and a text-heavy photo in one conversation.

Additional Context

OpenAI docs: https://platform.openai.com/docs/guides/images-vision (see "Specify image input detail level").

serenearyal avatar Sep 23 '26 04:09 serenearyal

Hi @charles-dyfis-net @serenearyal , is this isssue still open? Can this be assigned to me if not claimed any anyone else? Thanks

mayankdas2005 avatar Sep 24 '26 10:09 mayankdas2005

Hi @serenearyal, are you still planning to send the PR for this? If not, I'd like to take it.

I checked on current main. The proposed shape (an optional detail on ImageContent) touches a few more places than the issue lists:

OpenAIModel hard-codes "detail": "auto" (models/openai.py)

LiteLLMModel hard-codes it too (models/litellm.py), which isn't in the issue, but it should follow the same field

OpenAIResponsesModel builds input_image in two places: normal user content and images inside tool results (models/openai_responses.py)

Plan: add detail: NotRequired[Literal["low", "high", "auto"]] to ImageContent, pass it through in all three providers (defaulting to auto, so nothing changes for existing users), and add a test that Bedrock and the other providers don't forward the new key. Converse would reject an unknown field. Should the TypeScript SDK get the same field for parity, or keep this Python-only?

stuti612 avatar Oct 07 '26 05:10 stuti612