Fal AI
Last updated Apr 20, 2026 provides access to 600+ production-ready generative media models through a single, unified API. The service offers the world's largest collection of open image, video, voice, and audio generation models, all accessible with one line of code.
Endpoint
https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/fal
URL structure
When making requests to Fal AI, replace https://fal.run in the URL you're currently using with https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/fal.
Prerequisites
When making requests to Fal AI, ensure you have the following:
- Your AI Gateway Account ID.
- Your AI Gateway gateway name.
- An active Fal AI API token.
- The name of the Fal AI model you want to use.
Default synchronous API
By default, requests to the Fal AI endpoint will hit the synchronous API at https://fal.run/<path>.
cURL example
curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/fal/fal-ai/fast-sdxl \
--header 'Authorization: Key {fal_ai_token}' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "Make an image of a cat flying an aeroplane"
}'
Custom target URLs
If you need to hit a different target URL, you can supply the entire Fal target URL in the x-fal-target-url header.
cURL example with custom target URL
curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/fal \
--header 'Authorization: Bearer {fal_ai_token}' \
--header 'x-fal-target-url: https://queue.fal.run/fal-ai/bytedance/seedream/v4/edit' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "Dress the model in the clothes and hat. Add a cat to the scene and change the background to a Victorian era building.",
"image_urls": [
"https://storage.googleapis.com/falserverless/example_inputs/seedream4_edit_input_1.png",
"https://storage.googleapis.com/falserverless/example_inputs/seedream4_edit_input_2.png",
"https://storage.googleapis.com/falserverless/example_inputs/seedream4_edit_input_3.png",
"https://storage.googleapis.com/falserverless/example_inputs/seedream4_edit_input_4.png"
]
}'
WebSocket API
Fal AI also supports real-time interactions through WebSockets. For WebSocket connections and examples, see the Realtime WebSockets API documentation.
JavaScript SDK integration
The x-fal-target-url format is compliant with the Fal SDKs, so AI Gateway can be easily passed as a proxyUrl in the SDKs.
JavaScript SDK example
import { fal } from "@fal-ai/client";
fal.config({
credentials: "{fal_ai_token}", // OR pass a cloudflare api token if using BYOK on AI Gateway
proxyUrl: "https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/fal"
});
const result = await fal.subscribe("fal-ai/bytedance/seedream/v4/edit", {
"input": {
"prompt": "Dress the model in the clothes and hat. Add a cat to the scene and change the background to a Victorian era building.",
"image_urls": [
"https://storage.googleapis.com/falserverless/example_inputs/seedream4_edit_input_1.png",
"https://storage.googleapis.com/falserverless/example_inputs/seedream4_edit_input_2.png",
"https://storage.googleapis.com/falserverless/example_inputs/seedream4_edit_input_3.png",
"https://storage.googleapis.com/falserverless/example_inputs/seedream4_edit_input_4.png"
]
}
});
console.log(result.data.images[0]);
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/ai-gateway/usage/providers/fal/#page","headline":"Fal AI","description":"Route Fal AI generative media requests through AI Gateway for observability and control.","url":"https://developers.cloudflare.com/ai-gateway/usage/providers/fal/","inLanguage":"en","image":"https://developers.cloudflare.com/ai-gateway/usage/providers/fal/og.png?v=ca54c09770b62ad8","dateModified":"2026-04-20","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Route Google AI Studio and Gemini requests through AI Gateway for observability and control. title: Google AI Studio image: https://developers.cloudflare.com/ai-gateway/usage/providers/google-ai-studio/og.png?v=3cc8a49846d345ce
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/ai-gateway/llms.txt
Use this file to discover all available pages before exploring further.
Docs