Skip to content
FLORA DocsGo to app

Start a generation run

client.runs.startGeneration(RunStartGenerationParams { project_id, prompt, type, 3 more } body, RequestOptionsoptions?): RunStartGenerationResponse { charged_cost, estimated_seconds, run_id, 6 more }
POST/runs/generation

Starts a model generation run in a project canvas using a prompt, workspace, project, optional model, and optional model parameters. Mutating public API requests support an optional Idempotency-Key header for client retries; duplicate keys within two hours return idempotency_duplicate.

ParametersExpand Collapse
body: RunStartGenerationParams { project_id, prompt, type, 3 more }
project_id: string

Project identifier

prompt: string

Generation prompt

minLength1
type: "image" | "video" | "audio" | "text"

Generation type

One of the following:
"image"
"video"
"audio"
"text"
workspace_id: string

Workspace identifier

model?: string

Model endpoint ID

params?: Record<string, unknown>

Model parameters

ReturnsExpand Collapse
RunStartGenerationResponse { charged_cost, estimated_seconds, run_id, 6 more }
charged_cost: number
minimum0
estimated_seconds: number | null
minimum0
run_id: string

Run identifier

type: "generation" | "technique" | "action"

Run type

One of the following:
"generation"
"technique"
"action"
action?: Action | null
action_id: "split-text" | "find-and-replace-text" | "concat-text" | 34 more

Action identifier

One of the following:
"split-text"
"find-and-replace-text"
"concat-text"
"ken-burns-video"
"color-grade-image"
"change-image-ar"
"rotate-image"
"flip-image"
"color-filter-image"
"color-tint-image"
"filter-color-image"
"blur-image"
"duplicate-image"
"side-by-side-composite"
"add-shape-to-image"
"generate-shape-image"
"add-text-to-image"
"generate-text-image"
"qr-code-generator"
"stitch-videos"
"split-video"
"extract-video-frames"
"color-grade-video"
"video-to-frame-grid"
"boomerang-video"
"reverse-video"
"video-to-long-exposure"
"video-effect"
"color-filter-video"
"speed-up-video"
"slow-down-video"
"duplicate-video"
"greenscreen-video"
"resize-video"
"change-video-ar"
"split-audio-from-video"
"merge-audio-into-video"
model?: Model | null
model_id: string

Model identifier

minLength1
poll_url?: string | null
formaturi
project_id?: string | null

Project identifier

technique?: Technique | null
name: string

Technique name

technique_id: string

Technique identifier

Start a generation run

import Flora from '@flora-ai/flora';

const client = new Flora({
  apiKey: process.env['FLORA_API_KEY'], // This is the default and can be omitted
});

const response = await client.runs.startGeneration({
  project_id: 'prj_abc123',
  prompt: 'A cinematic product photo of a ceramic mug on a sunlit table',
  type: 'image',
  workspace_id: 'ws_abc123',
});

console.log(response.run_id);
{
  "charged_cost": 0,
  "estimated_seconds": 0,
  "run_id": "run_abc123",
  "type": "generation",
  "action": {
    "action_id": "split-text"
  },
  "model": {
    "model_id": "t2i-flux-2-pro"
  },
  "poll_url": "https://example.com",
  "project_id": "prj_abc123",
  "technique": {
    "name": "name",
    "technique_id": "tech_abcd1234"
  }
}
{
  "error": {
    "code": "input_validation_error",
    "message": "prompt: Required",
    "fields": [
      {
        "field": "prompt",
        "message": "Required"
      }
    ]
  }
}
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key."
  }
}
{
  "error": {
    "code": "insufficient_credits",
    "message": "Insufficient credits."
  }
}
{
  "error": {
    "code": "forbidden",
    "message": "Forbidden."
  }
}
{
  "error": {
    "code": "not_found",
    "message": "Not found."
  }
}
{
  "error": {
    "code": "idempotency_duplicate",
    "message": "Duplicate idempotency key."
  }
}
{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit exceeded."
  }
}
{
  "error": {
    "code": "unknown_error",
    "message": "An unknown error occurred."
  }
}
Returns Examples
{
  "charged_cost": 0,
  "estimated_seconds": 0,
  "run_id": "run_abc123",
  "type": "generation",
  "action": {
    "action_id": "split-text"
  },
  "model": {
    "model_id": "t2i-flux-2-pro"
  },
  "poll_url": "https://example.com",
  "project_id": "prj_abc123",
  "technique": {
    "name": "name",
    "technique_id": "tech_abcd1234"
  }
}
{
  "error": {
    "code": "input_validation_error",
    "message": "prompt: Required",
    "fields": [
      {
        "field": "prompt",
        "message": "Required"
      }
    ]
  }
}
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key."
  }
}
{
  "error": {
    "code": "insufficient_credits",
    "message": "Insufficient credits."
  }
}
{
  "error": {
    "code": "forbidden",
    "message": "Forbidden."
  }
}
{
  "error": {
    "code": "not_found",
    "message": "Not found."
  }
}
{
  "error": {
    "code": "idempotency_duplicate",
    "message": "Duplicate idempotency key."
  }
}
{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit exceeded."
  }
}
{
  "error": {
    "code": "unknown_error",
    "message": "An unknown error occurred."
  }
}