fal-api-reference
БесплатноБез исполняемых скриптовНе проверенComplete fal.ai API reference system. PROACTIVELY activate for: (1) @fal-ai/client JavaScript setup, (2) fal_client Python setup, (3) fal.subscribe/run/stream…
от JosiahSiegel★ 67 звёзд на GitHubОб этом скилле
Quick Reference
| Method | Use Case | Code |
|---|---|---|
fal.subscribe() |
Queue-based (recommended) | await fal.subscribe("model", { input }) |
fal.run() |
Fast endpoints (<30s) | await fal.run("model", { input }) |
fal.stream() |
Progressive output | for await (const event of stream) {} |
fal.realtime.connect() |
WebSocket interactive | fal.realtime.connect("model", callbacks) |
| Queue Method | Purpose |
|---|---|
fal.queue.submit() |
Submit job, get request_id |
fal.queue.status() |
Check job status |
fal.queue.result() |
Get completed result |
fal.queue.cancel() |
Cancel pending job |
| Auth | Header | Format |
|---|---|---|
| API Key | Authorization |
Key YOUR_FAL_KEY |
When to Use This Skill
Use for API integration fundamentals:
- Setting up fal.ai client in JavaScript/TypeScript
- Setting up fal_client in Python
- Choosing between subscribe, run, and stream methods
- Implementing webhook callbacks
- Uploading files to fal.media CDN
Related skills:
- For model selection: see
fal-model-guide - For performance optimization: see
fal-optimization - For custom model deployment: see
fal-serverless-guide
fal.ai API Reference
Complete API reference for fal.ai client libraries and REST endpoints.
Client Libraries
JavaScript/TypeScript (@fal-ai/client)
npm install @fal-ai/client
Configuration
import { fal } from "@fal-ai/client";
// Configure credentials (reads FAL_KEY from environment by default)
fal.config({
credentials: process.env.FAL_KEY,
// Optional: custom proxy URL for browser apps
proxyUrl: "https://your-server.com/api/fal-proxy"
});
Core Methods
fal.subscribe(endpoint, options) Queue-based execution with automatic polling. Recommended for most use cases.
const result = await fal.subscribe("fal-ai/flux/dev", {
input: {
prompt: "A beautiful landscape"
},
logs: true,
pollInterval: 1000, // Poll every second (default: 1000)
onQueueUpdate: (update) => {
// update.status: "IN_QUEUE" | "IN_PROGRESS" | "COMPLETED"
if (update.status === "IN_PROGRESS") {
update.logs?.forEach(log => console.log(log.message));
}
}
});
fal.run(endpoint, options) Direct/synchronous execution. Use only for fast endpoints (< 30 seconds).
const result = await fal.run("fal-ai/fast-sdxl", {
input: { prompt: "A cat" }
});
fal.stream(endpoint, options) Server-sent events for progressive output.
const stream = await fal.stream("fal-ai/flux/dev", {
input: { prompt: "A landscape" }
});
for await (const event of stream) {
console.log("Progress:", event);
}
const finalResult = await stream.done();
fal.realtime.connect(endpoint, callbacks) WebSocket connection for real-time interactive applications.
const connection = fal.realtime.connect("fal-ai/lcm-sd15-i2i", {
connectionKey: "unique-session-id",
throttleInterval: 128, // Debounce inputs (ms)
onResult: (result) => console.log("Generated:", result),
onError: (error) => console.error("Error:", error),
onOpen: () => console.log("Connected"),
onClose: () => console.log("Disconnected")
});
// Send inputs
connection.send({
prompt: "A cute cat",
image_url: "https://example.com/base.jpg"
});
// Close when done
connection.close();
Queue Methods
Manual queue management for advanced control.
// Submit to queue
const { request_id } = await fal.queue.submit("fal-ai/flux/dev", {
input: { prompt: "Test" },
webhookUrl: "https://your-server.com/webhook" // Optional
});
// Check status
const status = await fal.queue.status("fal-ai/flux/dev", {
requestId: request_id,
logs: true
});
// status.status: "IN_QUEUE" | "IN_PROGRESS" | "COMPLETED"
// Get result (blocks until complete)
const result = await fal.queue.result("fal-ai/flux/dev", {
requestId: request_id
});
// Cancel request
await fal.queue.cancel("fal-ai/flux/dev", {
requestId: request_id
});
Storage Methods
Upload files to fal.media CDN.
// Upload File object
const file = new File([blob], "image.png", { type: "image/png" });
const url = await fal.storage.upload(file);
// Upload from URL
const response = await fetch("https://example.com/image.jpg");
const blob = await response.blob();
const url = await fal.storage.upload(new File([blob], "image.jpg"));
Python (fal-client)
pip install fal-client
Synchronous API
import fal_client
# Simple run
result = fal_client.run(
"fal-ai/flux/dev",
arguments={
"prompt": "A beautiful landscape",
"image_size": "landscape_16_9"
}
)
# Subscribe with status updates
def on_update(update):
if isinstance(update, fal_client.InProgress):
for log in update.logs:
print(log["message"])
result = fal_client.subscribe(
"fal-ai/flux/dev",
Установить fal-api-reference в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл fal-api-reference?
Complete fal.ai API reference system. PROACTIVELY activate for: (1) @fal-ai/client JavaScript setup, (2) fal_client Python setup, (3) fal.subscribe/run/stream methods, (4) Queue management (submit/status/result), (5) Webhook configuration, (6) File upload to fal.media, (7) REST API endpoints, (8) Real-time WebSocket connections, (9) Error handling patterns. Provides: Client configuration, method signatures, queue workflow, webhook payloads, common parameters. Ensures correct API usage with proper authentication and error handling.
Как установить скилл fal-api-reference?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл fal-api-reference запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic