1 # fal.ai
2
3 Proxy requests to fal.ai via Replit-managed billing.
4
5 ## Callback
6
7 Use `externalApi__falai` in `code_execution`.
8
9 ## Allowed operations
10
11 - `POST` `/fal-ai/bria/background/remove{/}?` - Bria RMBG 2.0 background remove (queue submit).
12 - `GET` | `PUT` `/fal-ai/bria/requests/:request_id{/:action(status|cancel)}?` - Bria queue lifecycle (model-family-scoped): fetch result, poll status, cancel.
13
14 Authorization is handled automatically by Replit. Do not pass an `Authorization` header.
15
16 ## Skill
17
18 ## fal.ai background removal quickstart
19
20 Bria RMBG background removal through fal.ai passthrough billing.
21 Submit a queue job, poll status, then fetch the result:
22
23 ```javascript
24 const submit = await externalApi__falai({
25 path: '/fal-ai/bria/background/remove',
26 method: 'POST',
27 headers: {'Content-Type': 'application/json'},
28 body: {image_url: 'https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg'},
29 })
30
31 const requestId = submit.body.request_id
32 let result
33 for (let attempt = 0; attempt < 30; attempt++) {
34 await new Promise((resolve) => setTimeout(resolve, 2000))
35 const status = await externalApi__falai({
36 path: '/fal-ai/bria/requests/' + requestId + '/status',
37 method: 'GET',
38 })
39 if (status.body.status === 'COMPLETED') {
40 result = await externalApi__falai({
41 path: '/fal-ai/bria/requests/' + requestId,
42 method: 'GET',
43 })
44 break
45 }
46 }
47
48 console.log(result.body.image.url)
49 ```
50
51 `image_url` must be a publicly fetchable image. Authorization is
52 managed by passthrough billing. Do not set an `Authorization`
53 header manually.
54
55 ## Example
56
57 ```javascript
58 const result = await externalApi__falai({
59 path: '/fal-ai/bria/background/remove{/}?',
60 method: 'POST',
61 query: {},
62 })
63
64 console.log(result.status)
65 console.log(result.body)
66 ```