Skip to content

[Inference Providers] deepinfra: add text-to-image support - #2397

Open
ovuruska wants to merge 1 commit into
huggingface:mainfrom
ovuruska:deepinfra-text-to-image
Open

[Inference Providers] deepinfra: add text-to-image support#2397
ovuruska wants to merge 1 commit into
huggingface:mainfrom
ovuruska:deepinfra-text-to-image

Conversation

@ovuruska

@ovuruska ovuruska commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

What

Adds DeepInfraTextToImageTask so the deepinfra provider supports the text-to-image task.

DeepInfra exposes an OpenAI-compatible image endpoint, so this mirrors the existing together/nscale text-to-image helpers:

  • Route: v1/openai/images/generations
  • preparePayload: forwards prompt, sets response_format from outputType (url vs base64), and applies prompt/model after caller parameters so neither can be overridden.
  • getResponse: handles url and b64_json responses, honoring json/url/dataUrl/blob output types.

Wired in getProviderHelper.ts (deepinfra['text-to-image']). Existing deepinfra tasks are untouched.

Test

Added a textToImage integration case to the DeepInfra suite in InferenceClient.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 deepinfra provider via a new DeepInfraTextToImageTask wired in getProviderHelper.

Calls DeepInfra’s OpenAI-compatible v1/openai/images/generations endpoint. Payload maps inputs to prompt, sets response_format from outputType, and applies prompt/model last so callers cannot override them. Responses support json, url, dataUrl, and blob (from url or b64_json).

Includes a skip-gated DeepInfra textToImage integration test using stabilityai/sdxl-turbo.

Reviewed by Cursor Bugbot for commit ca24da6. Bugbot is set up for automated code reviews on this repo. Configure here.

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>
@ovuruska
ovuruska marked this pull request as ready for review August 21, 2026 12:47

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ca24da6. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant