Skip to content

feat(dashscope_image): add Qwen-Image 3.0 / 2.1 models - #848

Open
yluiop123 wants to merge 1 commit into
OpenMontageInc:mainfrom
yluiop123:feat/dashscope-image-models
Open

yluiop123 wants to merge 1 commit into
OpenMontageInc:mainfrom
yluiop123:feat/dashscope-image-models

Conversation

@yluiop123

@yluiop123 yluiop123 commented Oct 24, 2026 •

Copy link
Copy Markdown

Summary

dashscope_image still advertises only the Qwen-Image 2.0 generation. Alibaba's Model Studio docs now recommend the 3.0 series (qwen-image-3.0-pro, qwen-image-3.0) and the 2.1 series (qwen-image-2.1-pro, qwen-image-2.1-turbo), and moved the 2.0 series to the legacy pages. This PR adds the current model IDs and gates the parameters that changed between generations.

Related issue

Refs #240 (DashScope provider: image gen + TTS + ASR).

Changes

  • Model catalog: add qwen-image-3.0-pro, qwen-image-3.0, qwen-image-2.1-pro, qwen-image-2.1-turbo, and qwen-image-2.0. The default stays qwen-image-2.0-pro so existing calls remain byte-compatible.
  • Parameter gating by generation:
    • The 2.1 series dropped negative_prompt — it is omitted automatically.
    • prompt_extend_mode (direct / agent), enable_thinking, and size="auto" are sent only to the 2.1 / 3.0 series.
    • Unsupported combinations are rejected before the API call (enable_thinking requires prompt_extend=true).
  • Provenance: the result payload records the parameters actually sent.
  • Docs: parameter matrix in the dashscope skill; model list and pricing notes in docs/PROVIDERS.md.
  • Pricing: estimate_cost() uses the published QwenCloud matrix for China North 2 (Beijing) - 1k/2k output-image tiers, plus z-image-turbo prompt-extension pricing - and bills only the images actually returned. size="auto" or a model without a published tariff reports cost_usd: None with cost_status: "unquoted".
  • Tests: catalog, gating, validation, and multi-image output coverage.

Testing

  • pytest tests/tools/test_dashscope_image_models.py tests/contracts/test_dashscope_tools.py -q → 127 passed (after rebasing onto main)
  • Full suite on the branch: 2057 passed, 11 skipped, 3 xfailed
  • Tests are offline (requests.post / requests.get are patched). No live generation call was made; the model IDs and parameter differences come from the Model Studio API reference (updated 2026-10-11).

Checklist

  • The change is focused on a single logical concern.
  • I ran the relevant tests locally (make test-contracts / make test) where applicable.
  • I updated docs/README if behavior or usage changed.
  • No unrelated files (build artifacts, local config) are included in the diff.

@yluiop123
yluiop123 requested a review from calesthio as a code owner October 24, 2026 11:54
SanHsien added a commit to SanHsien/OpenMontage that referenced this pull request Oct 24, 2026
…c#848, issue OpenMontageInc#819)

Every upstream commit, PR and issue above the previous watermarks was
classified in docs/DECISIONS.md and the verification gates passed.

tools/tests/test_fork_docs.py pinned the exact previous reviewed_through SHA,
which can only fail once the watermark moves; assert its 40-hex shape instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@calesthio calesthio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for refreshing the Qwen model support. I checked the parameter families against the official API reference and ran tests/tools/test_dashscope_image_models.py: 13 passed, with no provider calls. Two integration issues need fixes.

[P2] Include both new generation controls in the cache identity. prompt_extend_mode and enable_thinking reach _build_payload, but neither is in idempotency_key_fields. For model=qwen-image-3.0-pro, a pinned seed and identical prompt, I confirmed that changing thinking or direct to agent leaves idempotency_key() unchanged. With asset caching enabled, a revised generation can restore the prior image. Canonicalize effective generation inputs or include the fields, and add changed-input cache regressions.

[P1] Keep tier-priced cost unknown unless the tier price is established. estimate_cost() returns $0.02 per image for every newly added model/resolution; its comment explicitly calls that a floor, while _generate() returns the same number as cost_usd. A floor cannot support a conservative budget reservation, and it is not a settled charge. Use a verified model/output-tier matrix or PriceQuoteRequired, and keep estimated/unknown spend distinguishable in results. Please test at least the 1k/2k distinction and missing-price path.

@yluiop123
yluiop123 force-pushed the feat/dashscope-image-models branch 2 times, most recently from 5a1a751 to 25a422d Compare November 9, 2026 11:39
@yluiop123

yluiop123 commented Nov 9, 2026 •

Copy link
Copy Markdown
Author

Thanks - both issues are fixed in 25a422d.

P2 - cache identity

  • prompt_extend_mode and enable_thinking are now in idempotency_key_fields.
  • Regression tests assert that direct -> agent and enable_thinking false -> true each change idempotency_key(), while identical inputs keep it stable.
  • Tool version bumped to 0.2.1 so entries cached under the previous key set are not restored.

P1 - tier-priced cost

  • estimate_cost() returns the verified $0.02/image only for the legacy 2.0 series.
  • qwen-image-2.1-* and qwen-image-3.0-* raise PriceQuoteRequired instead of returning a floor, since they are billed per output-resolution tier (1k/2k) and I have no verified offline tariff for them.
  • execute() catches that and reports cost_usd=None with cost_status: "unquoted"; legacy results report cost_status: "estimated", so estimated and unknown spend stay distinguishable.
  • docs/PROVIDERS.md now states that the 2.1/3.0 models are reported unquoted until a quote is supplied, and the skill documents the same.

Tests

  • TestPricing covers the legacy verified rate, both output tiers (1k/2k) raising a quote instead of falling back to $0.02, the missing-price path, and the cost_status reported in results.
  • TestCacheIdentity covers the changed-input cache regressions (mode change, thinking change, identical inputs).
  • pytest tests/tools/test_dashscope_image_models.py tests/contracts/test_dashscope_tools.py -q -> 139 passed
  • Full tests/contracts tests/tools -> 2766 passed, 4 failures that are pre-existing environment issues unrelated to this change (outdated certifi bundle, GBK Makefile decode on Windows, Thai caption segmentation).

No provider calls were made; all tests run against mocked responses.

yluiop123 added a commit to yluiop123/OpenMontage that referenced this pull request Nov 9, 2026
@yluiop123
yluiop123 force-pushed the feat/dashscope-image-models branch 2 times, most recently from c0c1d74 to 1cba735 Compare November 17, 2026 11:58
yluiop123 added a commit to yluiop123/OpenMontage that referenced this pull request Nov 17, 2026
- offer qwen-image-3.0-pro, qwen-image-3.0, qwen-image-2.1-pro,
  qwen-image-2.1-turbo and qwen-image-2.0 alongside the legacy 2.0 Pro
  default
- gate parameters by generation: negative_prompt is omitted for 2.1,
  and prompt_extend_mode / enable_thinking / size=auto are only sent to
  2.1 and 3.0
- reject unsupported combinations before the API call and expose the
  parameters actually sent in the result payload
- price generations from the published QwenCloud Beijing tariff matrix
  (1k/2k output tiers, z-image prompt_extend) and bill only the images
  actually returned; unpriced models or size=auto report cost_usd=None
  with cost_status="unquoted"
- document the model generations, parameter matrix, and tariffs; add unit
  tests
@yluiop123
yluiop123 force-pushed the feat/dashscope-image-models branch from 1cba735 to 42354cc Compare November 17, 2026 12:04
yluiop123 added a commit to yluiop123/OpenMontage that referenced this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants