FlowRunner
PricingContact
Theme
Start Free

PiAPI

AI

Reach dozens of generative AI models behind one PiAPI key and one unified task API, covering the major image, video, and audio families. Agents generate media without an account per model provider.

39 actions API key available
Platform Documentation ↗ Capability data verified 2026-08-01
A product launch brief lands with a hero still and a script for a short promo clip
Agent runs Get Account Info and confirms the credit balance covers the planned tasks
Agent calls Generate Kling Video to animate the still, then Create Kling Lip Sync to add the narration
Agent runs Wait For Task on each job and pulls the finished media URLs
Agent calls Save Task Output To File so the clip survives PiAPI's retention window
Agent posts the stored clip to the campaign channel with the credit cost of the run
The brand owner approves the clip for publication, or sends back a note and the agent regenerates

What This Integration Enables

PiAPI's product is not a model. It is a task API, and that is the honest reason to build on it. FLUX, Midjourney, Kling, Sora 2, Veo 3, Luma, Qwen-Image, Wan, Hunyuan, SkyReels, Trellis 3D, Nano Banana, face swap, MMAudio, and DiffRhythm all arrive behind the same lifecycle: a create action returns a task ID immediately, the flow polls Get Task or blocks on Wait For Task, and the finished output lands in a result object. One credit balance covers all of it. If PiAPI disappeared tomorrow, what you would miss is not any one model, it is the fact that a dozen model families stopped behaving like a dozen different products.

Two things follow from that design, and both are worth building around. First, Create Custom Task is a real escape hatch, not a footnote. Any PiAPI task type reachable by model and raw input object can be submitted through it, so a model released this week does not wait on a connector update to be usable in a flow. Second, PiAPI deletes generated assets after a short retention window, three days for most models, which means Save Task Output To File is not optional housekeeping. It is the step that decides whether the thing you paid to generate still exists next week.

The connector is deliberate about one more thing. PiAPI is sunsetting its Midjourney service at Midjourney's request, so the four Midjourney actions here are best treated as legacy rather than as the foundation of a new pipeline.

Without FlowRunner

A job model per vendor Every generative provider has its own submission shape, status vocabulary, and polling rules
Assets expire quietly Generated media sits on a provider CDN on a short clock that nobody is watching
New models mean new plumbing Adopting a newly released model waits on somebody wiring up another API

With FlowRunner

One task lifecycle Create returns a task ID, poll it, persist the output, in the same shape for every model family
Outputs land in durable storage The finished asset is written into FlowRunner file storage before the retention window closes
New models reachable the day they ship Create Custom Task submits any PiAPI task type without waiting for a dedicated action

Use Case Scenarios

Turning a product still into a social clip

A single approved product photograph becomes a short vertical video. The agent animates it with Generate Kling Video, adds a synchronized soundtrack with Generate Video Soundtrack, upscales the result with Upscale Video, and writes the finished MP4 into FlowRunner file storage with Save Task Output To File. The URL goes to the social queue in Notion with the credit cost attached, so the team can see what the clip actually cost before deciding to do fifty more.

Catalog imagery cleanup at volume

New supplier photos arrive with inconsistent backgrounds and resolutions. The agent runs Remove Image Background on each, then Upscale Image with face enhancement off, then uses Segment Image where a specific component needs to be pulled out for a detail shot. Each step is a task the flow tracks by ID, and List Active Tasks keeps the concurrency inside what the plan allows rather than firing everything at once and stalling.

Reaching a model that shipped this morning

A newly released model has no dedicated action here yet. Rather than waiting, the agent submits it through Create Custom Task with the model name, task type, and a raw input object, then polls the result with Get Task exactly as it would for any built-in action. The flow that consumes the output does not know or care which path produced it.

Human-in-Loop Highlight

Swap Face In Image and Swap Face In Video are where this connector stops being a rendering pipeline and starts touching a real person. A face swap applies someone's likeness to footage they did not sit for, and once that clip is generated and posted, no amount of deleting the task undoes who saw it. There is also no cancel operation in this API. Once a task is submitted the credit is spent and the job runs to completion, so the moment before submission is the last moment anything can be changed. So the agent treats every face swap as a stop. It assembles the source and target media, does not submit, and asks the brand and legal owner in Slack: "This clip applies the likeness in source.jpg to a video intended for paid distribution. Confirm the likeness release covers this use and this channel. Approve to submit, or reject and I will discard the inputs." A person confirms the rights, or the task never exists. Everything else in this connector can be regenerated. A person's face is the one input where the agent's confidence is not the thing that should decide.

Agent processes routinely
Detects exception requiring judgment
Clear match Continues automatically
Ambiguous Routes to human via Slack
Human decides
Agent resumes with decision

Agent Capabilities

39 actions

Task Lifecycle

5
  • Get Account Info Returns the account behind the configured key with the remaining credit balance and its dollar equivalent. Used as a pre-flight check before dispatching expensive video work.
  • List Active Tasks Lists every task currently running on the account across all models. Used to watch concurrency, spot a stuck job, and decide whether there is room to queue more work. Completed tasks are not returned here.
  • Get Task Fetches the current state and result of a task by ID. Statuses move through pending, starting, processing, and then success, failed, or retry. This is the polling primitive every create action feeds into.
  • Wait For Task Polls a task until it reaches a terminal state or the timeout elapses, then returns the final task object. Convenient for flows that need the media inline, though long video jobs run for several minutes, so raise the timeout accordingly.
  • Create Custom Task Submits any PiAPI task through the unified create-task endpoint by supplying a model, a task type, and a raw input object. The escape hatch for model families that do not have a dedicated action here yet, including Suno, Seedance, Seedream, Hailuo, TTS, GPT Image, Framepack, and OmniHuman.

Files

2
  • Save Task Output To File Downloads the media a finished task produced and stores it in FlowRunner file storage, returning both the stored URL and the original one. PiAPI deletes generated assets after a short retention window, so this is the step that decides whether the asset still exists next week. The task must already be in a terminal state.
  • Upload Temporary File Uploads a file to PiAPI's ephemeral store and returns a public URL usable as image, video, or audio input to any generation action. Files are removed after 24 hours, must be 10 MB or smaller, and must be jpg, jpeg, png, webp, mp4, wav, or mp3.

FLUX

2
  • Generate Flux Image Creates a text-to-image task on PiAPI's self-hosted FLUX models. Schnell is fastest and the only variant that batches up to four images, dev produces higher fidelity, and dev-advanced unlocks LoRA and ControlNet task types.
  • Transform Flux Image Creates an image-to-image task that restyles a source image according to a prompt. The denoise value controls how far the result departs from the original, so lower values preserve the source and higher values follow the prompt.

Midjourney

4
  • Midjourney Imagine Submits a Midjourney imagine job that renders a 2x2 grid from a text prompt. Process mode trades speed against cost, from relax through turbo. Treat as legacy, since PiAPI is sunsetting its Midjourney service at Midjourney's request.
  • Midjourney Upscale Upscales one quadrant of a completed imagine grid, or applies a secondary upscale to an already-upscaled image. Image 1 through Image 4 select the quadrant.
  • Midjourney Variation Generates a new 2x2 grid of variations from one quadrant of a completed imagine task, or re-rolls an upscaled image with more or less deviation.
  • Midjourney Describe Inspects an image and returns four candidate prompts that could have produced it. Used to reverse-engineer a style before generating new work in it.

Kling

4
  • Generate Kling Video Creates a text-to-video or image-to-video task. Leave the image empty for text-to-video, or supply one to animate a still and add an end frame to interpolate towards a final image. Professional mode costs more and produces sharper motion.
  • Extend Kling Video Continues a previously generated Kling video from its final frame, guided by a new prompt, referencing the original by task ID. Used to build a longer sequence out of approved short segments.
  • Create Kling Lip Sync Adds synchronized lip movement to an existing Kling video, driven either by synthesized speech or by an audio file you supply. A supplied recording takes precedence and text-to-speech settings are then ignored.
  • Apply Kling Effect Animates a still image with one of Kling's preset effect templates rather than a free-form prompt. Squish compresses and rebounds the subject, Expansion inflates it.

Sora

2
  • Generate Sora Video Creates an OpenAI Sora 2 video task with synchronized dialogue and sound at 720p. Supply an image to use as the opening frame, or leave it empty for pure text-to-video. Pro quality renders at a higher price per second.
  • Remove Sora Watermark Strips the watermark from a Sora video generated through PiAPI and returns a clean copy.

Veo

1
  • Generate Veo Video Creates a Google Veo 3 video task with optional native audio. Fast speed trades some fidelity for a much lower price, and disabling audio reduces cost further, which makes this the practical choice for high-volume draft work.

Luma

1
  • Generate Luma Video Creates a Luma Dream Machine video task. Supply a start image to animate a still, an end image to interpolate towards a final frame, or neither for pure text-to-video. Loop produces a seamlessly repeating clip.

Qwen Image

2
  • Generate Qwen Image Creates a text-to-image task on Alibaba's Qwen-Image model, which is notably strong at rendering legible text inside an image. Useful for signage, packaging mockups, and posters where the words have to be readable.
  • Edit Qwen Image Edits an image using natural-language instructions, optionally blending in up to two extra reference images. Typical uses are swapping clothing or backgrounds, compositing subjects from several photos, and adding rendered text.

Wan

2
  • Generate Wan Text To Video Creates a text-to-video task on Alibaba's Wan models. The 1.3B variant is fastest and cheapest, the 14B variant renders better motion and detail, and Wan 2.2 is the newest generation. A LoRA style can be applied.
  • Generate Wan Image To Video Animates a still image with the Wan models, using the standard image-to-video variant, Wan 2.2, or the keyframe variant that interpolates between a start and an end image.

Hunyuan

1
  • Generate Hunyuan Video Creates a video with Tencent's HunyuanVideo model. Text to Video is the default, a LoRA mode applies a trained style, a Fast mode renders quicker at lower fidelity, and two image modes animate a supplied still.

SkyReels

1
  • Generate SkyReels Video Animates a still image with SkyReels, a model trained specifically for human-centric video. Works best on clear, well-lit images of people against uncluttered backgrounds.

3D

1
  • Generate Trellis 3D Model Generates a 3D asset with Microsoft Research's TRELLIS model from a text prompt or reference images. Generation runs in two stages, sparse structure then structured latent, each with its own sampling steps and guidance strength.

Face Swap

2
  • Swap Face In Image Replaces the face in a target image with the face from a source image. Both inputs must be publicly reachable images showing clear, well-lit faces. Outputs are retained on PiAPI's servers for three days, so persist anything you intend to keep.
  • Swap Face In Video Replaces faces throughout an MP4 video with a face taken from a source image. When several faces appear, you choose which ones to use and replace by index. This is the operation on this connector that most needs a person to approve it before it runs.

Audio

2
  • Generate Video Soundtrack Generates a synchronized soundtrack for a silent MP4 using MMAudio, which watches the footage and composes audio matching the on-screen action. A prompt guides the result towards the sound you want.
  • Generate Music Track Composes a full music track with DiffRhythm from timestamped lyrics and a style description. Base produces a shorter piece and Full a longer one, and a reference audio URL can be supplied to imitate a style.

Nano Banana

2
  • Generate Nano Banana Pro Image Generates or edits an image with Google's Nano Banana Pro model, the strongest option here for precise instruction-following edits. Accepts up to fourteen reference images to composite or edit, and supports output up to 4K.
  • Generate Nano Banana Image Generates or edits an image with Gemini 2.5 Flash Image, a faster and cheaper alternative to the Pro variant. Reference images can be passed to edit or composite them, or omitted for pure text-to-image.

Toolkit

5
  • Remove Image Background Removes the background from an image and returns a cut-out with transparency. RMBG-2.0 and BEN2 are cleaner on hair and fine edges than the RMBG-1.4 default.
  • Upscale Image Increases image resolution by two, four, or eight times. The source must be no larger than 2048 pixels on either side, and face enhancement can be enabled for portrait work.
  • Segment Image Extracts specific objects using semantic prompts such as clothes or shoes, with a negative prompt to exclude what you do not want and a segment factor to grow or shrink the mask edge.
  • Upscale Video Doubles the resolution of an MP4 and resizes it to a 720p or 1080p target while keeping aspect ratio. The source must be below 720p, between 10 and 240 frames, and no larger than 10 MB. Billing is per frame processed.
  • Remove Video Background Removes the background from an MP4 and produces a subject cut-out you can composite over new footage, or the mask itself if inverted output is enabled.

Frequently Asked Questions

What can FlowRunner do with PiAPI?

FlowRunner agents can run Get Account Info, List Active Tasks, and Get Task in PiAPI, plus 36 more actions.

Does connecting PiAPI to FlowRunner require OAuth?

No. PiAPI connects to FlowRunner with an API key, no OAuth flow required.

Can PiAPI trigger a FlowRunner workflow automatically?

PiAPI doesn't currently expose triggers in FlowRunner. It connects as an action step inside workflows started by another trigger.

Start building with PiAPI

$100 in credits. No card required. Connect in minutes.