# fal.ai

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.paywithlocus.com/llms.txt)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API |
> |---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Generative AI platform — 600+ models for image, video, audio generation and more.

**Category:** AI / Generative | **Website:** [fal.ai](https://fal.ai) | **Docs:** [docs.fal.ai](https://docs.fal.ai)

## Access Methods

| Method | Base URL | Auth |
|--------|----------|------|
| **x402 (Base)** | `https://fal.x402.beta.paywithlocus.com/fal/` | HTTP 402 auto-payment |
| **Wrapped API** | `https://api.beta.paywithlocus.com/api/wrapped/fal/` | `Authorization: Bearer <LOCUS_API_KEY>` |

**OpenAPI discovery:** `GET https://fal.x402.beta.paywithlocus.com/openapi.json`

## Endpoints

### Generate

Queue an image or video generation request. Use status_url/result_url from the response with the polling endpoints.

**Estimated cost:** $0.006–$10+ depending on model, duration, resolution, and audio

**Payment:** x402 `exact`

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `model` | string | Yes | Reviewed LocusFounder fal model ID. Includes FLUX Schnell, Qwen Image 2, Gemini image editing, Seedance, Veo, Grok Video, and Happy Horse. |
| `prompt` | string | Yes | Text prompt for generation |
| `image_url` | string | No | Input image URL (for image-to-image/video models) |
| `num_images` | number | No | Number of images to generate |
| `duration` | number | No | Whole video duration in seconds. Required for public x402 video jobs. |
| `resolution` | string | No | Model-specific output resolution. |
| `webhook_url` | string | No | Optional HTTPS callback URL invoked by fal when the queued job completes. |

```bash
curl -X POST https://fal.x402.beta.paywithlocus.com/fal/generate \
  -H "Content-Type: application/json" \
  -H "x-locus-request-id: <UUID from the 402 response>" \
  -d '{"model":"<string>","prompt":"<string>","image_url":"<string>","num_images":"<number>","duration":"<number>","resolution":"<string>","webhook_url":"<string>"}'
```

### Status

Check the status of a queued generation request.

**Estimated cost:** $0.003

**Payment:** x402 `exact`

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `model` | string | No | Model ID used for the request. Required with request_id. |
| `request_id` | string | No | Request ID from the generate call. Required with model. |
| `status_url` | string | No | Canonical queue.fal.run status URL returned by the generate endpoint. |

```bash
curl -X POST https://fal.x402.beta.paywithlocus.com/fal/status \
  -H "Content-Type: application/json" \
  -H "x-locus-request-id: <UUID from the 402 response>" \
  -d '{"model":"<string>","request_id":"<string>","status_url":"<string>"}'
```

### Result

Retrieve the output of a completed generation request.

**Estimated cost:** $0.003

**Payment:** x402 `exact`

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `model` | string | No | Model ID used for the request. Required with request_id. |
| `request_id` | string | No | Request ID from the generate call. Required with model. |
| `result_url` | string | No | Canonical queue.fal.run response URL returned by the generate endpoint. response_url is also accepted as an alias. |

```bash
curl -X POST https://fal.x402.beta.paywithlocus.com/fal/result \
  -H "Content-Type: application/json" \
  -H "x-locus-request-id: <UUID from the 402 response>" \
  -d '{"model":"<string>","request_id":"<string>","result_url":"<string>"}'
```
