[Inference Providers] deepinfra: add text-to-image support - #2397
[Inference Providers] deepinfra: add text-to-image support#2397ovuruska wants to merge 1 commit into
Conversation
Add DeepInfraTextToImageTask using DeepInfra's OpenAI-compatible v1/openai/images/generations endpoint. Mirrors the together/nscale text-to-image pattern: forwards the prompt, honors outputType (url/base64/blob/dataUrl/json), and applies prompt/model after caller parameters so neither can be overridden. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ca24da6. Configure here.
| return { | ||
| ...omit(params.args, ["inputs", "parameters"]), | ||
| ...(params.args.parameters as Record<string, unknown> | undefined), | ||
| response_format: params.outputType === "url" ? "url" : "b64_json", |
There was a problem hiding this comment.
Unsupported URL image output
Medium Severity
preparePayload sets response_format to url when outputType is url, but DeepInfra’s OpenAI-compatible images API only supports b64_json. That request can fail, or getResponse may return a Blob for a url request when only b64_json comes back. Other b64-only providers such as nscale reject url up front.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit ca24da6. Configure here.


What
Adds
DeepInfraTextToImageTaskso thedeepinfraprovider supports thetext-to-imagetask.DeepInfra exposes an OpenAI-compatible image endpoint, so this mirrors the existing
together/nscaletext-to-image helpers:v1/openai/images/generationspreparePayload: forwardsprompt, setsresponse_formatfromoutputType(url vs base64), and appliesprompt/modelafter caller parameters so neither can be overridden.getResponse: handlesurlandb64_jsonresponses, honoringjson/url/dataUrl/blob output types.Wired in
getProviderHelper.ts(deepinfra['text-to-image']). Existing deepinfra tasks are untouched.Test
Added a
textToImageintegration case to the DeepInfra suite inInferenceClient.spec.ts(same skip-gated pattern as the other deepinfra tasks).🤖 Generated with Claude Code
Note
Low Risk
Additive provider helper for an existing inference client; no auth, routing, or existing DeepInfra task changes. Risk is limited to image payload/response mapping for this provider.
Overview
Adds text-to-image for the
deepinfraprovider via a newDeepInfraTextToImageTaskwired ingetProviderHelper.Calls DeepInfra’s OpenAI-compatible
v1/openai/images/generationsendpoint. Payload mapsinputstoprompt, setsresponse_formatfromoutputType, and appliesprompt/modellast so callers cannot override them. Responses supportjson,url,dataUrl, and blob (fromurlorb64_json).Includes a skip-gated DeepInfra
textToImageintegration test usingstabilityai/sdxl-turbo.Reviewed by Cursor Bugbot for commit ca24da6. Bugbot is set up for automated code reviews on this repo. Configure here.