Key4UAPI Interface Integration
  1. Tutorials for Various Plugins/Software
Key4UAPI Interface Integration
  • Key4U English
    • Introduction
    • Contact
    • Quick Start with API
    • API Group Comparison Table
    • API Group Characteristics & Pricing Differences
    • Key4U Agent registration
    • Chat
      • ChatGPT API
        • ChatGPT Audio
          • GPT-4o-audio
          • Audio to Text whisper-1
          • Audio to Text gpt-4o-transcribe
          • Create voice gpt-4o-mini-tts
          • Create translation (not supported)
        • ChatGPT Chat
          • Chat Completion Object
          • Chat completion chunk object
          • Create Chat Completion (Streaming)
          • Create Chat Completion (Non-Streaming)
          • Create Chat Image Recognition (Streaming)
          • Create Chat Image Recognition (Streaming) best64
          • Create Chat Image Recognition (Non-streaming)
          • Create Chat Generation Diagram (Non-streaming)
          • Official Function Calling Invocation
          • Official N Testing
          • List models
          • Create Chat Function Call
          • Create Structured Output
          • Controlling Reasoning Model Effort Level
          • Create chat completion qwen-mt-turbo
          • Create Chat Completion - DeepSeek v3.1 Thinking Level (Streaming)
          • deepseek-ocr recognition
        • ChatGPT Auto-Completion (Completions)
          • Completion object
          • Creation completed
        • ChatGPT Embeddings
          • Embedded Object
          • Create Embedding
        • Web Search
          • web search
      • Anthropic Claude API
        • Chat Completion Object
        • Chat completion chunk object
        • Native format
          • Create Chat Completion (Streaming)
          • Create Function Call (Streaming)
          • Creating Formatted Output
          • Create Thinking Chat
          • PDF Support
          • PDF supports base64 format
          • Online Search
        • chat-compatible format
          • Create Thinking Chat
          • Create Chat Completion (Streaming)
          • Create Chat Completion (Non-Streaming)
          • Create Chat Image Recognition (Streaming)
          • Create Chat Image Recognition (Non-Streaming)
      • Google Gemini API
        • Native format
          • Text Generation
          • Text Generation - Stream
          • Text Generation + Thinking Stream
          • Image Generation
          • Image Generation gemini-2.5-flash-image
          • Image Generation gemini-2.5-flash-image Control Aspect Ratio
          • Image Generation gemini-3-pro-image-preview Control Aspect Ratio + Clarity
          • Image Editing
          • Image Understanding
          • Formatted Output
          • Function call
          • Document Understanding
          • URL context [native format]
          • Code Execution
          • google search
          • Video Understanding
          • URL context
          • Audio Understanding
          • Embeddings
          • TTS Text-to-Speech
          • Text generation gemini-3-pro-preview:generateContent
          • Imagen Generate Images
          • gemini-tts text-to-speech
          • Text Embedding
        • chat-compatible format
          • Gemini Image Generation API [Chat-Compatible Format]
          • Chat Interface [chat compatible format]
          • Chat Interface - Thought 1 [chat compatible format]
          • Chat Interface - Thought 2 [chat compatible format]
          • Image Recognition API [chat-compatible format]
          • Chat + Read File Interface [chat compatible format]
          • Text Embedding [chat compatible format]
    • Chat (Responses)
      • Responses API vs Chat API Comparison
      • Create Model Response
      • Create function call
      • Create Model Response (Streaming Return)
      • Create Model Response (Control Thinking Length)
      • Create Web Search
      • Create model response gpt-5 enable thinking
      • Create Function Call Copy
    • Drawing Model
      • README
      • Image Object
      • Midjourney
        • Upload Image
        • Submit Imagine Task
        • Query task status by task ID
        • Query tasks by ID list
        • Get the seed of the task image
        • Execute Action
        • Submit Blend Task
        • Submit Describe Task
        • Submit Modal
      • Ideogram
        • Generate 3.0 (Text-to-Image) Generate
        • Generate 3.0 (Image Editing) Edit
        • Generate 3.0 (Image Remaster) Remix
        • Generate 3.0 (Image Reconstruction) Reframe
        • Generate 3.0 (Replace Background) Replace Background
        • ideogram (text-to-image)
        • Remix (Blend Image)
        • Upscale (Enhance to High Definition)
        • Describe
      • GPT Image Series
        • Create gpt-image-1
        • Edit gpt-image-1
        • Mask gpt-image-1
        • Create gpt-image-1.5
        • Edit gpt-image-1.5
        • Mask gpt-image-1.5
      • DALL·E 3
        • Create DALL·E 3
      • FLUX Series
        • GPT compatible format
          • Flux Image Creation (OpenAI dall-e-3 Format)
          • Flux Editor (OpenAI DALL-E-3 Format)
        • Replicate Official Format
          • Flux Resolution
          • Integration Tutorial
          • Create task black-forest-labs/flux-kontext-dev
          • Query Task
      • Doubao Series
        • doubao-seedream-3-0-t2i-250415
        • doubao-seededit-3-0-i2i-250628
        • doubao-seedream-4-0-250828-text-to-image
        • doubao-seedream-4-0-250828-image-to-image
        • doubao-seedream-4-0-250828-multi-image-to-image
        • doubao-seedream-4-5-251128 Text-to-Image (Pure Text Input, Single Image Output)
        • doubao-seedream-4-5-251128 Image-to-Image Generation (Single Image Input, Single Image Output)
        • doubao-seedream-4-5-251128 Multi-image Fusion (Multiple Image Input, Single Image Output)
        • doubao-seedream-4-5-251128 Image Group Output (Multiple Image Output)
        • doubao-seedream-4-5-251128 Single Image to Image Group
        • doubao-seedream-4-5-251128 Multiple reference image generation group image
      • Fal.ai platform
        • Status Code
        • Get request result
        • /fal-ai/nano-banana Text-to-Image
        • /fal-ai/nano-banana/edit Image Editing
      • Tencent AIGC Image Generation
        • Status Code
        • Get request result
        • Create Task
      • Qwen Series
        • qwen-image-max
        • z-image-turbo
        • qwen-image-edit-2509
    • Video Model
      • veo video generation
        • Unified Video Format
          • Status Code
          • Create Video
          • Create video with images
          • Query Task
          • Create Video (Reference Image)
        • OpenAI Video Format
          • OpenAI create video with image
          • OpenAI Query Task
          • openai download video
      • Luma video generation
        • Official API Format
          • Status Code
          • Submit Video Generation Task
          • Extended Video
        • Query Task
          • Query a Single Task
          • Batch Retrieve Tasks
      • Runway Video Generation
        • Status Code
        • Submit video generation task
        • Query Video Task (Free)
      • Minimax Video Generation
        • Status Code
        • Submit video generation task
        • Video Task Status Query
        • Image-to-Video
        • First and Last Frame Video
      • Doubao Video Generation
        • Text-to-Video Example
        • Image-to-Video - First Frame
        • seedance-lite-first-and-last-frames
        • Image to Video - Base64 Encoding
        • seedance-lite-reference image
        • Query a Single Task
        • Query Video Generation Task List - Default
        • Query Video Generation Task List - Search Multiple Task IDs
        • seedance-1-5-pro-first-and-last-frames
        • seedance-1-5-pro
      • Sora video generation
        • Unified Video Format
          • Query Task
          • Create video with images sora-2
          • Create video sora-2
          • Create video sora-2-pro
          • Create Video (with Character)
        • chat format
          • Create Video
          • Create video with images
          • Continuous Modification Video Generation
        • OpenAI Official Video Format
          • OpenAI create video with image
          • Creating Videos with Storyboards
          • OpenAI create video with image private mode
          • OpenAI Create Video (with Character)
          • OpenAI video editing
          • openai download video
          • OpenAI Query Task
        • Create Role
      • Grok Video Generation
        • Unified Video Format
          • Status Code
          • Create Video
          • Query Task
      • Tongyi Wanxiang Video Generation
        • Generate Video
        • Video Query
      • Tencent AIGC Video Generation
        • Status Code
        • Create Task
        • Get request result
    • GPTs Related
      • Introduction
      • GPTs Conversation
    • Text-to-Music Suno
      • Instructions
      • parameter
      • Task Submission
        • Generate Song (Inspiration Mode)
        • Generate Song (Custom Mode)
        • Generate Song (Continuation Mode)
        • Generate Song (Artist Style)
        • Generate Song (Upload Song for Secondary Creation)
        • Generate Song (Concatenate Song)
        • Generate Lyrics
        • Song Concatenation
        • Report upload completed
        • Query Upload Processing Status
        • Initialize audio file
        • Request Upload Authorization
        • S3 Upload Example
        • Scenario 1: Inspiration Mode
        • Scenario 2: Custom.Lyrics.SongName
        • Scenario 3: Pure Music - Custom
      • Query Interface
        • Batch Retrieve Tasks
        • Query a Single Task
        • Get WAV
        • Timing: Lyrics, Audio Timeline
        • Get Scene Details
    • Python Configuration Methods
      • Python Speech-to-Text
      • Python Text-to-Speech
      • Python Using Embeddings for Vectorization
      • Python Calling DALL·E
      • Simple Python OpenAI Function-Calling Demo
      • Simple Python LangChain calling OpenAI demo
      • Python llama_index Configuration
      • Python Fundamentals Conversation
      • Python uses gpt-4o to recognize images - local images
      • Using Python with GPT-4o to Recognize Images
      • Using Claude to Recognize Images in Python
      • Python library streaming output
      • GPT Realtime Model Invocation
      • Python request streaming output demo
      • Python using gpt-image-1 to create and edit images
      • Python OpenAI official library (using AutoGPT, langchain, etc.)
      • Python continuous conversation
    • Rerank Reranking Model
      • Reordering
    • Kling Platform
      • Callback Protocol
      • Text-to-video
        • Text-to-video
        • Query Task (Single)
      • Image-to-Video
        • Image-to-Video
        • Query Task (Single)
      • Omni-Video
        • Omni-Video
        • Query Task (Single)
      • Multi-image reference video
        • Multi-image reference video
        • Query Task (Single)
      • Multimodal Video Editing
        • Initialize video to be edited
        • Add Video Selection
        • Delete Video Selection
        • Preview Selected Region Video
        • Multimodal Video
        • Query Task (Single)
      • Video Extension
        • Video Extension
        • Query Task (Single)
      • Video Effects
        • Video Effects
        • Query Task (Single)
      • Image Generation
        • Image Generation
        • Query Task (Single)
      • Multi-image reference image generation
        • Multi-image reference image generation
        • Query Task (Single)
      • Omni-Image
        • Omni-Image
        • Query Task (Single)
      • Expand image
        • Expand image
        • Query Task (Single)
      • Image Recognition
        • Image Recognition
      • Digital human
        • Digital human
        • Query Task (Single)
      • Text-to-Speech Sound Effects
        • Text-to-Speech Sound Effects
        • Query Task (Single)
      • Video-to-Audio
        • Video-to-Audio
        • Query Task (Single)
      • Speech Synthesis
        • Speech Synthesis
      • Virtual Try-On
        • Virtual Try-On
        • Query Task (Single)
      • lip-sync
        • Face Recognition
        • lip-sync
        • Query Task (Single)
      • Custom Voice
        • Custom Voice
        • Query Custom Voice (Single)
        • Query Official Voice
        • Delete Custom Voice
      • Action Control
        • Action Control
        • Query Task (Single)
      • subject
        • subject
    • Replicate Aggregation Platform
      • Integration Tutorial
      • Flux Resolution
      • Query Task
      • Create Task - Via Model Version (predictions)
      • Create task stability-ai/stable-diffusion
      • Create task stability-ai/sdxl
      • Create Task stability-ai/stable-diffusion-inpainting
      • Create task stability-ai/stable-diffusion-img2img
      • Create task lucataco/flux-schnell-lora
      • Create task lucataco/flux-dev-lora
      • Create task andreasjansson/stable-diffusion-animation
      • Create task sujaykhandekar/object-removal
      • Create task cjwbw/rembg
      • Create task lucataco/animate-diff
      • Create task ideogram-ai/ideogram-v2-turbo
      • Create task black-forest-labs/flux-kontext-dev
      • Create task minimax/video-01-live
      • Create task minimax/video-01
      • Create task recraft-ai/recraft-v3
      • Create task recraft-ai/recraft-v3-svg
      • Create task black-forest-labs/flux-1.1-pro-ultra
      • Create task black-forest-labs/flux-kontext-pro
      • Create task black-forest-labs/flux-kontext-max
      • Create task flux-kontext-apps/multi-image-kontext-max
      • Create task flux-kontext-apps/multi-image-kontext-pro
      • Create task lucataco/remove-bg
      • Create task riffusion/riffusion
      • Create task black-forest-labs/flux-fill-dev
      • Create task black-forest-labs/flux-fill-pro
      • Create task google/imagen-4-fast
      • Create task google/imagen-4-ultra
      • Create task google/imagen-4
      • Create task prunaai/vace-14b
      • Create task bytedance/seedream-4
    • Minimax Platform
      • Create Asynchronous Text-to-Speech Task V2
      • Synchronous Text-to-Speech V2
      • Text-to-Image-to-Video Generation Task
      • Upload Reproduced Audio
      • Upload Sample Audio
      • First and Last Frame Video Generation
      • Timbre Quick Replication
      • Query video generation task status
      • Retrieval (for video download, asynchronous audio download)
      • Text Synthesis
      • Query Speech Synthesis Task Status
      • Timbre Design
    • minimax-voice (TTS)
      • Generate speech from Minimax
    • Vidu Platform: Video Generation, Image Generation, Audio Generation
      • Status Code
      • Create a text-to-video task
      • Create Image-to-Video Task
      • Create Image Generation Task
      • Create Text-to-Speech Audio Task
      • Speech Synthesis
      • Create Reference Video Task
      • Create First and Last Frame Generated Video Task
      • Get request result
    • Fal-ai Aggregation Platform
      • Integration Tutorial
      • falai-veo3 video generation
        • /fal-ai/veo3
        • /fal-ai/veo3/fast/image-to-video
        • /fal-ai/veo3/fast
        • /fal-ai/veo3/requests/{request_id}
        • /fal-ai/veo3/image-to-video
      • Get request result
      • /fal-ai/flux-1/dev
      • /fal-ai/flux-1/dev/image-to-image
      • /fal-ai/flux-1/dev/redux
      • /fal-ai/flux-1/schnell/redux
      • /fal-ai/flux-pro/kontext
      • /fal-ai/flux-pro/kontext/text-to-image
      • /fal-ai/flux-pro/kontext/max
      • /fal-ai/flux-pro/kontext/max/multi
      • /fal-ai/wan/v2.2-a14b/image-to-image
      • /fal-ai/bytedance/seedream/v4/text-to-image
      • /fal-ai/bytedance/seedream/v4/edit
      • /fal-ai/vidu/reference-to-image
      • /fal-ai/imagen4/preview
      • /fal-ai/qwen-image-edit-lora
      • /fal-ai/qwen-image-edit-plus
      • /fal-ai/kling-video/v2.5-turbo/pro/text-to-video
      • /fal-ai/kling-video/v2.5-turbo/pro/image-to-video
      • /fal-ai/flux-lora
      • /fal-ai/flux-lora/image-to-image
      • /fal-ai/flux-lora/inpainting
      • /fal-ai/kling-video/v2.5-turbo/pro/text-to-video
      • /fal-ai/qwen-image-edit-lora
    • PHP Configuration Methods
      • PHP Image Editing Demo
    • Node.js configuration methods
      • Node.js Basic Conversation
    • Tutorials for Various Plugins/Software
      • Codex Configuration Tutorial
      • OpenClaw Clawdbot Custom Relay Station Configuration Tutorial
      • N8N Workflow Using Relay API Tutorial
      • OpenCode Configuration Tutorial
      • Gemini CLI Relay Station Configuration and Usage Tutorial
      • Claude Code Installation and Usage Tutorial
      • CherryStudio Calling Claude MCP
      • Cherry Studio Configuration Tutorial
      • Cherry Studio Configuration Tutorial for Banana Pro 4K and Resolution Settings
      • CherryStudio Configuration o4 Reasoning Level
      • Dou Zi Workflow Simple Configuration from Input to URL Retrieval
      • Add Model to Dify
      • Cline Configuration Tutorial
      • Aider Configuration Tutorial
      • Cursor Configuration Tutorial
      • LobChat Setup Tutorial
      • ChatBox (Recommended)
      • Open Source gpt_academic
      • NextChat Setup Tutorial
      • Zotero GPT Configuration Method
      • CLAUDE DEV Configuration Tutorial
      • Immersive Translation - Configure GPT Translation
      • Browser Extension ChatGPT Sidebar
      • ChatGPT-on-WeChat Configuration Tutorial
      • ChatGPT GPT Academic Optimization Configuration GPT Tutorial
      • RikkaHub Configuration Tutorial
      • Coze Workflow Relay API Tutorial
      • n8n Workflow Example: Fetching Local Images and Generating Videos
      • OpenClaw Latest Version Custom Relay Station Configuration Tutorial
    • Help Center
      • AI return field: thinking-related
      • HTTP Status Codes and Their Meanings
      • Self-hosted Image Hosting API
  1. Tutorials for Various Plugins/Software

Dou Zi Workflow Simple Configuration from Input to URL Retrieval

If you are a Kouzhi VIP member, you can directly download the workflow and import it#

https://wwaod.lanzn.com/b011lwl8ij
Password: 3qnp

A simple loop workflow example using Sora2, from input text and uploaded images to finally obtaining the URL (the following is the overall diagram)#

Enterprise WeChat Screenshot_17677735722402.png

I. Getting Started#

Add input variables based on the prompt and image. Configure them according to the parameters required by the API. You can also add more parameters if needed.
Enterprise WeChat Screenshot_1767773636845.png

II. Request Model (Add HTTP Node)#

Configure the HTTP request according to the documentation
1.
Configure the request method and URL in the first red box
2.
Configure the request headers in the second red box
3.
Configure the request body in the third area. Please select the format according to the corresponding request body in the documentation. In this example, JSON is used. Parameters marked with a start are obtained from the previous input. When editing, you can directly input {} to select them.
Enterprise WeChat Screenshot_17677740268061.png

III. Process Request Result to Obtain taskId (Add Code Node)#

As shown in the figure, when inputting, the variable value directly obtains the output body from the previous step.
Use code to parse the body and obtain the id within it (in this example, the code language chosen is JavaScript, as shown below)
async function main({ params }: Args): Promise<Output> {
    // 1. Get the body string from params.input
    // Note: Here we assume params.input is the entire HTTP response object
    const bodyStr = params.input;

    // 2. Parse the string format body into a JSON object
    // Since the value of body is a string "{\"id\":...}", JSON.parse is needed
    let taskId = "";
    try {
        const bodyObj = JSON.parse(bodyStr);
        taskId = bodyObj.id;
    } catch (e) {
        // Prevent parsing failure from causing runtime errors
        console.log("JSON parsing failed:", e);
    }

    // 3. Build the output object and return taskId
    const ret = {
        "taskId": taskId
    };

    return ret;
}
The variable name at the final output location should be consistent with the parameter name in ret in the code.
Enterprise WeChat Screenshot_17677742429398.png

IV. Loop Request Query Interface to Obtain URL (Add Loop Node)#

1. Set up the loop (in this example, an infinite loop is used and exits based on judgment conditions). Configure as needed.#

The intermediate variable is the taskId obtained from the output of the previous code node.
Output the URL and status.
Enterprise WeChat Screenshot_17677745518897.png

2. Add an HTTP node in the loop to request the query task#

The parameters in the request body should be based on the query task of the model used in the documentation.
Enterprise WeChat Screenshot_17677753812075.png

3. Add a code node to obtain the URL and task status#

As shown in the figure, the input is the output body from the query task. The code is as follows:
async function main({ params }: Args): Promise<Output> {
    // 1. Get the body string from params.input
    const bodyStr = params.input;

    // 2. Parse the string format body into a JSON object
    let url = "";
    let status = "";
    try {
        const bodyObj = JSON.parse(bodyStr);
        url = bodyObj.video_url;
        status = bodyObj.status;
    } catch (e) {
        // Prevent parsing failure from causing runtime errors
        console.log("JSON parsing failed:", e);
    }

    // 3. Build the output object and return taskId
    const ret = {
        "url": url,
        "status": status
    };

    return ret;
}
Enterprise WeChat Screenshot_17677755174326.png

4. Add a judgment node to determine whether the query has obtained the URL#

In this example, the judgment node sets up two branches. The first branch checks whether the URL obtained from the output of the previous code node is empty.
The second branch checks whether the status is failed.
Enterprise WeChat Screenshot_17677757634138.png

5. Execute based on the judgment results#

Add a node to terminate the loop. When the first or second judgment of the judgment node succeeds, terminate the loop.
Add a timer node and a continue loop node. When both judgments of the judgment node are false, first execute the timer (to prevent request concurrency from causing request failures, it is recommended to set it to 1500ms). Connect the continue loop after the timer.
Enterprise WeChat Screenshot_17677758794115.png

V. Process the Results Obtained from the Loop (Add a Code Node)#

Since the result obtained after the loop is an array, it needs to be processed to only obtain the final output result (code as follows).
The input is the result output from the loop.
async function main({ params }: Args): Promise<Output> {

    // Get the input
    const urls = params.urls;
    const statuss = params.statuss;

    // 3. Build the output object and return taskId
    const ret = {
        "url": urls[urls?.length -1],
        "status": statuss[statuss?.length -1]
    };

    return ret;
}
The output is the processed URL and status.
Enterprise WeChat Screenshot_17677761996893.png

VI. Determine Whether the URL Has a Value to Confirm Whether Video Generation Succeeded or Failed#

Enterprise WeChat Screenshot_17677764885854.png

VII. Final Output Result#

As shown in the figure, output the success and failure results and then end. You can choose to output text or variables according to your needs, and you can also place the output result in the end node output.
Enterprise WeChat Screenshot_17677765862529.png
Enterprise WeChat Screenshot_17677765941365.png

VIII. Implementation Result#

Enterprise WeChat Screenshot_17677770925315.png
Modified at 2026-03-06 15:34:52
Previous
CherryStudio Configuration o4 Reasoning Level
Next
Add Model to Dify
Built with