KosmoKrator

ai

fal.ai CLI for AI Agents

Use the fal.ai CLI from KosmoKrator to call fal.ai tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 5 read 2 write API key auth

fal.ai CLI Setup

fal.ai can be configured headlessly with `kosmokrator integrations:configure fal`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure fal --set api_key="$FAL_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor fal --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_key FAL_API_KEY Secret secret yes API Key
url FAL_URL URL url no API Base URL

Call fal.ai Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call fal.fal_list_models '{}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:fal fal_list_models '{}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs fal --json
kosmo integrations:docs fal.fal_list_models --json
kosmo integrations:schema fal.fal_list_models --json
kosmo integrations:search "fal.ai" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to fal.ai.

fal.fal_list_models

Read read

List available fal.ai models. Returns model IDs, descriptions, and capabilities.

Parameters
none

Generic CLI call

kosmo integrations:call fal.fal_list_models '{}' --json

Provider shortcut

kosmo integrations:fal fal_list_models '{}' --json

fal.fal_submit_request

Write write

Submit a generation request to a fal.ai model. Returns the request ID for tracking. Poll get_request_status for progress.

Parameters
model_id, input, webhook_url

Generic CLI call

kosmo integrations:call fal.fal_submit_request '{"model_id":"example_model_id","input":"example_input","webhook_url":"example_webhook_url"}' --json

Provider shortcut

kosmo integrations:fal fal_submit_request '{"model_id":"example_model_id","input":"example_input","webhook_url":"example_webhook_url"}' --json

fal.fal_get_request_status

Read read

Get the status of a submitted fal.ai request. Returns queue position and processing state.

Parameters
model_id, request_id

Generic CLI call

kosmo integrations:call fal.fal_get_request_status '{"model_id":"example_model_id","request_id":"example_request_id"}' --json

Provider shortcut

kosmo integrations:fal fal_get_request_status '{"model_id":"example_model_id","request_id":"example_request_id"}' --json

fal.fal_get_result

Read read

Get the result of a completed fal.ai request. Returns generated media URLs and metadata.

Parameters
model_id, request_id

Generic CLI call

kosmo integrations:call fal.fal_get_result '{"model_id":"example_model_id","request_id":"example_request_id"}' --json

Provider shortcut

kosmo integrations:fal fal_get_result '{"model_id":"example_model_id","request_id":"example_request_id"}' --json

fal.fal_list_files

Read read

List files stored in fal.ai storage. Returns file names, URLs, and metadata.

Parameters
none

Generic CLI call

kosmo integrations:call fal.fal_list_files '{}' --json

Provider shortcut

kosmo integrations:fal fal_list_files '{}' --json

fal.fal_upload_file

Write write

Upload a file to fal.ai storage for use as model input. Returns the file URL.

Parameters
file_path, file_name

Generic CLI call

kosmo integrations:call fal.fal_upload_file '{"file_path":"example_file_path","file_name":"example_file_name"}' --json

Provider shortcut

kosmo integrations:fal fal_upload_file '{"file_path":"example_file_path","file_name":"example_file_name"}' --json

fal.fal_get_current_user

Read read

Get current fal.ai user profile and account information.

Parameters
none

Generic CLI call

kosmo integrations:call fal.fal_get_current_user '{}' --json

Provider shortcut

kosmo integrations:fal fal_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

fal.fal_list_models

List available fal.ai models. Returns model IDs, descriptions, and capabilities.

Operation
Read read
Schema command
kosmo integrations:schema fal.fal_list_models --json
ParameterTypeRequiredDescription
No parameters.

fal.fal_submit_request

Submit a generation request to a fal.ai model. Returns the request ID for tracking. Poll get_request_status for progress.

Operation
Write write
Schema command
kosmo integrations:schema fal.fal_submit_request --json
ParameterTypeRequiredDescription
model_id string yes The model identifier (e.g., "fal-ai/flux/schnell").
input object yes An object of model input values (e.g., prompt, image_url, etc.).
webhook_url string no A URL to receive POST notifications when the request completes.

fal.fal_get_request_status

Get the status of a submitted fal.ai request. Returns queue position and processing state.

Operation
Read read
Schema command
kosmo integrations:schema fal.fal_get_request_status --json
ParameterTypeRequiredDescription
model_id string yes The model identifier used when submitting the request.
request_id string yes The request ID returned by submit_request.

fal.fal_get_result

Get the result of a completed fal.ai request. Returns generated media URLs and metadata.

Operation
Read read
Schema command
kosmo integrations:schema fal.fal_get_result --json
ParameterTypeRequiredDescription
model_id string yes The model identifier used when submitting the request.
request_id string yes The request ID returned by submit_request.

fal.fal_list_files

List files stored in fal.ai storage. Returns file names, URLs, and metadata.

Operation
Read read
Schema command
kosmo integrations:schema fal.fal_list_files --json
ParameterTypeRequiredDescription
No parameters.

fal.fal_upload_file

Upload a file to fal.ai storage for use as model input. Returns the file URL.

Operation
Write write
Schema command
kosmo integrations:schema fal.fal_upload_file --json
ParameterTypeRequiredDescription
file_path string yes The local file path to upload.
file_name string no Custom file name for the upload. Defaults to the original file name.

fal.fal_get_current_user

Get current fal.ai user profile and account information.

Operation
Read read
Schema command
kosmo integrations:schema fal.fal_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.