KosmoKrator

data

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.

fal.ai CLI Setup

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

Install, configure, and verify
# 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 reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

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

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call fal.fal_list_models '{}' --json
Provider shortcut
kosmo integrations:fal fal_list_models '{}' --json

Discovery

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

Discovery commands
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

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

fal.fal_list_models

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

Read read
Parameters
none
Generic call
kosmo integrations:call fal.fal_list_models '{}' --json
Shortcut
kosmo integrations:fal fal_list_models '{}' --json

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.

Write write
Parameters
model_id, input, webhook_url
Generic call
kosmo integrations:call fal.fal_submit_request '{"model_id":"example_model_id","input":"example_input","webhook_url":"example_webhook_url"}' --json
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

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

Read read
Parameters
model_id, request_id
Generic call
kosmo integrations:call fal.fal_get_request_status '{"model_id":"example_model_id","request_id":"example_request_id"}' --json
Shortcut
kosmo integrations:fal fal_get_request_status '{"model_id":"example_model_id","request_id":"example_request_id"}' --json

fal.fal_get_result

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

Read read
Parameters
model_id, request_id
Generic call
kosmo integrations:call fal.fal_get_result '{"model_id":"example_model_id","request_id":"example_request_id"}' --json
Shortcut
kosmo integrations:fal fal_get_result '{"model_id":"example_model_id","request_id":"example_request_id"}' --json

fal.fal_list_files

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

Read read
Parameters
none
Generic call
kosmo integrations:call fal.fal_list_files '{}' --json
Shortcut
kosmo integrations:fal fal_list_files '{}' --json

fal.fal_upload_file

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

Write write
Parameters
file_path, file_name
Generic call
kosmo integrations:call fal.fal_upload_file '{"file_path":"example_file_path","file_name":"example_file_name"}' --json
Shortcut
kosmo integrations:fal fal_upload_file '{"file_path":"example_file_path","file_name":"example_file_name"}' --json

fal.fal_get_current_user

Get current fal.ai user profile and account information.

Read read
Parameters
none
Generic call
kosmo integrations:call fal.fal_get_current_user '{}' --json
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 0 parameters
Schema command
kosmo integrations:schema fal.fal_list_models --json
ParameterTypeRequiredDescription
No parameters.
fal.fal_submit_request 3 parameters
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 2 parameters
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 2 parameters
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 0 parameters
Schema command
kosmo integrations:schema fal.fal_list_files --json
ParameterTypeRequiredDescription
No parameters.
fal.fal_upload_file 2 parameters
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 0 parameters
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.