MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / generateImage

Method generateImage

src/api/providers/openrouter.ts:659–682  ·  view source on GitHub ↗

* Generate an image using OpenRouter's image generation API (chat completions with modalities) * Note: OpenRouter only supports the chat completions approach, not the /images/generations endpoint * @param prompt The text prompt for image generation * @param model The model to use for generatio

(
		prompt: string,
		model: string,
		apiKey: string,
		inputImage?: string,
	)

Source from the content-addressed store, hash-verified

657 * @returns The generated image data and format, or an error
658 */
659 async generateImage(
660 prompt: string,
661 model: string,
662 apiKey: string,
663 inputImage?: string,
664 ): Promise<ImageGenerationResult> {
665 if (!apiKey) {
666 return {
667 success: false,
668 error: "OpenRouter API key is required for image generation",
669 }
670 }
671
672 const baseURL = this.options.openRouterBaseUrl || "https://openrouter.ai/api/v1"
673
674 // OpenRouter only supports chat completions approach for image generation
675 return generateImageWithProvider({
676 baseURL,
677 authToken: apiKey,
678 model,
679 prompt,
680 inputImage,
681 })
682 }
683}

Callers 1

executeMethod · 0.95

Calls 1

Tested by

no test coverage detected