feat: add Ideogram 4.0 image provider - #104
Conversation
Add a new `ideogram` image provider (Ideogram 4.0 / v4) alongside the existing Gemini and OpenAI providers, configured the same way via environment variables. - New `createIdeogramImageClient` calling the v4 `text_prompt` generate endpoint with `Api-Key` auth; downloads the ephemeral image URL. - `IDEOGRAM_API_KEY` config + validation, gated on `IMAGE_PROVIDER=ideogram`. - `IMAGE_QUALITY` drives both rendering speed (TURBO/DEFAULT/QUALITY) and the v4 resolution (aspect ratio selects orientation only, since v4 ties resolution to aspect ratio). - Prompt enhancement handled natively by Ideogram magic-prompt, so no separate text client/API key is required. - Rejects useGoogleSearch and image-to-image editing (unsupported on v4). - Docs (README, server.json) and tests updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks for this. A few points before it can move forward. The core value of this MCP is creating a structured prompt and generating an image from it. So adding a new image model means the prompt-optimization policy and quality level have to be aligned across providers. When GPT-Image-2 was added, we evaluated that the optimized prompt was equivalent in quality, speed, and cost. As a prerequisite, please verify against the live API. We can't merge anything that hasn't been verified end to end. On magic-prompt: with it ON, generation depends entirely on magic-prompt, whose output isn't visible. So if you want it ON, please confirm and evaluate that magic-prompt's prompt is equivalent or better, or attach evidence. Otherwise, optimize the prompt on the MCP side and use AUTO to let magic-prompt add on top of it. As a note, the docs list an OFF option, so disabling it looks possible. |
Summary
Adds a new
ideogramimage provider (Ideogram 4.0 / v4) alongside the existing Gemini and OpenAI providers, configured the same way via environment variables.New provider client (
src/api/ideogramImageClient.ts):createIdeogramImageClientcalls the v4/v1/ideogram-v4/generateendpoint withApi-Keyauth and atext_promptmultipart request, then downloads the ephemeral image URL into aBuffer. Follows the sameImageClient/Resultpatterns as the OpenAI client.Config: new
IDEOGRAM_API_KEYenv var + validation, gated onIMAGE_PROVIDER=ideogram(mirrors the Gemini/OpenAI key handling).Wiring:
mcpServerroutes to the Ideogram client when configured; since v4 enhances prompts natively (magic-prompt), the external text-model pipeline is skipped — no separate text client or API key required.IMAGE_QUALITYcontrols resolution + speed: the preset maps torendering_speed(TURBO/DEFAULT/QUALITY) and selects the v4resolution.aspectRatiochooses the orientation only, since v4 ties resolution to aspect ratio (every v4 resolution is ~4 MP).IMAGE_QUALITYfast2560x14401440x25602048x2048balanced2304x17281728x23042048x2048quality2496x16641664x24962048x2048Unsupported on v4 (rejected with clear errors):
useGoogleSearchand image-to-image editing — use Gemini/OpenAI for those.Docs (
README.md,server.json) updated.Notes / caveats (v4 API design, not implementation)
rendering_speedremains the stronger fidelity lever.Testing
tscbuild, Biome check/lint, dependency-cycle, and knip all pass.ideogramImageClienttests and an Ideogram provider-routing test.