Skip to content

feat(python-sdk): add image_config support for OpenRouter image generation (#466)#472

Merged
santoshkumarradha merged 2 commits intodev/add-videofrom
feat/466-image-improvements
Apr 18, 2026
Merged

feat(python-sdk): add image_config support for OpenRouter image generation (#466)#472
santoshkumarradha merged 2 commits intodev/add-videofrom
feat/466-image-improvements

Conversation

@santoshkumarradha
Copy link
Copy Markdown
Member

Summary

  • Adds explicit image_config parameter to generate_image_openrouter() in vision.py
  • Passes image_config through OpenRouterProvider.generate_image() in media_providers.py
  • Supports aspect_ratio, image_size, super_resolution_references, font_inputs

DX

result = await app.ai_generate_image(
    "A landscape painting",
    model="openrouter/google/gemini-3.1-flash-image-preview",
    image_config={"aspect_ratio": "21:9", "image_size": "4K"},
)

Test plan

  • test_openrouter_image_config_passthrough — verifies image_config reaches litellm
  • test_openrouter_image_without_config — verifies no regression when omitted
  • Full test suite passes
  • Ruff clean

Closes #466

@santoshkumarradha santoshkumarradha self-assigned this Apr 18, 2026
@santoshkumarradha santoshkumarradha requested review from a team and AbirAbbas as code owners April 18, 2026 08:45
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 18, 2026

Performance

SDK Memory Δ Latency Δ Tests Status
Python 7.9 KB -13% 0.33 µs -6%

✓ No regressions detected

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 18, 2026

📊 Coverage gate

Thresholds from .coverage-gate.toml: per-surface ≥ 86%, aggregate ≥ 88%, max per-surface regression ≤ 1.0 pp, max aggregate regression ≤ 0.50 pp.

Surface Current Baseline Δ
control-plane 87.30% 87.30% → +0.00 pp 🟡
sdk-go 90.70% 90.70% → +0.00 pp 🟢
sdk-python 93.63% 93.63% ↑ +0.00 pp 🟢
sdk-typescript 92.56% 92.56% → +0.00 pp 🟢
web-ui 90.02% 90.01% ↑ +0.01 pp 🟢
aggregate 89.02% 89.01% ↑ +0.01 pp 🟡

✅ Gate passed

No surface regressed past the allowed threshold and the aggregate stayed above the floor.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 18, 2026

📐 Patch coverage gate

Threshold: 80% on lines this PR touches vs origin/main (from .coverage-gate.toml:thresholds.min_patch).

Surface Touched lines Patch coverage Status
control-plane 0 ➖ no changes
sdk-go 0 ➖ no changes
sdk-python 0 ➖ no changes
sdk-typescript 0 ➖ no changes
web-ui 0 ➖ no changes

✅ Patch gate passed

Every surface whose lines were touched by this PR has patch coverage at or above the threshold.

- Fix empty dict bug: use `is not None` instead of truthiness check
- Update generate_image_openrouter docstring to document image_config param
- Add comment noting image_config is an OpenRouter-specific extension
@santoshkumarradha santoshkumarradha merged commit a7fa506 into dev/add-video Apr 18, 2026
19 checks passed
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.

1 participant