siyuan-note/siyuan · error

unsupported multimodal provider protocol: %s

Error message

unsupported multimodal provider protocol: %s

What it means

Returned by validateImageModel when the resolved provider has a non-empty Protocol that is not "openai". The OpenAI image-generation adapter (util.NewOpenAIImageAdapter) only speaks the OpenAI /images/generations API, so providers declared with a different protocol (e.g. anthropic, google, custom) are rejected even if they have an image-capable model.

Source

Thrown at kernel/model/assets.go:484

		},
		RevisedPrompt: generated.RevisedPrompt,
	}, nil
}

func resolveMultimodalDocument(documentID string) (*treenode.BlockTree, error) {
	bt := treenode.GetBlockTree(strings.TrimSpace(documentID))
	if bt == nil {
		return nil, errors.New("document not found: " + documentID)
	}
	return bt, nil
}

func validateImageModel(provider *conf.Provider, imageModel *conf.Model) error {
	if provider == nil || imageModel == nil {
		return errors.New("image model is not configured")
	}
	if provider.Protocol != "" && provider.Protocol != "openai" {
		return fmt.Errorf("unsupported multimodal provider protocol: %s", provider.Protocol)
	}
	return nil
}

func documentReferencesImage(rootID, assetPath string) bool {
	paths, err := DocImageAssets(rootID)
	if err != nil {
		return false
	}
	wanted := AssetPathWithoutQuery(assetPath)
	for _, current := range paths {
		if AssetPathWithoutQuery(current) == wanted {
			return true
		}
	}
	return false
}

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Select an OpenAI-protocol (or OpenAI-compatible, protocol="") provider for image generation.
  2. If using a compatible gateway, leave provider.Protocol empty (it defaults to openai behavior) or set it to "openai".
  3. Move the image-generation model to an OpenAI-protocol provider entry.

Example fix

// before — provider.Protocol = "anthropic"
res, err := model.GenerateImage(ctx, req) // fails

// after — use an openai-protocol provider
provider.Protocol = "openai" // or "" for default
model.Conf.AI.ImageGeneration.ModelID = openAIProviderImageModelID
res, err := model.GenerateImage(ctx, req)
Defensive patterns

Strategy: validation

Validate before calling

p, _ := model.Conf.AI.GetImageGenerationModel()
if p != nil && p.Protocol != "" && p.Protocol != "openai" {
    return fmt.Errorf("provider protocol %q not supported for image generation", p.Protocol)
}

Prevention

When it happens

Trigger: Conf.AI.ImageGeneration.ModelID points at a model whose provider.Protocol = "anthropic" (or any non-openai/non-empty value); a provider was added with a custom protocol but selected for image generation.

Common situations: User picked a Claude/Gemini provider for image generation by mistake; a multi-protocol provider list selected the wrong entry; protocol field was set to a vendor name that the adapter doesn't understand.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/ead0b71668a05afe. Report an issue: GitHub.