Use ComfyUI workflows

更新时间:
复制 MD 格式

AI Creation Workshop provides easy-to-use workflow APIs for AI image generation and processing that enable quick integration with multiple programming languages.

Getting started

Prerequisites

  • The Intelligent Creation Workshop public cloud service is now available.

  • A development environment with Java 8+, Python 3.7+, or Node.js 14+.

Step 1: Obtain API credentials

Create an application

  1. Go to Application Management in the Zhizuo Gongfang console.

  2. Click Create Application and enter the application information.

  3. After the application is created, click View Details to retrieve the app_key and app_secret.

Configure environment variables (recommended)

# Set API credentials
export SPEEDPIX_APP_KEY="your-app-key"
export SPEEDPIX_APP_SECRET="your-app-secret"
export SPEEDPIX_ENDPOINT="https://openai.edu-aliyun.com"  # Optional

Step 2: Choose an SDK language

Language

Installation method

Documentation link

Java

Maven/Gradle

Java SDK integration guide

Python

pip install

Python SDK integration guide

Node.js

npm install

Node.js SDK integration guide

Go

go get

Go SDK integration guide

Step 3: Quick start (Java example)

Install dependencies

Maven:

<dependency>
    <groupId>com.aliyun.speedpix</groupId>
    <artifactId>speedpix-java</artifactId>
    <version>1.0.0</version>
</dependency>

Gradle:

implementation 'com.aliyun.speedpix:speedpix-java:1.0.0'

Call a workflow with a single line of code

import com.aliyun.speedpix.SpeedPix;
import com.aliyun.speedpix.model.ComfyPromptRequest;
import java.util.HashMap;
import java.util.Map;

public class QuickStart {

    public static void main(String[ ] args) throws Exception {

        // Prepare input parameters
        Map<String, Object> input = new HashMap<>();
        input.put("prompt", "Cinematic shot of vines wrapped around the walls of a country cottage, with clusters of translucent grapes in autumn");
        input.put("width", "768");
        input.put("height", "1024");
        input.put("control_image", "./input.jpg"); // Local files are uploaded automatically.
        
        // Call the workflow with a single line of code
        var result = SpeedPix.run(ComfyPromptRequest.builder()
            .workflowId("artistic_characters")
            .versionId("v4")
            .inputs(input)
            .build(), ResultDTO.class);
        
        // Save the result
        if (result.getOutput() != null && result.getOutput().getImages() != null) {
            result.getOutput().getImages().save("enhanced_output.png");
            System.out.println("Image saved!");
        }
    }
    
    // Define the output structure
    public static class ResultDTO {
        private ImageOutput images;
        public ImageOutput getImages() { return images; }
        public void setImages(ImageOutput images) { this.images = images; }
    }
}

Input image

Output image

教育

efd3ae5d76734e05975367449b6537b3_00000_