Skip to content

fix(img-forge): expose aspect_ratio, image_size, model params; gate model-derived tiers#48

Merged
stackbilt-admin merged 2 commits into
mainfrom
fix/issue-47-img-forge-schema-forwarding
May 6, 2026
Merged

fix(img-forge): expose aspect_ratio, image_size, model params; gate model-derived tiers#48
stackbilt-admin merged 2 commits into
mainfrom
fix/issue-47-img-forge-schema-forwarding

Conversation

@stackbilt-admin
Copy link
Copy Markdown
Member

Closes #47.

Summary

  • Schema (tool-registry.ts): adds aspect_ratio (10 ratios), image_size (512/1K/2K/4K), and model (gemini-3.1-flash-image-preview / gemini-3-pro-image-preview) to the image_generate input schema so MCP clients discover the new fields
  • Cost & billing (cost-attribution.ts): adds MODEL_QUALITY_TIER map and exports resolveImageQualityTier; when model is set it determines the effective tier for quota — model wins over quality_tier (gemini-3.1-flash → ultra, gemini-3-pro → ultra_plus)
  • Tier enforcement (gateway.ts): enforceTierRestriction calls resolveImageQualityTier, closing the bypass where a free-tier caller could set model without quality_tier and skip the Pro+ gate
  • Forwarding: no change needed — proxyToolCall already forwards args unchanged via JSON-RPC; the new fields pass through to img-forge automatically
  • Docs: README, docs/api-reference.md, docs/architecture.md, docs/user-guide.md updated with new params, model→tier mapping, and billing precedence rule

Deferred

notifications/tools/list_changed — the catalog rebuilds per-request via buildAggregatedCatalog, so reconnecting clients pick up the new schema automatically. Live-session notification is a separate transport concern and not part of this fix.

Test plan

  • npm run test — 187 tests pass (10 new cases added)
  • npm run typecheck — clean
  • Smoke: tools/list at gateway includes aspect_ratio, image_size, model on image_generate
  • Smoke: call with quality_tier: "ultra_plus", aspect_ratio: "2:3", image_size: "2K", model: "gemini-3-pro-image-preview" reaches img-forge unchanged and succeeds
  • Verify free-tier token + model: "gemini-3-pro-image-preview" is rejected with requires a Pro plan or higher
  • Audit logs show ultra_plus tier cost when model=gemini-3-pro-image-preview

🤖 Generated with Claude Code

Kurt Overmier and others added 2 commits May 6, 2026 08:01
…e model-derived tiers (#47)

Closes #47.

- tool-registry: add aspect_ratio (10 ratios), image_size (512/1K/2K/4K),
  and model (gemini-3.1-flash-image-preview / gemini-3-pro-image-preview)
  to image_generate input schema
- cost-attribution: add MODEL_QUALITY_TIER map and export
  resolveImageQualityTier; model wins over quality_tier for billing
  (gemini-3.1-flash → ultra, gemini-3-pro → ultra_plus)
- gateway: enforceTierRestriction uses resolveImageQualityTier, closing
  the bypass where free-tier callers could set model without quality_tier
- docs: README, api-reference, architecture, user-guide all updated with
  new params, model→tier mapping, and billing precedence rule
- tests: 10 new cases covering model-derived cost, collision policy,
  unknown-model fallback, and free-tier model bypass protection

Note: notifications/tools/list_changed deferred — catalog rebuilds
per-request so reconnecting clients pick up the new schema automatically.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…low test

- tool-registry: add default: '1:1' and default: '1K' to aspect_ratio
  and image_size so MCP clients can read defaults from schema
- gateway: drop inline comment on qualityTier in enforceTierRestriction
  (resolveImageQualityTier JSDoc carries this)
- test: add positive case — pro-tier + model=gemini-3-pro-image-preview
  should be allowed (catches over-gating regressions)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stackbilt-admin stackbilt-admin merged commit 1f9c997 into main May 6, 2026
1 check passed
@stackbilt-admin stackbilt-admin deleted the fix/issue-47-img-forge-schema-forwarding branch May 6, 2026 13:05
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.

Expose and forward img-forge params: aspect_ratio, image_size, model

1 participant