← Back to Skills Marketplace
byungkyu

fal.ai

by byungkyu · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
355
Downloads
0
Stars
2
Active Installs
1
Versions
Install in OpenClaw
/install fal-ai-api
Description
fal.ai API integration with managed API key authentication. Run AI models for image generation, video generation, audio processing, and more. Use this skill...
README (SKILL.md)

fal.ai

Access the fal.ai queue API with managed API key authentication. Run 1000+ AI models including image generation (Flux, SDXL), video generation (Minimax), image upscaling, text-to-speech, and more.

Quick Start

# Generate an image with Flux Schnell
python \x3C\x3C'EOF'
import urllib.request, os, json

data = json.dumps({
    "prompt": "a tiny cute cat",
    "image_size": "square_hd",
    "num_images": 1
}).encode()

req = urllib.request.Request('https://gateway.maton.ai/fal-ai/fal-ai/flux/schnell', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Base URL

https://gateway.maton.ai/fal-ai/{native-api-path}

The gateway proxies requests to queue.fal.run. For model inference, paths follow the pattern:

/fal-ai/fal-ai/{model-id}
/fal-ai/fal-ai/{model-id}/requests/{request_id}/status
/fal-ai/fal-ai/{model-id}/requests/{request_id}
/fal-ai/fal-ai/{model-id}/requests/{request_id}/cancel

Authentication

All requests require the Maton API key in the Authorization header:

Authorization: Bearer $MATON_API_KEY

Environment Variable: Set your API key as MATON_API_KEY:

export MATON_API_KEY="YOUR_API_KEY"

Getting Your API Key

  1. Sign in or create an account at maton.ai
  2. Go to maton.ai/settings
  3. Copy your API key

Connection Management

Manage your fal.ai API key connections at https://ctrl.maton.ai.

List Connections

python \x3C\x3C'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=fal-ai&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Create Connection

python \x3C\x3C'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'fal-ai'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Response:

{
  "connection": {
    "connection_id": "7355bd0b-8aaf-4c58-9122-a1e3d454414d",
    "status": "PENDING",
    "url": "https://connect.maton.ai/?session_token=...",
    "app": "fal-ai",
    "method": "API_KEY"
  }
}

Open the returned url in a browser to enter your fal.ai API key.

Get Connection

python \x3C\x3C'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Delete Connection

python \x3C\x3C'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

API Reference

Queue API

The fal.ai queue API provides asynchronous model inference with status polling.

Submit Request

Submit a request to run a model. Returns immediately with a request ID.

POST /fal-ai/fal-ai/{model-id}
Content-Type: application/json

{
  "prompt": "model-specific parameters",
  ...
}

Response:

{
  "status": "IN_QUEUE",
  "request_id": "3229f185-a99a-48c0-a292-e25bf9baaeba",
  "response_url": "https://queue.fal.run/fal-ai/flux/requests/3229f185-a99a-48c0-a292-e25bf9baaeba",
  "status_url": "https://queue.fal.run/fal-ai/flux/requests/3229f185-a99a-48c0-a292-e25bf9baaeba/status",
  "cancel_url": "https://queue.fal.run/fal-ai/flux/requests/3229f185-a99a-48c0-a292-e25bf9baaeba/cancel",
  "queue_position": 0
}

Check Status

Poll for request status until completion.

GET /fal-ai/fal-ai/{model-id}/requests/{request_id}/status

Response (IN_PROGRESS):

{
  "status": "IN_PROGRESS",
  "request_id": "3229f185-a99a-48c0-a292-e25bf9baaeba"
}

Response (COMPLETED):

{
  "status": "COMPLETED",
  "request_id": "3229f185-a99a-48c0-a292-e25bf9baaeba",
  "metrics": {
    "inference_time": 0.3334658145904541
  }
}

Get Result

Retrieve the completed result.

GET /fal-ai/fal-ai/{model-id}/requests/{request_id}

Response (image generation):

{
  "images": [
    {
      "url": "https://v3b.fal.media/files/...",
      "width": 1024,
      "height": 1024,
      "content_type": "image/jpeg"
    }
  ],
  "timings": {
    "inference": 0.1587670766748488
  },
  "seed": 761506470,
  "prompt": "a tiny cute cat"
}

Cancel Request

Cancel a queued or in-progress request.

PUT /fal-ai/fal-ai/{model-id}/requests/{request_id}/cancel

Popular Models

Flux Schnell (Fast Image Generation)

python \x3C\x3C'EOF'
import urllib.request, os, json

data = json.dumps({
    "prompt": "a serene mountain landscape at sunset",
    "image_size": "landscape_16_9",
    "num_images": 1,
    "num_inference_steps": 4
}).encode()

req = urllib.request.Request('https://gateway.maton.ai/fal-ai/fal-ai/flux/schnell', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Parameters:

  • prompt (required): Text description of the image
  • image_size: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9
  • num_images: Number of images to generate (default: 1)
  • num_inference_steps: Number of steps (default: 4)
  • seed: Random seed for reproducibility

Fast SDXL (Stable Diffusion XL)

python \x3C\x3C'EOF'
import urllib.request, os, json

data = json.dumps({
    "prompt": "a futuristic city skyline at night",
    "negative_prompt": "blurry, low quality",
    "image_size": "landscape_16_9",
    "num_images": 1
}).encode()

req = urllib.request.Request('https://gateway.maton.ai/fal-ai/fal-ai/fast-sdxl', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Parameters:

  • prompt (required): Text description
  • negative_prompt: What to avoid in the image
  • image_size: Output dimensions
  • num_images: Number of images
  • guidance_scale: CFG scale (default: 7.5)
  • num_inference_steps: Number of steps

Clarity Upscaler (Image Upscaling)

python \x3C\x3C'EOF'
import urllib.request, os, json

data = json.dumps({
    "image_url": "https://example.com/image.jpg",
    "scale": 2
}).encode()

req = urllib.request.Request('https://gateway.maton.ai/fal-ai/fal-ai/clarity-upscaler', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Parameters:

  • image_url (required): URL of the image to upscale
  • scale: Upscale factor (2, 4)

Minimax Video Generation

python \x3C\x3C'EOF'
import urllib.request, os, json

data = json.dumps({
    "prompt": "A cat playing with a ball in slow motion"
}).encode()

req = urllib.request.Request('https://gateway.maton.ai/fal-ai/fal-ai/minimax/video-01', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

F5-TTS (Text-to-Speech)

python \x3C\x3C'EOF'
import urllib.request, os, json

data = json.dumps({
    "gen_text": "Hello world, this is a test of fal ai text to speech."
}).encode()

req = urllib.request.Request('https://gateway.maton.ai/fal-ai/fal-ai/f5-tts', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Request Status Values

Status Description
IN_QUEUE Request received, waiting for runner
IN_PROGRESS Model is processing the request
COMPLETED Processing finished, result available
FAILED Processing failed (check error details)

Request Headers

Header Description
X-Fal-Request-Timeout Server-side deadline in seconds
X-Fal-Runner-Hint Session affinity for routing
X-Fal-Queue-Priority normal (default) or low
X-Fal-No-Retry Disable automatic retries

Complete Workflow Example

python \x3C\x3C'EOF'
import urllib.request, os, json, time

api_key = os.environ["MATON_API_KEY"]
base_url = "https://gateway.maton.ai/fal-ai"

# 1. Submit request
data = json.dumps({
    "prompt": "a beautiful sunset over the ocean",
    "image_size": "landscape_16_9",
    "num_images": 1
}).encode()

req = urllib.request.Request(f'{base_url}/fal-ai/flux/schnell', data=data, method='POST')
req.add_header('Authorization', f'Bearer {api_key}')
req.add_header('Content-Type', 'application/json')
submit_response = json.load(urllib.request.urlopen(req))
request_id = submit_response['request_id']
print(f"Submitted: {request_id}")

# 2. Poll for completion
while True:
    req = urllib.request.Request(f'{base_url}/fal-ai/flux/requests/{request_id}/status')
    req.add_header('Authorization', f'Bearer {api_key}')
    status_response = json.load(urllib.request.urlopen(req))
    print(f"Status: {status_response['status']}")

    if status_response['status'] == 'COMPLETED':
        break
    elif status_response['status'] == 'FAILED':
        print("Request failed")
        exit(1)

    time.sleep(1)

# 3. Get result
req = urllib.request.Request(f'{base_url}/fal-ai/flux/requests/{request_id}')
req.add_header('Authorization', f'Bearer {api_key}')
result = json.load(urllib.request.urlopen(req))
print(f"Image URL: {result['images'][0]['url']}")
EOF

Code Examples

JavaScript

const submitRequest = async () => {
  // Submit
  const submitRes = await fetch('https://gateway.maton.ai/fal-ai/fal-ai/flux/schnell', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${process.env.MATON_API_KEY}`
    },
    body: JSON.stringify({
      prompt: 'a tiny cute cat',
      image_size: 'square_hd',
      num_images: 1
    })
  });
  const { request_id } = await submitRes.json();

  // Poll
  let status = 'IN_QUEUE';
  while (status !== 'COMPLETED') {
    await new Promise(r => setTimeout(r, 1000));
    const statusRes = await fetch(
      `https://gateway.maton.ai/fal-ai/fal-ai/flux/requests/${request_id}/status`,
      { headers: { 'Authorization': `Bearer ${process.env.MATON_API_KEY}` } }
    );
    status = (await statusRes.json()).status;
  }

  // Get result
  const resultRes = await fetch(
    `https://gateway.maton.ai/fal-ai/fal-ai/flux/requests/${request_id}`,
    { headers: { 'Authorization': `Bearer ${process.env.MATON_API_KEY}` } }
  );
  return await resultRes.json();
};

Python (requests)

import os
import time
import requests

api_key = os.environ["MATON_API_KEY"]
headers = {"Authorization": f"Bearer {api_key}"}

# Submit
response = requests.post(
    "https://gateway.maton.ai/fal-ai/fal-ai/flux/schnell",
    headers=headers,
    json={"prompt": "a tiny cute cat", "image_size": "square_hd", "num_images": 1}
)
request_id = response.json()["request_id"]

# Poll
while True:
    status = requests.get(
        f"https://gateway.maton.ai/fal-ai/fal-ai/flux/requests/{request_id}/status",
        headers=headers
    ).json()["status"]
    if status == "COMPLETED":
        break
    time.sleep(1)

# Get result
result = requests.get(
    f"https://gateway.maton.ai/fal-ai/fal-ai/flux/requests/{request_id}",
    headers=headers
).json()
print(result["images"][0]["url"])

Notes

  • The gateway proxies to queue.fal.run for model inference
  • All model requests are queued - poll for status until completion
  • Model parameters vary by model - check fal.ai documentation for specifics
  • Image URLs from fal.ai CDN are temporary - download or store them
  • Video generation models may take longer to complete
  • Use webhooks for long-running tasks (add ?fal_webhook=URL to submit request)
  • IMPORTANT: When piping curl output to jq, environment variables may not expand correctly. Use Python examples instead.

Error Handling

Status Meaning
400 Missing fal-ai connection or invalid request
401 Invalid or missing Maton API key
422 Invalid model parameters
429 Rate limited
4xx/5xx Passthrough error from fal.ai API

Troubleshooting

  1. Check connection exists:
python \x3C\x3C'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=fal-ai&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
  1. Verify path format: Paths must start with /fal-ai/fal-ai/{model-id}

  2. Check model exists: Some model IDs include organization prefix (e.g., fal-ai/flux/schnell)

Resources

Usage Guidance
This skill is internally consistent for a fal.ai gateway integration, but it relies on Maton (gateway.maton.ai / ctrl.maton.ai) — the MATON_API_KEY you provide will grant that gateway access to run models on your behalf. Before installing: (1) Ensure you trust Maton/maton.ai and understand their data/privacy and billing policies; (2) Use a key with appropriate scope/least privilege and avoid sharing high-privilege account keys; (3) Verify any URLs returned by the connection flow (connect.maton.ai/ctrl.maton.ai) before opening them in a browser; (4) Remember the skill is instruction-only and will make network calls — no local files are accessed by the skill itself. If you need tighter assurance, request the publisher's provenance or an official fal.ai/Maton SDK instead.
Capability Analysis
Type: OpenClaw Skill Name: fal-ai-api Version: 1.0.0 The skill bundle provides a legitimate integration for the fal.ai API via a managed gateway (maton.ai). It correctly identifies its requirement for the MATON_API_KEY environment variable and provides standard, non-obfuscated Python and JavaScript examples for model inference and connection management. No evidence of data exfiltration, malicious execution, or harmful prompt injection was found in SKILL.md or the associated code snippets.
Capability Assessment
Purpose & Capability
Name/description (fal.ai integration) align with the requested MATON_API_KEY and the documented gateway endpoints (gateway.maton.ai, ctrl.maton.ai). Requesting a single gateway API key is reasonable for a proxied fal.ai integration.
Instruction Scope
SKILL.md contains only API usage examples and management endpoints (list/create/get/delete connections, submit/poll/cancel requests). It does not instruct reading arbitrary local files, scanning other env vars, or exfiltrating unrelated data.
Install Mechanism
No install spec and no code files beyond SKILL.md/LICENSE — lowest-risk pattern for a skill. Nothing is downloaded or written to disk by the skill as published.
Credentials
Only one required environment variable (MATON_API_KEY) is declared and used in examples. That key directly corresponds to the gateway authentication described; no unrelated credentials or config paths are requested.
Persistence & Privilege
always is false and there is no indication the skill modifies other skills or system settings. Autonomous invocation is allowed (default) but not combined with other concerning factors.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install fal-ai-api
  3. After installation, invoke the skill by name or use /fal-ai-api
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of fal-ai skill: integrate fal.ai queue API with managed authentication. - Enables image generation (Flux, SDXL), video creation, image upscaling, and audio processing using fal.ai models. - Uses managed Maton API key authentication for secure access. - Provides example Python scripts for connecting, submitting jobs, managing connections, and polling results. - Includes instructions for connection management through the Maton control portal. - Supports over 1,000 model endpoints accessible via Maton gateway proxy. - Designed for easy integration with clear authentication and usage documentation.
Metadata
Slug fal-ai-api
Version 1.0.0
License MIT-0
All-time Installs 2
Active Installs 2
Total Versions 1
Frequently Asked Questions

What is fal.ai?

fal.ai API integration with managed API key authentication. Run AI models for image generation, video generation, audio processing, and more. Use this skill... It is an AI Agent Skill for Claude Code / OpenClaw, with 355 downloads so far.

How do I install fal.ai?

Run "/install fal-ai-api" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is fal.ai free?

Yes, fal.ai is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does fal.ai support?

fal.ai is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created fal.ai?

It is built and maintained by byungkyu (@byungkyu); the current version is v1.0.0.

💬 Comments