ModelsLab
Generate images using Stable Diffusion and other models via ModelsLab.
Connect
Auth type: API key (secret_text). Pass the provider's API key or token as the connection's credential. It is sealed at rest and only opened on the server when an action runs.
- From your agent: integrations {action: "connect", piece, credentials, env} stores the credentials for dev, prod or all. Answers name the fields, never the values.
- Or set the integration's project secrets with the secrets tool (SLACK_BOT_TOKEN, DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN, TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN …): a call uses the connection, else those secrets. integrations {action: "catalog", piece} lists which ones work.
- Try one action now with integrations {action: "call", piece, piece_action, input}. It really sends.
Call it from a workflow
step.ctx.integrations.invoke("modelslab", action, input) resolves with the provider's answer and rejects when ModelsLab isn't connected or refuses. Wrap it in step.run so a retry sends once. See step.ctx. Its actions run through the integration runner, which the server's operator turns on: integrations {action: "catalog", piece: "modelslab"} says whether yours can call it.
// workflows/notify.ts: call ModelsLab when a booking is confirmed
import { on } from "@appbricx/workflows";
export const tellModelslab = on.transition("booking", "status", "confirmed", async (_event, step) => {
// Recorded once: a retry doesn't send it twice. Rejects when ModelsLab isn't connected.
const output = await step.run("ModelsLab", () =>
step.ctx.integrations.invoke("modelslab", "text-to-image", {
"prompt": "<prompt>"
}),
);
step.ctx.log("ModelsLab answered", output);
});{
"name": "integrations",
"arguments": {
"project_id": "<project-id>",
"action": "call",
"piece": "modelslab",
"piece_action": "text-to-image",
"input": {
"prompt": "<prompt>"
},
"env": "dev"
}
}curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/modelslab/text-to-image" \
-H "Authorization: Bearer $APP_KEY" \
-H "content-type: application/json" \
-d '{"props":{"prompt":"<prompt>"}}'Actions
text-to-image
Text to Image. Generate an image from a text prompt using ModelsLab.
| Input | Type | Description |
|---|---|---|
promptrequired | long text | The text prompt to generate an image from. |
negative_promptoptional | long text | Things to exclude from the image. |
model_idoptional | one of "flux" | "sdxl" | "stable-diffusion-2-1" | "realistic-vision-v5" | "dream-shaper-8797" | The model to use for image generation. |
widthoptional | number | Image width in pixels (256–1024, divisible by 8). |
heightoptional | number | Image height in pixels (256–1024, divisible by 8). |
num_inference_stepsoptional | number | Number of inference steps (20–50). |
guidance_scaleoptional | number | How closely the image follows the prompt (1–20). |
samplesoptional | number | Number of images to generate (1–4). |
seedoptional | number | Random seed for reproducibility (-1 for random). |
safety_checkeroptional | boolean | Enable safety filter. |
Details
- Id
modelslab- Category
- AI and ML
- Tags
- image, generation, stable-diffusion, ai
- Package
@activepieces/piece-modelslab@0.0.1- Runs
- Through the integration runner