openclaw - 💡(How to fix) Fix image_generate ignores agents.defaults.imageGenerationModel.primary, uses dialog model provider instead [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#71996Fetched 2026-04-27 05:36:19
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Timeline (top)
closed ×1commented ×1

Root Cause

In resolveCapabilityModelCandidatesForTool (openclaw-tools), the candidate provider ordering uses resolveDefaultModelRef(cfg).provider which resolves to the dialog model's provider (zai), not the imageGenerationModel provider (openai).

// Line ~2499
const primaryProvider = resolveDefaultModelRef(params.cfg).provider;  // returns "zai"
const orderedProviders = [primaryProvider, ...otherProviders.toSorted()];
// Result: [zai, google, minimax-portal, openai] → google wins

The function never reads imageGenerationModel.primary to determine priority.

Fix Action

Workaround

Specify model: "openai/gpt-image-2" explicitly in every image_generate call.

Code Example

{
  "agents": {
    "defaults": {
      "model": { "primary": "zai/glm-5-turbo" },
      "imageGenerationModel": { "primary": "openai/gpt-image-2" }
    }
  }
}

---

// Line ~2499
const primaryProvider = resolveDefaultModelRef(params.cfg).provider;  // returns "zai"
const orderedProviders = [primaryProvider, ...otherProviders.toSorted()];
// Result: [zai, google, minimax-portal, openai] → google wins
RAW_BUFFERClick to expand / collapse

Bug

image_generate tool ignores agents.defaults.imageGenerationModel.primary config and selects provider based on the dialog model's provider instead.

Reproduction

Config:

{
  "agents": {
    "defaults": {
      "model": { "primary": "zai/glm-5-turbo" },
      "imageGenerationModel": { "primary": "openai/gpt-image-2" }
    }
  }
}

Both google and openai providers are configured and authed.

Calling image_generate without explicit model param → routes to google/gemini-3.1-flash-image-preview instead of openai/gpt-image-2.

Root Cause

In resolveCapabilityModelCandidatesForTool (openclaw-tools), the candidate provider ordering uses resolveDefaultModelRef(cfg).provider which resolves to the dialog model's provider (zai), not the imageGenerationModel provider (openai).

// Line ~2499
const primaryProvider = resolveDefaultModelRef(params.cfg).provider;  // returns "zai"
const orderedProviders = [primaryProvider, ...otherProviders.toSorted()];
// Result: [zai, google, minimax-portal, openai] → google wins

The function never reads imageGenerationModel.primary to determine priority.

Expected

When imageGenerationModel.primary is set to openai/gpt-image-2, the tool should prefer openai as the provider, regardless of the dialog model's provider.

Environment

  • OpenClaw 2026.4.24 (cbcfdf6)
  • macOS Darwin 25.3.0 (arm64)
  • Node.js v22.22.1

Workaround

Specify model: "openai/gpt-image-2" explicitly in every image_generate call.

extent analysis

TL;DR

Update the resolveCapabilityModelCandidatesForTool function to prioritize the imageGenerationModel provider when determining the candidate provider ordering.

Guidance

  • Review the resolveCapabilityModelCandidatesForTool function to ensure it correctly reads the imageGenerationModel.primary config and uses it to determine the primary provider.
  • Verify that the imageGenerationModel.primary config is correctly set to openai/gpt-image-2 in the configuration file.
  • Consider updating the resolveDefaultModelRef function to accept an optional parameter specifying the model type (e.g., imageGenerationModel) to allow for more flexible provider resolution.
  • Test the updated function with different configuration scenarios to ensure the correct provider is selected.

Example

// Updated resolveCapabilityModelCandidatesForTool function
const primaryProvider = params.cfg.agents.defaults.imageGenerationModel.primary.provider;
const orderedProviders = [primaryProvider, ...otherProviders.toSorted()];

Notes

The provided workaround of specifying the model parameter explicitly in every image_generate call may not be desirable in all scenarios, and updating the resolveCapabilityModelCandidatesForTool function may be a more robust solution.

Recommendation

Apply workaround: Specify model: "openai/gpt-image-2" explicitly in every image_generate call, as this provides a temporary solution until the underlying issue can be addressed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix image_generate ignores agents.defaults.imageGenerationModel.primary, uses dialog model provider instead [1 comments, 2 participants]