Replicate / fal.ai Configuration
Replicate and fal.ai are more like 'model API platforms. ' They can call models for images, audio, video, etc. , but not all models use the same set of parameters. Beginners need to first choose a specific model and then look at the input fields provided on that model's page.
Official information Downloads and documentation are subject to the official site.
How it is different from ordinary AI providers
| Platform | What you need to prepare first | Points to Note |
|---|---|---|
| Replicate | API Token, Model Page, Input Parameters | Official Node SDK usually reads REPLICATE_API_TOKEN the Token; the input fields differ for different models. |
| fal.ai | FAL_KEY, Model ID, Input Parameters | Official JS client usually reads FAL_KEY the Key; you also need to check the specific model page fields. |
| Ordinary Chat AI provider | Key, Base URL, Model Name | Mainly text/multimodal chat, does not mean it supports all image and video models |
First understand the specific model page
| Page Fields | What it means | How to Fill |
|---|---|---|
| Model ID / Version | Which specific model to call | Replicate commonly uses the format owner/model or owner/model: version given on the model page; fal.ai fills in according to the model page ID |
| Input schema | Which input fields this model requires | Fill in each item according to the model page, do not copy fields from another model. |
| Output | What does the returned result look like? | It may be an image URL, video URL, array, or task object. After calling, you need to extract the result according to the return format. |
| Example code | Official call examples generated for the current model | Preferably copy the current example from the model page first, then replace with your own Key and input content. |
Request example
Do not mix the writing of the following two platforms. Use the tab for the platform you are using, and only replace your own Key, model ID, and input fields.
Replicate example for creating a prediction task
import Replicate from "replicate"; const replicate = new Replicate({ auth: process.env.REPLICATE_API_TOKEN }); const output = await replicate.run("owner/model:version from the model page", { input: { prompt: "A clean product showcase video", duration: 5 } }); console.log(output); fal.ai example for calling the model
import { fal } from "@fal-ai/client"; fal.config({ credentials: process.env.FAL_KEY }); const result = await fal.subscribe("MODEL_ID_FROM_THE_MODEL_PAGE", { input: { prompt: "A photorealistic product poster", image_size: "square_hd" }, logs: true }); console.log(result.data); How to verify fields
The most important thing on such platforms is the "specific model page. " Do not just copy the platform Key; fill in the input field according to the model page.
| Errors or phenomena | Common Causes | Solutions |
|---|---|---|
| Model not found | Model ID, version number, or namespace is incorrect | Copy the full call name from the model page |
| Input field error | Field name, type, or required item does not meet the current model requirements | Check the input schema on the model page and add any missing items |
| Returned result is empty | The task may not be completed, or the output field is not in the position you are reading from | First print the full returned result, then extract the URL or file according to the output structure |
